History

Merge tag 'v5.4-rc4' into docs-next

I need to pick up the independent changes made to Documentation/core-api/memory-allocation.rst to be able to merge further work without creating a total mess.

Jonathan Corbet committed 7 years ago

Commit 822bbba2 parents d41abfd 7d194c2976 files · +9170 −8174Browse files

Showing the changes to scripts (13 of 976 files). Show all

Unified · Split

13 files
  1. scripts/Kbuild.include +0 −5
  2. scripts/Makefile.build +1 −1
  3. scripts/Makefile.lib +1 −1
  4. scripts/coccinelle/api/devm_platform_ioremap_resource.cocci +0 −60
  5. scripts/coccinelle/misc/add_namespace.cocci +2 −0
  6. scripts/gdb/linux/dmesg.py +12 −4
  7. scripts/gdb/linux/symbols.py +7 −1
  8. scripts/gdb/linux/utils.py +13 −12
  9. scripts/mod/modpost.c +24 −18
  10. scripts/namespace.pl +7 −6
  11. scripts/nsdeps +2 −2
  12. scripts/recordmcount.h +1 −4
  13. scripts/setlocalversion +2 −2
scripts/Kbuild.include+0−5
@@ -143,11 +143,6 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e · 142 unmodified lines
143143 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
144144 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
145145
146−# ar-option
147−# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
148−# Important: no spaces around options
149−ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
150−
151146 # ld-version
152147 # Note this is mainly for HJ Lu's 3 number binutil versions
153148 ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
scripts/Makefile.build+1−1
@@ -389,7 +389,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 388 unmodified lines
389389 ifdef builtin-target
390390
391391 quiet_cmd_ar_builtin = AR $@
392− cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
392+ cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
393393
394394 $(builtin-target): $(real-obj-y) FORCE
395395 $(call if_changed,ar_builtin)
scripts/Makefile.lib+1−1
@@ -232,7 +232,7 @@ quiet_cmd_ld = LD $@ · 231 unmodified lines
232232 # ---------------------------------------------------------------------------
233233
234234 quiet_cmd_ar = AR $@
235− cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
235+ cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
236236
237237 # Objcopy
238238 # ---------------------------------------------------------------------------
scripts/coccinelle/api/devm_platform_ioremap_resource.cocci+0−60
@@ -1,60 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0
2−/// Use devm_platform_ioremap_resource helper which wraps
3−/// platform_get_resource() and devm_ioremap_resource() together.
4−///
5−// Confidence: High
6−// Copyright: (C) 2019 Himanshu Jha GPLv2.
7−// Copyright: (C) 2019 Julia Lawall, Inria/LIP6. GPLv2.
8−// Keywords: platform_get_resource, devm_ioremap_resource,
9−// Keywords: devm_platform_ioremap_resource
10−
11−virtual patch
12−virtual report
13−
14−@r depends on patch && !report@
15−expression e1, e2, arg1, arg2, arg3;
16−identifier id;
17−@@
18−
19−(
20−- id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
21−|
22−- struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
23−)
24− ... when != id
25−- e1 = devm_ioremap_resource(arg3, id);
26−+ e1 = devm_platform_ioremap_resource(arg1, arg2);
27− ... when != id
28−? id = e2
29−
30−@r1 depends on patch && !report@
31−identifier r.id;
32−type T;
33−@@
34−
35−- T *id;
36− ...when != id
37−
38−@r2 depends on report && !patch@
39−identifier id;
40−expression e1, e2, arg1, arg2, arg3;
41−position j0;
42−@@
43−
44−(
45− id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
46−|
47− struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
48−)
49− ... when != id
50− e1@j0 = devm_ioremap_resource(arg3, id);
51− ... when != id
52−? id = e2
53−
54−@script:python depends on report && !patch@
55−e1 << r2.e1;
56−j0 << r2.j0;
57−@@
58−
59−msg = "WARNING: Use devm_platform_ioremap_resource for %s" % (e1)
60−coccilib.report.print_report(j0[0], msg)
scripts/coccinelle/misc/add_namespace.cocci+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 /// add a missing namespace tag to a module source file.
77 ///
88
9+virtual report
10+
911 @has_ns_import@
1012 declarer name MODULE_IMPORT_NS;
1113 identifier virtual.ns;
scripts/gdb/linux/dmesg.py+12−4
@@ -16,6 +16,8 @@ import sys · 15 unmodified lines
1616
1717 from linux import utils
1818
19+printk_log_type = utils.CachedType("struct printk_log")
20+
1921
2022 class LxDmesg(gdb.Command):
2123 """Print Linux kernel log buffer."""
@@ -42,9 +44,14 @@ class LxDmesg(gdb.Command): · 20 unmodified lines
4244 b = utils.read_memoryview(inf, log_buf_addr, log_next_idx)
4345 log_buf = a.tobytes() + b.tobytes()
4446
47+ length_offset = printk_log_type.get_type()['len'].bitpos // 8
48+ text_len_offset = printk_log_type.get_type()['text_len'].bitpos // 8
49+ time_stamp_offset = printk_log_type.get_type()['ts_nsec'].bitpos // 8
50+ text_offset = printk_log_type.get_type().sizeof
51+
4552 pos = 0
4653 while pos < log_buf.__len__():
47− length = utils.read_u16(log_buf[pos + 8:pos + 10])
54+ length = utils.read_u16(log_buf, pos + length_offset)
4855 if length == 0:
4956 if log_buf_2nd_half == -1:
5057 gdb.write("Corrupted log buffer!\n")
@@ -52,10 +59,11 @@ class LxDmesg(gdb.Command): · 1 unmodified line
5259 pos = log_buf_2nd_half
5360 continue
5461
55− text_len = utils.read_u16(log_buf[pos + 10:pos + 12])
56− text = log_buf[pos + 16:pos + 16 + text_len].decode(
62+ text_len = utils.read_u16(log_buf, pos + text_len_offset)
63+ text_start = pos + text_offset
64+ text = log_buf[text_start:text_start + text_len].decode(
5765 encoding='utf8', errors='replace')
58− time_stamp = utils.read_u64(log_buf[pos:pos + 8])
66+ time_stamp = utils.read_u64(log_buf, pos + time_stamp_offset)
5967
6068 for line in text.splitlines():
6169 msg = u"[{time:12.6f}] {line}\n".format(
scripts/gdb/linux/symbols.py+7−1
@@ -15,7 +15,7 @@ import gdb · 14 unmodified lines
1515 import os
1616 import re
1717
18−from linux import modules
18+from linux import modules, utils
1919
2020
2121 if hasattr(gdb, 'Breakpoint'):
@@ -116,6 +116,12 @@ lx-symbols command.""" · 94 unmodified lines
116116 module_file = self._get_module_file(module_name)
117117
118118 if module_file:
119+ if utils.is_target_arch('s390'):
120+ # Module text is preceded by PLT stubs on s390.
121+ module_arch = module['arch']
122+ plt_offset = int(module_arch['plt_offset'])
123+ plt_size = int(module_arch['plt_size'])
124+ module_addr = hex(int(module_addr, 0) + plt_offset + plt_size)
119125 gdb.write("loading @{addr}: {filename}\n".format(
120126 addr=module_addr, filename=module_file))
121127 cmdline = "add-symbol-file {filename} {addr}{sections}".format(
scripts/gdb/linux/utils.py+13−12
@@ -92,15 +92,16 @@ def read_memoryview(inf, start, length): · 91 unmodified lines
9292 return memoryview(inf.read_memory(start, length))
9393
9494
95−def read_u16(buffer):
95+def read_u16(buffer, offset):
96+ buffer_val = buffer[offset:offset + 2]
9697 value = [0, 0]
9798
98− if type(buffer[0]) is str:
99− value[0] = ord(buffer[0])
100− value[1] = ord(buffer[1])
99+ if type(buffer_val[0]) is str:
100+ value[0] = ord(buffer_val[0])
101+ value[1] = ord(buffer_val[1])
101102 else:
102− value[0] = buffer[0]
103− value[1] = buffer[1]
103+ value[0] = buffer_val[0]
104+ value[1] = buffer_val[1]
104105
105106 if get_target_endianness() == LITTLE_ENDIAN:
106107 return value[0] + (value[1] << 8)
@@ -108,18 +109,18 @@ def read_u16(buffer): · 1 unmodified line
108109 return value[1] + (value[0] << 8)
109110
110111
111−def read_u32(buffer):
112+def read_u32(buffer, offset):
112113 if get_target_endianness() == LITTLE_ENDIAN:
113− return read_u16(buffer[0:2]) + (read_u16(buffer[2:4]) << 16)
114+ return read_u16(buffer, offset) + (read_u16(buffer, offset + 2) << 16)
114115 else:
115− return read_u16(buffer[2:4]) + (read_u16(buffer[0:2]) << 16)
116+ return read_u16(buffer, offset + 2) + (read_u16(buffer, offset) << 16)
116117
117118
118−def read_u64(buffer):
119+def read_u64(buffer, offset):
119120 if get_target_endianness() == LITTLE_ENDIAN:
120− return read_u32(buffer[0:4]) + (read_u32(buffer[4:8]) << 32)
121+ return read_u32(buffer, offset) + (read_u32(buffer, offset + 4) << 32)
121122 else:
122− return read_u32(buffer[4:8]) + (read_u32(buffer[0:4]) << 32)
123+ return read_u32(buffer, offset + 4) + (read_u32(buffer, offset) << 32)
123124
124125
125126 target_arch = None
scripts/mod/modpost.c+24−18
@@ -166,7 +166,7 @@ struct symbol { · 165 unmodified lines
166166 struct module *module;
167167 unsigned int crc;
168168 int crc_valid;
169− const char *namespace;
169+ char *namespace;
170170 unsigned int weak:1;
171171 unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */
172172 unsigned int kernel:1; /* 1 if symbol is from kernel
@@ -348,20 +348,18 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec) · 175 unmodified lines
348348 return export_unknown;
349349 }
350350
351−static const char *sym_extract_namespace(const char **symname)
351+static char *sym_extract_namespace(const char **symname)
352352 {
353− size_t n;
354− char *dupsymname;
353+ char *namespace = NULL;
354+ char *ns_separator;
355355
356− n = strcspn(*symname, ".");
357− if (n < strlen(*symname) - 1) {
358− dupsymname = NOFAIL(strdup(*symname));
359− dupsymname[n] = '\0';
360− *symname = dupsymname;
361− return dupsymname + n + 1;
356+ ns_separator = strchr(*symname, '.');
357+ if (ns_separator) {
358+ namespace = NOFAIL(strndup(*symname, ns_separator - *symname));
359+ *symname = ns_separator + 1;
362360 }
363361
364− return NULL;
362+ return namespace;
365363 }
366364
367365 /**
@@ -375,7 +373,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, · 7 unmodified lines
375373
376374 if (!s) {
377375 s = new_symbol(name, mod, export);
378− s->namespace = namespace;
379376 } else {
380377 if (!s->preloaded) {
381378 warn("%s: '%s' exported twice. Previous export was in %s%s\n",
@@ -386,6 +383,8 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, · 4 unmodified lines
386383 s->module = mod;
387384 }
388385 }
386+ free(s->namespace);
387+ s->namespace = namespace ? strdup(namespace) : NULL;
389388 s->preloaded = 0;
390389 s->vmlinux = is_vmlinux(mod->name);
391390 s->kernel = 0;
@@ -672,7 +671,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 280 unmodified lines
672671 unsigned int crc;
673672 enum export export;
674673 bool is_crc = false;
675− const char *name, *namespace;
674+ const char *name;
675+ char *namespace;
676676
677677 if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
678678 strstarts(symname, "__ksymtab"))
@@ -747,6 +747,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 68 unmodified lines
747747 name = symname + strlen("__ksymtab_");
748748 namespace = sym_extract_namespace(&name);
749749 sym_add_exported(name, namespace, mod, export);
750+ free(namespace);
750751 }
751752 if (strcmp(symname, "init_module") == 0)
752753 mod->has_init = 1;
@@ -2195,7 +2196,7 @@ static int check_exports(struct module *mod) · 1442 unmodified lines
21952196 else
21962197 basename = mod->name;
21972198
2198− if (exp->namespace) {
2199+ if (exp->namespace && exp->namespace[0]) {
21992200 add_namespace(&mod->required_namespaces,
22002201 exp->namespace);
22012202
@@ -2652,15 +2653,20 @@ int main(int argc, char **argv) · 450 unmodified lines
26522653 fatal("modpost: Section mismatches detected.\n"
26532654 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
26542655 for (n = 0; n < SYMBOL_HASH_SIZE; n++) {
2655− struct symbol *s = symbolhash[n];
2656+ struct symbol *s;
2657+
2658+ for (s = symbolhash[n]; s; s = s->next) {
2659+ /*
2660+ * Do not check "vmlinux". This avoids the same warnings
2661+ * shown twice, and false-positives for ARCH=um.
2662+ */
2663+ if (is_vmlinux(s->module->name) && !s->module->is_dot_o)
2664+ continue;
26562665
2657− while (s) {
26582666 if (s->is_static)
26592667 warn("\"%s\" [%s] is a static %s\n",
26602668 s->name, s->module->name,
26612669 export_str(s->export));
2662−
2663− s = s->next;
26642670 }
26652671 }
26662672
scripts/namespace.pl+7−6
@@ -65,13 +65,14 @@ · 64 unmodified lines
6565 use warnings;
6666 use strict;
6767 use File::Find;
68+use File::Spec;
6869
6970 my $nm = ($ENV{'NM'} || "nm") . " -p";
7071 my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";
71−my $srctree = "";
72−my $objtree = "";
73−$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));
74−$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'}));
72+my $srctree = File::Spec->curdir();
73+my $objtree = File::Spec->curdir();
74+$srctree = File::Spec->rel2abs($ENV{'srctree'}) if (exists($ENV{'srctree'}));
75+$objtree = File::Spec->rel2abs($ENV{'objtree'}) if (exists($ENV{'objtree'}));
7576
7677 if ($#ARGV != -1) {
7778 print STDERR "usage: $0 takes no parameters\n";
@@ -231,9 +232,9 @@ sub do_nm · 153 unmodified lines
231232 }
232233 ($source = $basename) =~ s/\.o$//;
233234 if (-e "$source.c" || -e "$source.S") {
234− $source = "$objtree$File::Find::dir/$source";
235+ $source = File::Spec->catfile($objtree, $File::Find::dir, $source)
235236 } else {
236− $source = "$srctree$File::Find::dir/$source";
237+ $source = File::Spec->catfile($srctree, $File::Find::dir, $source)
237238 }
238239 if (! -e "$source.c" && ! -e "$source.S") {
239240 # No obvious source, exclude the object if it is conglomerate
scripts/nsdeps+2−2
@@ -1,4 +1,4 @@
1−#!/bin/bash
1+#!/bin/sh
22 # SPDX-License-Identifier: GPL-2.0
33 # Linux kernel symbol namespace import generator
44 #
@@ -41,7 +41,7 @@ generate_deps() { · 36 unmodified lines
4141 for source_file in $mod_source_files; do
4242 sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp
4343 offset=$(wc -l ${source_file}.tmp | awk '{print $1;}')
44− cat $source_file | grep MODULE_IMPORT_NS | sort -u >> ${source_file}.tmp
44+ cat $source_file | grep MODULE_IMPORT_NS | LANG=C sort -u >> ${source_file}.tmp
4545 tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp
4646 if ! diff -q ${source_file} ${source_file}.tmp; then
4747 mv ${source_file}.tmp ${source_file}
scripts/recordmcount.h+1−4
@@ -389,11 +389,8 @@ static int nop_mcount(Elf_Shdr const *const relhdr, · 388 unmodified lines
389389 mcountsym = get_mcountsym(sym0, relp, str0);
390390
391391 if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
392− if (make_nop) {
392+ if (make_nop)
393393 ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
394− if (ret < 0)
395− return -1;
396− }
397394 if (warn_on_notrace_sect && !once) {
398395 printf("Section %s has mcount callers being ignored\n",
399396 txtname);
scripts/setlocalversion+2−2
@@ -93,7 +93,7 @@ scm_version() · 92 unmodified lines
9393 # Check for mercurial and a mercurial repo.
9494 if test -d .hg && hgid=`hg id 2>/dev/null`; then
9595 # Do we have an tagged version? If so, latesttagdistance == 1
96− if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
96+ if [ "`hg log -r . --template '{latesttagdistance}'`" = "1" ]; then
9797 id=`hg log -r . --template '{latesttag}'`
9898 printf '%s%s' -hg "$id"
9999 else
@@ -126,7 +126,7 @@ scm_version() · 26 unmodified lines
126126
127127 collect_files()
128128 {
129− local file res
129+ local file res=
130130
131131 for file; do
132132 case "$file" in