Linux Modules
 help / color / mirror / Atom feed
* [PATCH] ARM: unwind: modules: Fix the mismatch between .ARM.exidx* and .text
@ 2026-08-06  4:10 Xie Yuanbin
  2026-08-06  4:22 ` sashiko-bot
  2026-08-06  9:40 ` Petr Pavlu
  0 siblings, 2 replies; 4+ messages in thread
From: Xie Yuanbin @ 2026-08-06  4:10 UTC (permalink / raw)
  To: linux, linusw, jpoimboe, rostedt, mcgrof, petr.pavlu, da.gomez,
	samitolvanen, atomlin
  Cc: linux-arm-kernel, linux-kernel, linux-modules, lilinjie8,
	liaohua4, Xie Yuanbin, Xiao Junzhe

For the new version of the compilers, C code that does not explicitly
declare the section attribute may be split into sections other than
".text", such as ".text.unlikely" and ".text.hot". If unwind is enabled,
this will also split the ".ARM.exidx.text.*" sections.

As scripts/module.lds.S, ".text.[0-9a-zA-Z_]*" sections will be merged
into ".text" section. However, ".ARM.exidx.text.*" sections will not be
merged.

For the following module code, using the gcc-16 compiler and the
latest linux-next code, will result in dump_stack() failure.
```c
void noinline stack_func_issue(void)
{
	dump_stack();
	pr_emerg("dump stack finish!\n");
}
EXPORT_SYMBOL(stack_func_issue);

static int __init mmodule_init(void)
{
	stack_func_issue();
	return 0;
}

module_init(mmodule_init);
```
```log
root@(none):/# busybox/usr/bin/busybox insmod test2.ko
[   10.846774] test: loading out-of-tree module taints kernel.
[   10.851840] CPU: 0 UID: 0 PID: 93 Comm: busybox Tainted: G        W  O        7.2.0-rc6-next-20260805-00002-g3d7269e6e98c #3 VOLUNTARY
[   10.852350] Tainted: [W]=WARN, [O]=OOT_MODULE
[   10.852405] Hardware name: Generic DT based system
[   10.852516] Call trace:
[   10.852939]  unwind_backtrace from show_stack+0x10/0x14
[   10.853487]  show_stack from dump_stack_lvl+0x54/0x68
[   10.853512]  dump_stack_lvl from stack_func_issue+0x8/0xc0 [test]
[   10.854134] unwind: Index not found bf000008
[   10.858157] dump stack finish!
```

Merge ".ARM.extab.text.[0-9a-z-A-Z_]*" sections into ".ARM.extab" section
and merge ".ARM.exidx.text.[0-9a-z-A-Z_]*" sections into ".ARM.exidx"
section to fix the issue.

Signed-off-by: Xiao Junzhe <xiaojunzhe1@h-partners.com>
Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
---
 scripts/module.lds.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/module.lds.S b/scripts/module.lds.S
index d0f200428957..0ccf0c205d00 100644
--- a/scripts/module.lds.S
+++ b/scripts/module.lds.S
@@ -39,6 +39,10 @@ SECTIONS {
 	.text			0 : {
 		*(.text .text.[0-9a-zA-Z_]*)
 	}
+#if defined(CONFIG_ARM) && defined(CONFIG_ARM_UNWIND)
+	.ARM.extab : {*(.ARM.extab .ARM.extab.text.[0-9a-z-A-Z_]*) }
+	.ARM.exidx : {*(.ARM.exidx .ARM.exidx.text.[0-9a-z-A-Z_]*) }
+#endif
 #endif
 
 	.bss			0 : {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-06  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06  4:10 [PATCH] ARM: unwind: modules: Fix the mismatch between .ARM.exidx* and .text Xie Yuanbin
2026-08-06  4:22 ` sashiko-bot
2026-08-06  9:40 ` Petr Pavlu
2026-08-06  9:58   ` Xie Yuanbin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox