Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: module: recognize unwind exit sections

In addition to the prefix ".exit", ".ARM.extab.exit" and ".ARM.exidx.exit"
must be recognized as exit sections as well. Otherwise, loading modules can
fail without CONFIG_MODULE_UNLOAD depending on the memory layout, when
relocations for the unwind sections refer to the .exit.text section:

imx_sdma: section 16 reloc 0 sym '': relocation 42 out of range
(0x7f015260 -> 0xc0f5a5e8)

where 0x7F000000 is the module load area and 0xC0000000 is the vmalloc
area. Relocation 42 refers to R_ARM_PREL31, which is limited to signed
31bit offsets.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>

authored by

Matthias Schiffer and committed by
Jessica Yu
70bac08d 38b37d63

+7
+7
arch/arm/kernel/module.c
··· 58 58 } 59 59 #endif 60 60 61 + bool module_exit_section(const char *name) 62 + { 63 + return strstarts(name, ".exit") || 64 + strstarts(name, ".ARM.extab.exit") || 65 + strstarts(name, ".ARM.exidx.exit"); 66 + } 67 + 61 68 int 62 69 apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, 63 70 unsigned int relindex, struct module *module)