[PATCH] sparc64: Add nop before __start_context to stop unwinding [BZ #34978]

Stian Halseth stian@itx.no
Sat Nov 7 23:21:21 GMT 2026


makecontext sets the return address to __start_context - 8, so the
unwinder looks up the FDE for __start_context - 1, which belongs to the
preceding function.  With the current layout that makes
stdlib/tst-makecontext segfault in _Unwind_Backtrace.

Add a nop before __start_context so that no FDE covers that address,
as sparc32 does since BZ #22919.

Tested on sparc64.

Signed-off-by: Stian Halseth <stian@itx.no>
---
 sysdeps/unix/sysv/linux/sparc/sparc64/__start_context.S | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/__start_context.S b/sysdeps/unix/sysv/linux/sparc/sparc64/__start_context.S
index 177908d2ed..17dfce20c5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/__start_context.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/__start_context.S
@@ -19,6 +19,9 @@
 
 	.text
 
+/* Keep __start_context - 1 outside of any FDE to stop unwinding.  */
+	nop
+
 /* This is the helper code which gets called if a function which is
    registered with 'makecontext' returns.  In this case we have to
    install the context listed in the uc_link element of the context
-- 
2.43.0



More information about the Libc-alpha mailing list