Skip to content

Commit cdcb07e

Browse files
vwaxRussell King
authored andcommitted
ARM: 8975/1: module: fix handling of unwind init sections
Unwind information for init sections is placed in .ARM.exidx.init.text and .ARM.extab.init.text. The module core doesn't know that these are init sections so they are allocated along with the core sections, and if the core and init sections get allocated in different memory regions (which is possible with CONFIG_ARM_MODULE_PLTS=y) and they can't reach each other, relocation fails: final section addresses: ... 0x7f800000 .init.text .. 0xcbb54078 .ARM.exidx.init.text .. section 16 reloc 0 sym '': relocation 42 out of range (0xcbb54078 -> 0x7f800000) Fix this by informing the module core that these sections are init sections, and by removing the init unwind tables before the module core frees the init sections. Signed-off-by: Vincent Whitchurch <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 0697e5e commit cdcb07e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

arch/arm/kernel/module.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ void *module_alloc(unsigned long size)
5555
}
5656
#endif
5757

58+
bool module_init_section(const char *name)
59+
{
60+
return strstarts(name, ".init") ||
61+
strstarts(name, ".ARM.extab.init") ||
62+
strstarts(name, ".ARM.exidx.init");
63+
}
64+
5865
bool module_exit_section(const char *name)
5966
{
6067
return strstarts(name, ".exit") ||
@@ -409,8 +416,17 @@ module_arch_cleanup(struct module *mod)
409416
#ifdef CONFIG_ARM_UNWIND
410417
int i;
411418

412-
for (i = 0; i < ARM_SEC_MAX; i++)
413-
if (mod->arch.unwind[i])
414-
unwind_table_del(mod->arch.unwind[i]);
419+
for (i = 0; i < ARM_SEC_MAX; i++) {
420+
unwind_table_del(mod->arch.unwind[i]);
421+
mod->arch.unwind[i] = NULL;
422+
}
423+
#endif
424+
}
425+
426+
void __weak module_arch_freeing_init(struct module *mod)
427+
{
428+
#ifdef CONFIG_ARM_UNWIND
429+
unwind_table_del(mod->arch.unwind[ARM_SEC_INIT]);
430+
mod->arch.unwind[ARM_SEC_INIT] = NULL;
415431
#endif
416432
}

0 commit comments

Comments
 (0)