The module namespace produces __strtab_ns_<sym> symbols to store namespace strings, but it does not guarantee the name uniqueness. This is a potential problem because we have exported symbols starting with "ns_". For example, kernel/capability.c exports the following symbols: EXPORT_SYMBOL(ns_capable); EXPORT_SYMBOL(capable); Assume a situation where those are converted as follows: EXPORT_SYMBOL_NS(ns_capable, some_namespace); EXPORT_SYMBOL_NS(capable, some_namespace); The former expands to "__kstrtab_ns_capable" and "__kstrtab_ns_ns_capable", and the latter to "__kstrtab_capable" and "__kstrtab_ns_capable". Then, we have the duplicated "__kstrtab_ns_capable". To ensure the uniqueness, rename "__kstrtab_ns_*" to "__kstrtabns_*".
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -55,7 +55,7 @@ extern struct module __this_module; · 54 unmodified lines | |||
| 55 | "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \ | 55 | "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \ |
| 56 | " .long " #sym "- . \n" \ | 56 | " .long " #sym "- . \n" \ |
| 57 | " .long __kstrtab_" #sym "- . \n" \ | 57 | " .long __kstrtab_" #sym "- . \n" \ |
| 58 | " .long __kstrtab_ns_" #sym "- . \n" \ | 58 | " .long __kstrtabns_" #sym "- . \n" \ |
| 59 | " .previous \n") | 59 | " .previous \n") |
| 60 | 60 | ||
| 61 | #define __KSYMTAB_ENTRY(sym, sec) \ | 61 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| @@ -79,7 +79,7 @@ struct kernel_symbol { · 17 unmodified lines | |||
| 79 | asm("__ksymtab_" #ns NS_SEPARATOR #sym) \ | 79 | asm("__ksymtab_" #ns NS_SEPARATOR #sym) \ |
| 80 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ | 80 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 81 | __aligned(sizeof(void *)) \ | 81 | __aligned(sizeof(void *)) \ |
| 82 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtab_ns_##sym } | 82 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } |
| 83 | 83 | ||
| 84 | #define __KSYMTAB_ENTRY(sym, sec) \ | 84 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 85 | static const struct kernel_symbol __ksymtab_##sym \ | 85 | static const struct kernel_symbol __ksymtab_##sym \ |
| @@ -112,7 +112,7 @@ struct kernel_symbol { · 26 unmodified lines | |||
| 112 | /* For every exported symbol, place a struct in the __ksymtab section */ | 112 | /* For every exported symbol, place a struct in the __ksymtab section */ |
| 113 | #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ | 113 | #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ |
| 114 | ___export_symbol_common(sym, sec); \ | 114 | ___export_symbol_common(sym, sec); \ |
| 115 | static const char __kstrtab_ns_##sym[] \ | 115 | static const char __kstrtabns_##sym[] \ |
| 116 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 116 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 117 | = #ns; \ | 117 | = #ns; \ |
| 118 | __KSYMTAB_ENTRY_NS(sym, sec, ns) | 118 | __KSYMTAB_ENTRY_NS(sym, sec, ns) |