From: Isaac Chen Date: Wed, 15 May 2019 01:09:18 +0000 (-0700) Subject: kexec: generate VMCOREINFO for module symbols X-Git-Tag: v4.1.12-124.31.3~77 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=de6fd180b06766e92fb0388c82b7fab4fe1ec370;p=users%2Fjedix%2Flinux-maple.git kexec: generate VMCOREINFO for module symbols This commit is one of the three commit for generating VMCOREINFO symbol information. See comments in previous two commits. To dump kallsyms, module symbols must also be included. The symbol table of each module can be located through the module list. This commit generates necessary symbol information for accessing the symbol tables of loaded modules. Orabug: 29770217 Signed-off-by: Isaac Chen Reviewed-by: Joe Jin Signed-off-by: Brian Maly --- diff --git a/include/linux/module.h b/include/linux/module.h index f7ec0de97f90..b94238054220 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -37,6 +37,9 @@ struct modversion_info { }; struct module; +#ifdef CONFIG_KEXEC +extern struct list_head *vmcore_modules; +#endif /* CONFIG_KEXEC */ struct module_kobject { struct kobject kobj; diff --git a/kernel/module.c b/kernel/module.c index e06c4e4a5d76..0f8f459fdd8d 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -113,6 +113,10 @@ struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ struct list_head *dtrace_modules = &modules; #endif /* CONFIG_DTRACE */ +#ifdef CONFIG_KEXEC +struct list_head *vmcore_modules = &modules; +#endif /* CONFIG_KEXEC */ + #ifdef CONFIG_MODULE_SIG #ifdef CONFIG_MODULE_SIG_FORCE static bool sig_enforce = true; diff --git a/kernel/trace/trace_vmcore_extern.c b/kernel/trace/trace_vmcore_extern.c index 802b9b787e0c..0e6e9b242982 100644 --- a/kernel/trace/trace_vmcore_extern.c +++ b/kernel/trace/trace_vmcore_extern.c @@ -5,7 +5,9 @@ */ #include #include +#include #include +#include #include #include #include @@ -119,5 +121,22 @@ void trace_extern_kexec_setup(void) VMCOREINFO_STRUCT_SIZE(k_sigaction); VMCOREINFO_OFFSET(siginfo, si_signo); VMCOREINFO_SIZE(cputime_t); + + /* + * The following symbol and offsets are for reading symbols + * defined in dynamically loaded modules. To dump kallsyms, + * modules need to be processed as well. + */ + VMCOREINFO_SYMBOL(vmcore_modules); + VMCOREINFO_OFFSET(module, state); + VMCOREINFO_OFFSET(module, list); + VMCOREINFO_OFFSET(module, name); + VMCOREINFO_OFFSET(module, num_syms); + VMCOREINFO_OFFSET(module, symtab); + VMCOREINFO_OFFSET(module, num_symtab); + VMCOREINFO_OFFSET(module, strtab); + VMCOREINFO_OFFSET(elf64_sym, st_name); + VMCOREINFO_OFFSET(elf64_sym, st_info); + VMCOREINFO_OFFSET(elf64_sym, st_value); } #endif