Modules updates for v5.6
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)
Signed-off-by: Jessica Yu <jeyu@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEVrp26glSWYuDNrCUwEV+OM47wXIFAl40TvwQHGpleXVAa2Vy
bmVsLm9yZwAKCRDARX44zjvBcigxD/4/ksGeXvf3tcsRc5M5S33Tws25vcHeByz/
WEX1f7ZnXukCApFdnpUbVkjiH7EM0+T6lGumv4NPJht+ggP8JoY9hMkBqMmd0js/
+R9U6o0vB4LW8zU68RwE0TS4qphpmpJz16HlhTPtIk4Vo0GBxnEYMMMcVWIeqq1W
m3KcEUudv9/Y7IFawDNRJcUWI1jD2vcfaavbU6XbTw82ARiiScZFrWYzf1PGYJ6L
XvJNwCVh8TDbS4C5kaNWp2LiGXegjKClosdisCIjkQr/3e+Rg1jOGHpa6B2+Vow2
ttq6lmcikNpcCkCV1tFz+ex2LLsLBMAO939c2C0LIhnnIxVgSkDU0pWn3psAxiOl
lRqHtQN42dRlOtBwZ9JoKTT9Wi3H/Lx0FCxg5OdblrSlOqH+GxQjBLkgtvmn/ZAh
/dReehUoqbL55GieZuPPyostg3upCDE27IQZdFrZLWbE0VGiIyU9p6GYo7Tssuo2
Tr8kmhYUF9o1AnlzVQgGgZF73PpM6vhmEnn/dipZrgFI//2A3xkAfi5JdhGLKsFi
UsaeTX3q/AmnC8dqaNayiftSgaK/4hdSboW1hgWLLD98H608s7Bl1reTmXPxSyWj
RvBVP0vp5+u9EItfkAG6jbEpM5ZtyFDUc+5KNfJhym6vaplp5H+krIrT2Li+oLUu
d/eifJ/1vA==
=boqg
-----END PGP SIGNATURE-----
Merge tag 'modules-for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux
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
This commit is contained in:
commit
ddaefe8947
5 changed files with 119 additions and 28 deletions
|
|
@ -82,16 +82,29 @@ struct kernel_symbol {
|
|||
|
||||
#else
|
||||
|
||||
/* For every exported symbol, place a struct in the __ksymtab section */
|
||||
#define ___EXPORT_SYMBOL(sym, sec, ns) \
|
||||
extern typeof(sym) sym; \
|
||||
__CRC_SYMBOL(sym, sec); \
|
||||
static const char __kstrtab_##sym[] \
|
||||
__attribute__((section("__ksymtab_strings"), used, aligned(1))) \
|
||||
= #sym; \
|
||||
static const char __kstrtabns_##sym[] \
|
||||
__attribute__((section("__ksymtab_strings"), used, aligned(1))) \
|
||||
= ns; \
|
||||
/*
|
||||
* For every exported symbol, do the following:
|
||||
*
|
||||
* - If applicable, place a CRC entry in the __kcrctab section.
|
||||
* - Put the name of the symbol and namespace (empty string "" for none) in
|
||||
* __ksymtab_strings.
|
||||
* - Place a struct kernel_symbol entry in the __ksymtab section.
|
||||
*
|
||||
* note on .section use: we specify progbits since usage of the "M" (SHF_MERGE)
|
||||
* section flag requires it. Use '%progbits' instead of '@progbits' since the
|
||||
* former apparently works on all arches according to the binutils source.
|
||||
*/
|
||||
#define ___EXPORT_SYMBOL(sym, sec, ns) \
|
||||
extern typeof(sym) sym; \
|
||||
extern const char __kstrtab_##sym[]; \
|
||||
extern const char __kstrtabns_##sym[]; \
|
||||
__CRC_SYMBOL(sym, sec); \
|
||||
asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
|
||||
"__kstrtab_" #sym ": \n" \
|
||||
" .asciz \"" #sym "\" \n" \
|
||||
"__kstrtabns_" #sym ": \n" \
|
||||
" .asciz \"" ns "\" \n" \
|
||||
" .previous \n"); \
|
||||
__KSYMTAB_ENTRY(sym, sec)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ struct module {
|
|||
|
||||
#ifdef CONFIG_KALLSYMS
|
||||
/* Protected by RCU and/or module_mutex: use rcu_dereference() */
|
||||
struct mod_kallsyms *kallsyms;
|
||||
struct mod_kallsyms __rcu *kallsyms;
|
||||
struct mod_kallsyms core_kallsyms;
|
||||
|
||||
/* Section attributes */
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ struct kparam_array
|
|||
|
||||
/**
|
||||
* module_param_unsafe - same as module_param but taints kernel
|
||||
* @name: the variable to alter, and exposed parameter name.
|
||||
* @type: the type of the parameter
|
||||
* @perm: visibility in sysfs.
|
||||
*/
|
||||
#define module_param_unsafe(name, type, perm) \
|
||||
module_param_named_unsafe(name, name, type, perm)
|
||||
|
|
@ -150,6 +153,10 @@ struct kparam_array
|
|||
|
||||
/**
|
||||
* module_param_named_unsafe - same as module_param_named but taints kernel
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @value: the actual lvalue to alter.
|
||||
* @type: the type of the parameter
|
||||
* @perm: visibility in sysfs.
|
||||
*/
|
||||
#define module_param_named_unsafe(name, value, type, perm) \
|
||||
param_check_##type(name, &(value)); \
|
||||
|
|
@ -160,6 +167,7 @@ struct kparam_array
|
|||
* module_param_cb - general callback for a module/cmdline parameter
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
|
|
@ -171,36 +179,96 @@ struct kparam_array
|
|||
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
|
||||
KERNEL_PARAM_FL_UNSAFE)
|
||||
|
||||
#define __level_param_cb(name, ops, arg, perm, level) \
|
||||
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
|
||||
/**
|
||||
* <level>_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before certain initcall level
|
||||
* core_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before core initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define __level_param_cb(name, ops, arg, perm, level) \
|
||||
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
|
||||
|
||||
#define core_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 1)
|
||||
|
||||
/**
|
||||
* postcore_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before postcore initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define postcore_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 2)
|
||||
|
||||
/**
|
||||
* arch_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before arch initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define arch_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 3)
|
||||
|
||||
/**
|
||||
* subsys_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before subsys initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define subsys_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 4)
|
||||
|
||||
/**
|
||||
* fs_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before fs initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define fs_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 5)
|
||||
|
||||
/**
|
||||
* device_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before device initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define device_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 6)
|
||||
|
||||
/**
|
||||
* late_param_cb - general callback for a module/cmdline parameter
|
||||
* to be evaluated before late initcall level
|
||||
* @name: a valid C identifier which is the parameter name.
|
||||
* @ops: the set & get operations for this parameter.
|
||||
* @arg: args for @ops
|
||||
* @perm: visibility in sysfs.
|
||||
*
|
||||
* The ops can have NULL set or get functions.
|
||||
*/
|
||||
#define late_param_cb(name, ops, arg, perm) \
|
||||
__level_param_cb(name, ops, arg, perm, 7)
|
||||
|
||||
|
|
@ -263,6 +331,10 @@ static inline void kernel_param_unlock(struct module *mod)
|
|||
|
||||
/**
|
||||
* core_param_unsafe - same as core_param but taints kernel
|
||||
* @name: the name of the cmdline and sysfs parameter (often the same as var)
|
||||
* @var: the variable
|
||||
* @type: the type of the parameter
|
||||
* @perm: visibility in sysfs
|
||||
*/
|
||||
#define core_param_unsafe(name, var, type, perm) \
|
||||
param_check_##type(name, &(var)); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue