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

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Nov 9 12:25:52 GMT 2026



On 07/11/26 20:21, Stian Halseth wrote:
> 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>

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  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



More information about the Libc-alpha mailing list