Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'modules-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux

Pull module fixes from Jessica Yu:
"Code cleanups and kbuild/namespace related fixups from Masahiro.

Most importantly, it fixes a namespace-related modpost issue for
external module builds

- Fix broken external module builds due to a modpost bug in
read_dump(), where the namespace was not being strdup'd and
sym->namespace would be set to bogus data.

- Various namespace-related kbuild fixes and cleanups thanks to
Masahiro Yamada"

* tag 'modules-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
doc: move namespaces.rst from kbuild/ to core-api/
nsdeps: make generated patches independent of locale
nsdeps: fix hashbang of scripts/nsdeps
kbuild: fix build error of 'make nsdeps' in clean tree
module: rename __kstrtab_ns_* to __kstrtabns_* to avoid symbol conflict
modpost: fix broken sym->namespace for external module builds
module: swap the order of symbol.namespace
scripts: add_namespace: Fix coccicheck failed

+27 -22
+1
Documentation/core-api/index.rst
··· 38 38 protection-keys 39 39 ../RCU/index 40 40 gcc-plugins 41 + symbol-namespaces 41 42 42 43 43 44 Interfaces for kernel debugging
Documentation/kbuild/namespaces.rst Documentation/core-api/symbol-namespaces.rst
+1
MAINTAINERS
··· 11544 11544 M: Matthias Maennich <maennich@google.com> 11545 11545 S: Maintained 11546 11546 F: scripts/nsdeps 11547 + F: Documentation/core-api/symbol-namespaces.rst 11547 11548 11548 11549 NTB AMD DRIVER 11549 11550 M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+1 -1
Makefile
··· 599 599 # in addition to whatever we do anyway. 600 600 # Just "make" or "make all" shall build modules as well 601 601 602 - ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) 602 + ifneq ($(filter all _all modules nsdeps,$(MAKECMDGOALS)),) 603 603 KBUILD_MODULES := 1 604 604 endif 605 605
+5 -5
include/linux/export.h
··· 52 52 __ADDRESSABLE(sym) \ 53 53 asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ 54 54 " .balign 4 \n" \ 55 - "__ksymtab_" #sym NS_SEPARATOR #ns ": \n" \ 55 + "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \ 56 56 " .long " #sym "- . \n" \ 57 57 " .long __kstrtab_" #sym "- . \n" \ 58 - " .long __kstrtab_ns_" #sym "- . \n" \ 58 + " .long __kstrtabns_" #sym "- . \n" \ 59 59 " .previous \n") 60 60 61 61 #define __KSYMTAB_ENTRY(sym, sec) \ ··· 76 76 #else 77 77 #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \ 78 78 static const struct kernel_symbol __ksymtab_##sym##__##ns \ 79 - asm("__ksymtab_" #sym NS_SEPARATOR #ns) \ 79 + asm("__ksymtab_" #ns NS_SEPARATOR #sym) \ 80 80 __attribute__((section("___ksymtab" sec "+" #sym), used)) \ 81 81 __aligned(sizeof(void *)) \ 82 - = { (unsigned long)&sym, __kstrtab_##sym, __kstrtab_ns_##sym } 82 + = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } 83 83 84 84 #define __KSYMTAB_ENTRY(sym, sec) \ 85 85 static const struct kernel_symbol __ksymtab_##sym \ ··· 112 112 /* For every exported symbol, place a struct in the __ksymtab section */ 113 113 #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ 114 114 ___export_symbol_common(sym, sec); \ 115 - static const char __kstrtab_ns_##sym[] \ 115 + static const char __kstrtabns_##sym[] \ 116 116 __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ 117 117 = #ns; \ 118 118 __KSYMTAB_ENTRY_NS(sym, sec, ns)
+2
scripts/coccinelle/misc/add_namespace.cocci
··· 6 6 /// add a missing namespace tag to a module source file. 7 7 /// 8 8 9 + virtual report 10 + 9 11 @has_ns_import@ 10 12 declarer name MODULE_IMPORT_NS; 11 13 identifier virtual.ns;
+15 -14
scripts/mod/modpost.c
··· 166 166 struct module *module; 167 167 unsigned int crc; 168 168 int crc_valid; 169 - const char *namespace; 169 + char *namespace; 170 170 unsigned int weak:1; 171 171 unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */ 172 172 unsigned int kernel:1; /* 1 if symbol is from kernel ··· 348 348 return export_unknown; 349 349 } 350 350 351 - static const char *sym_extract_namespace(const char **symname) 351 + static char *sym_extract_namespace(const char **symname) 352 352 { 353 - size_t n; 354 - char *dupsymname; 353 + char *namespace = NULL; 354 + char *ns_separator; 355 355 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; 362 360 } 363 361 364 - return NULL; 362 + return namespace; 365 363 } 366 364 367 365 /** ··· 373 375 374 376 if (!s) { 375 377 s = new_symbol(name, mod, export); 376 - s->namespace = namespace; 377 378 } else { 378 379 if (!s->preloaded) { 379 380 warn("%s: '%s' exported twice. Previous export was in %s%s\n", ··· 383 386 s->module = mod; 384 387 } 385 388 } 389 + free(s->namespace); 390 + s->namespace = namespace ? strdup(namespace) : NULL; 386 391 s->preloaded = 0; 387 392 s->vmlinux = is_vmlinux(mod->name); 388 393 s->kernel = 0; ··· 671 672 unsigned int crc; 672 673 enum export export; 673 674 bool is_crc = false; 674 - const char *name, *namespace; 675 + const char *name; 676 + char *namespace; 675 677 676 678 if ((!is_vmlinux(mod->name) || mod->is_dot_o) && 677 679 strstarts(symname, "__ksymtab")) ··· 747 747 name = symname + strlen("__ksymtab_"); 748 748 namespace = sym_extract_namespace(&name); 749 749 sym_add_exported(name, namespace, mod, export); 750 + free(namespace); 750 751 } 751 752 if (strcmp(symname, "init_module") == 0) 752 753 mod->has_init = 1; ··· 2196 2195 else 2197 2196 basename = mod->name; 2198 2197 2199 - if (exp->namespace) { 2198 + if (exp->namespace && exp->namespace[0]) { 2200 2199 add_namespace(&mod->required_namespaces, 2201 2200 exp->namespace); 2202 2201
+2 -2
scripts/nsdeps
··· 1 - #!/bin/bash 1 + #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # Linux kernel symbol namespace import generator 4 4 # ··· 41 41 for source_file in $mod_source_files; do 42 42 sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp 43 43 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 45 45 tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp 46 46 if ! diff -q ${source_file} ${source_file}.tmp; then 47 47 mv ${source_file}.tmp ${source_file}