Pull module updates from Jessica Yu: "Summary of modules changes for the 5.6 merge window: - Add "MS" (SHF_MERGE|SHF_STRINGS) section flags to __ksymtab_strings to indicate to the linker that it can perform string deduplication (i.e., duplicate strings are reduced to a single copy in the string table). This means any repeated namespace string would be merged to just one entry in __ksymtab_strings. - Various code cleanups and small fixes (fix small memleak in error path, improve moduleparam docs, silence rcu warnings, improve error logging)" * tag 'modules-for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux: module.h: Annotate mod_kallsyms with __rcu module: avoid setting info->name early in case we can fall back to info->mod->name modsign: print module name along with error message kernel/module: Fix memleak in module_add_modinfo_attrs() export.h: reduce __ksymtab_strings string duplication by using "MS" section flags moduleparam: fix kerneldoc modules: lockdep: Suppress suspicious RCU usage warning
Showing the changes to include/linux (3 of 5 files). Show all
Unified · Split
| @@ -82,16 +82,29 @@ struct kernel_symbol { · 81 unmodified lines | |||
| 82 | 82 | ||
| 83 | #else | 83 | #else |
| 84 | 84 | ||
| 85 | /* For every exported symbol, place a struct in the __ksymtab section */ | 85 | /* |
| 86 | #define ___EXPORT_SYMBOL(sym, sec, ns) \ | 86 | * For every exported symbol, do the following: |
| 87 | extern typeof(sym) sym; \ | 87 | * |
| 88 | __CRC_SYMBOL(sym, sec); \ | 88 | * - If applicable, place a CRC entry in the __kcrctab section. |
| 89 | static const char __kstrtab_##sym[] \ | 89 | * - Put the name of the symbol and namespace (empty string "" for none) in |
| 90 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 90 | * __ksymtab_strings. |
| 91 | = #sym; \ | 91 | * - Place a struct kernel_symbol entry in the __ksymtab section. |
| 92 | static const char __kstrtabns_##sym[] \ | 92 | * |
| 93 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 93 | * note on .section use: we specify progbits since usage of the "M" (SHF_MERGE) |
| 94 | = ns; \ | 94 | * section flag requires it. Use '%progbits' instead of '@progbits' since the |
| 95 | * former apparently works on all arches according to the binutils source. | ||
| 96 | */ | ||
| 97 | #define ___EXPORT_SYMBOL(sym, sec, ns) \ | ||
| 98 | extern typeof(sym) sym; \ | ||
| 99 | extern const char __kstrtab_##sym[]; \ | ||
| 100 | extern const char __kstrtabns_##sym[]; \ | ||
| 101 | __CRC_SYMBOL(sym, sec); \ | ||
| 102 | asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \ | ||
| 103 | "__kstrtab_" #sym ": \n" \ | ||
| 104 | " .asciz \"" #sym "\" \n" \ | ||
| 105 | "__kstrtabns_" #sym ": \n" \ | ||
| 106 | " .asciz \"" ns "\" \n" \ | ||
| 107 | " .previous \n"); \ | ||
| 95 | __KSYMTAB_ENTRY(sym, sec) | 108 | __KSYMTAB_ENTRY(sym, sec) |
| 96 | 109 | ||
| 97 | #endif | 110 | #endif |
| @@ -429,7 +429,7 @@ struct module { · 428 unmodified lines | |||
| 429 | 429 | ||
| 430 | #ifdef CONFIG_KALLSYMS | 430 | #ifdef CONFIG_KALLSYMS |
| 431 | /* Protected by RCU and/or module_mutex: use rcu_dereference() */ | 431 | /* Protected by RCU and/or module_mutex: use rcu_dereference() */ |
| 432 | struct mod_kallsyms *kallsyms; | 432 | struct mod_kallsyms __rcu *kallsyms; |
| 433 | struct mod_kallsyms core_kallsyms; | 433 | struct mod_kallsyms core_kallsyms; |
| 434 | 434 | ||
| 435 | /* Section attributes */ | 435 | /* Section attributes */ |
| @@ -128,6 +128,9 @@ struct kparam_array · 127 unmodified lines | |||
| 128 | 128 | ||
| 129 | /** | 129 | /** |
| 130 | * module_param_unsafe - same as module_param but taints kernel | 130 | * module_param_unsafe - same as module_param but taints kernel |
| 131 | * @name: the variable to alter, and exposed parameter name. | ||
| 132 | * @type: the type of the parameter | ||
| 133 | * @perm: visibility in sysfs. | ||
| 131 | */ | 134 | */ |
| 132 | #define module_param_unsafe(name, type, perm) \ | 135 | #define module_param_unsafe(name, type, perm) \ |
| 133 | module_param_named_unsafe(name, name, type, perm) | 136 | module_param_named_unsafe(name, name, type, perm) |
| @@ -150,6 +153,10 @@ struct kparam_array · 16 unmodified lines | |||
| 150 | 153 | ||
| 151 | /** | 154 | /** |
| 152 | * module_param_named_unsafe - same as module_param_named but taints kernel | 155 | * module_param_named_unsafe - same as module_param_named but taints kernel |
| 156 | * @name: a valid C identifier which is the parameter name. | ||
| 157 | * @value: the actual lvalue to alter. | ||
| 158 | * @type: the type of the parameter | ||
| 159 | * @perm: visibility in sysfs. | ||
| 153 | */ | 160 | */ |
| 154 | #define module_param_named_unsafe(name, value, type, perm) \ | 161 | #define module_param_named_unsafe(name, value, type, perm) \ |
| 155 | param_check_##type(name, &(value)); \ | 162 | param_check_##type(name, &(value)); \ |
| @@ -160,6 +167,7 @@ struct kparam_array · 4 unmodified lines | |||
| 160 | * module_param_cb - general callback for a module/cmdline parameter | 167 | * module_param_cb - general callback for a module/cmdline parameter |
| 161 | * @name: a valid C identifier which is the parameter name. | 168 | * @name: a valid C identifier which is the parameter name. |
| 162 | * @ops: the set & get operations for this parameter. | 169 | * @ops: the set & get operations for this parameter. |
| 170 | * @arg: args for @ops | ||
| 163 | * @perm: visibility in sysfs. | 171 | * @perm: visibility in sysfs. |
| 164 | * | 172 | * |
| 165 | * The ops can have NULL set or get functions. | 173 | * The ops can have NULL set or get functions. |
| @@ -171,36 +179,96 @@ struct kparam_array · 5 unmodified lines | |||
| 171 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ | 179 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ |
| 172 | KERNEL_PARAM_FL_UNSAFE) | 180 | KERNEL_PARAM_FL_UNSAFE) |
| 173 | 181 | ||
| 182 | #define __level_param_cb(name, ops, arg, perm, level) \ | ||
| 183 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0) | ||
| 174 | /** | 184 | /** |
| 175 | * <level>_param_cb - general callback for a module/cmdline parameter | 185 | * core_param_cb - general callback for a module/cmdline parameter |
| 176 | * to be evaluated before certain initcall level | 186 | * to be evaluated before core initcall level |
| 177 | * @name: a valid C identifier which is the parameter name. | 187 | * @name: a valid C identifier which is the parameter name. |
| 178 | * @ops: the set & get operations for this parameter. | 188 | * @ops: the set & get operations for this parameter. |
| 189 | * @arg: args for @ops | ||
| 179 | * @perm: visibility in sysfs. | 190 | * @perm: visibility in sysfs. |
| 180 | * | 191 | * |
| 181 | * The ops can have NULL set or get functions. | 192 | * The ops can have NULL set or get functions. |
| 182 | */ | 193 | */ |
| 183 | #define __level_param_cb(name, ops, arg, perm, level) \ | ||
| 184 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0) | ||
| 185 | |||
| 186 | #define core_param_cb(name, ops, arg, perm) \ | 194 | #define core_param_cb(name, ops, arg, perm) \ |
| 187 | __level_param_cb(name, ops, arg, perm, 1) | 195 | __level_param_cb(name, ops, arg, perm, 1) |
| 188 | 196 | ||
| 197 | /** | ||
| 198 | * postcore_param_cb - general callback for a module/cmdline parameter | ||
| 199 | * to be evaluated before postcore initcall level | ||
| 200 | * @name: a valid C identifier which is the parameter name. | ||
| 201 | * @ops: the set & get operations for this parameter. | ||
| 202 | * @arg: args for @ops | ||
| 203 | * @perm: visibility in sysfs. | ||
| 204 | * | ||
| 205 | * The ops can have NULL set or get functions. | ||
| 206 | */ | ||
| 189 | #define postcore_param_cb(name, ops, arg, perm) \ | 207 | #define postcore_param_cb(name, ops, arg, perm) \ |
| 190 | __level_param_cb(name, ops, arg, perm, 2) | 208 | __level_param_cb(name, ops, arg, perm, 2) |
| 191 | 209 | ||
| 210 | /** | ||
| 211 | * arch_param_cb - general callback for a module/cmdline parameter | ||
| 212 | * to be evaluated before arch initcall level | ||
| 213 | * @name: a valid C identifier which is the parameter name. | ||
| 214 | * @ops: the set & get operations for this parameter. | ||
| 215 | * @arg: args for @ops | ||
| 216 | * @perm: visibility in sysfs. | ||
| 217 | * | ||
| 218 | * The ops can have NULL set or get functions. | ||
| 219 | */ | ||
| 192 | #define arch_param_cb(name, ops, arg, perm) \ | 220 | #define arch_param_cb(name, ops, arg, perm) \ |
| 193 | __level_param_cb(name, ops, arg, perm, 3) | 221 | __level_param_cb(name, ops, arg, perm, 3) |
| 194 | 222 | ||
| 223 | /** | ||
| 224 | * subsys_param_cb - general callback for a module/cmdline parameter | ||
| 225 | * to be evaluated before subsys initcall level | ||
| 226 | * @name: a valid C identifier which is the parameter name. | ||
| 227 | * @ops: the set & get operations for this parameter. | ||
| 228 | * @arg: args for @ops | ||
| 229 | * @perm: visibility in sysfs. | ||
| 230 | * | ||
| 231 | * The ops can have NULL set or get functions. | ||
| 232 | */ | ||
| 195 | #define subsys_param_cb(name, ops, arg, perm) \ | 233 | #define subsys_param_cb(name, ops, arg, perm) \ |
| 196 | __level_param_cb(name, ops, arg, perm, 4) | 234 | __level_param_cb(name, ops, arg, perm, 4) |
| 197 | 235 | ||
| 236 | /** | ||
| 237 | * fs_param_cb - general callback for a module/cmdline parameter | ||
| 238 | * to be evaluated before fs initcall level | ||
| 239 | * @name: a valid C identifier which is the parameter name. | ||
| 240 | * @ops: the set & get operations for this parameter. | ||
| 241 | * @arg: args for @ops | ||
| 242 | * @perm: visibility in sysfs. | ||
| 243 | * | ||
| 244 | * The ops can have NULL set or get functions. | ||
| 245 | */ | ||
| 198 | #define fs_param_cb(name, ops, arg, perm) \ | 246 | #define fs_param_cb(name, ops, arg, perm) \ |
| 199 | __level_param_cb(name, ops, arg, perm, 5) | 247 | __level_param_cb(name, ops, arg, perm, 5) |
| 200 | 248 | ||
| 249 | /** | ||
| 250 | * device_param_cb - general callback for a module/cmdline parameter | ||
| 251 | * to be evaluated before device initcall level | ||
| 252 | * @name: a valid C identifier which is the parameter name. | ||
| 253 | * @ops: the set & get operations for this parameter. | ||
| 254 | * @arg: args for @ops | ||
| 255 | * @perm: visibility in sysfs. | ||
| 256 | * | ||
| 257 | * The ops can have NULL set or get functions. | ||
| 258 | */ | ||
| 201 | #define device_param_cb(name, ops, arg, perm) \ | 259 | #define device_param_cb(name, ops, arg, perm) \ |
| 202 | __level_param_cb(name, ops, arg, perm, 6) | 260 | __level_param_cb(name, ops, arg, perm, 6) |
| 203 | 261 | ||
| 262 | /** | ||
| 263 | * late_param_cb - general callback for a module/cmdline parameter | ||
| 264 | * to be evaluated before late initcall level | ||
| 265 | * @name: a valid C identifier which is the parameter name. | ||
| 266 | * @ops: the set & get operations for this parameter. | ||
| 267 | * @arg: args for @ops | ||
| 268 | * @perm: visibility in sysfs. | ||
| 269 | * | ||
| 270 | * The ops can have NULL set or get functions. | ||
| 271 | */ | ||
| 204 | #define late_param_cb(name, ops, arg, perm) \ | 272 | #define late_param_cb(name, ops, arg, perm) \ |
| 205 | __level_param_cb(name, ops, arg, perm, 7) | 273 | __level_param_cb(name, ops, arg, perm, 7) |
| 206 | 274 | ||
| @@ -263,6 +331,10 @@ static inline void kernel_param_unlock(struct module *mod) · 56 unmodified lines | |||
| 263 | 331 | ||
| 264 | /** | 332 | /** |
| 265 | * core_param_unsafe - same as core_param but taints kernel | 333 | * core_param_unsafe - same as core_param but taints kernel |
| 334 | * @name: the name of the cmdline and sysfs parameter (often the same as var) | ||
| 335 | * @var: the variable | ||
| 336 | * @type: the type of the parameter | ||
| 337 | * @perm: visibility in sysfs | ||
| 266 | */ | 338 | */ |
| 267 | #define core_param_unsafe(name, var, type, perm) \ | 339 | #define core_param_unsafe(name, var, type, perm) \ |
| 268 | param_check_##type(name, &(var)); \ | 340 | param_check_##type(name, &(var)); \ |