Update num_symtab, symtab and strtab right after setup of core_num_syms, core_symtab and core_strtab.
PATCH RESEND 1/1 Update num_symtab, symtab and strtab right after setup of core_num_syms, core_symtab and core_strtab.
symtab/strtab refer to memory that will be vfreed when load_module() is done. So update them early.
Signed-off-by Hu Tao <[email protected]>
--- kernel/module.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
kernel/module.c +4 -5
@@ -2029,6 +2029,10 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)for (*s =0 , i =1 ; i < info->sechdrs[info->index.str].sh_size; ++i)if (test_bit (i, info->strmap)) *++s = mod->strtab[i]; + + mod->num_symtab = mod->core_num_syms; + mod->symtab = mod->core_symtab; + mod->strtab = mod->core_strtab; }#else static inline void layout_symtab (struct module *mod,struct load_info *info)
@@ -2738,11 +2742,6 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,/* Drop initial reference. */ module_put (mod);trim_init_extable (mod); -#ifdef CONFIG_KALLSYMS - mod->num_symtab = mod->core_num_syms; - mod->symtab = mod->core_symtab; - mod->strtab = mod->core_strtab; -#endif module_free (mod, mod->module_init); mod->module_init =NULL ; mod->init_size =0 ;
Signature · 1 line
1.7.3
Negative. Sorry for noise.
Quoted 43 lines · Hu Tao
symtab/strtab refer to memory that will be vfreed when
load_module()is done. So update them early.Signed-off-by Hu Tao <[email protected]>--- kernel/module.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)kernel/module.c +4
-5@@ -2029,6 +2029,10 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)for (*s =0 , i =1 ; i < info->sechdrs[info->index.str].sh_size; ++i)if (test_bit (i, info->strmap)) *++s = mod->strtab[i]; + + mod->num_symtab = mod->core_num_syms; + mod->symtab = mod->core_symtab; + mod->strtab = mod->core_strtab; }#else static inline void layout_symtab (struct module *mod,struct load_info *info)@@ -2738,11 +2742,6 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,/* Drop initial reference. */ module_put (mod);trim_init_extable (mod); -#ifdef CONFIG_KALLSYMS - mod->num_symtab = mod->core_num_syms; - mod->symtab = mod->core_symtab; - mod->strtab = mod->core_strtab; -#endif module_free (mod, mod->module_init); mod->module_init =NULL ; mod->init_size =0 ;Signature · 7 lines
1.7.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Hu Tao
symtab/strtab refer to memory that will be vfreed when
load_module()is done. So update them early.
I don't think so. See layout_symtab which moves these into the init section of the module.
Your change would make us unable to see init section symbols; if you crash during module init, you really want to see these symbols.
Hope that helps,
Rusty.