diff options
author | Matthias Schiffer <matthias.schiffer@ew.tq-group.com> | 2019-06-07 12:49:11 +0200 |
---|---|---|
committer | Jessica Yu <jeyu@kernel.org> | 2019-06-24 14:00:32 +0200 |
commit | 38b37d631aec80da0c65ac03a7ef680b468c7857 (patch) | |
tree | 3cfcaba903c0c0f2ff933cc6859f6fac16ebb110 /kernel/module.c | |
parent | modules: fix BUG when load module with rodata=n (diff) | |
download | linux-38b37d631aec80da0c65ac03a7ef680b468c7857.tar.xz linux-38b37d631aec80da0c65ac03a7ef680b468c7857.zip |
module: allow arch overrides for .exit section names
Some archs like ARM store unwind information for .exit.text in sections
with unusual names. As this unwind information refers to .exit.text, it
must not be loaded when .exit.text is not loaded (when CONFIG_MODULE_UNLOAD
is unset); otherwise, loading a module can fail due to relocation failures.
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c index 41258bab24f1..537c456ce3ee 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2748,6 +2748,11 @@ void * __weak module_alloc(unsigned long size) return vmalloc_exec(size); } +bool __weak module_exit_section(const char *name) +{ + return strstarts(name, ".exit"); +} + #ifdef CONFIG_DEBUG_KMEMLEAK static void kmemleak_load_module(const struct module *mod, const struct load_info *info) @@ -2937,7 +2942,7 @@ static int rewrite_section_headers(struct load_info *info, int flags) #ifndef CONFIG_MODULE_UNLOAD /* Don't load .exit sections */ - if (strstarts(info->secstrings+shdr->sh_name, ".exit")) + if (module_exit_section(info->secstrings+shdr->sh_name)) shdr->sh_flags &= ~(unsigned long)SHF_ALLOC; #endif } |