]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sparc: Remove unwind information from signal return stubs [BZ #31244]
authorDaniel Cederman <cederman@gaisler.com>
Tue, 16 Jan 2024 08:31:41 +0000 (09:31 +0100)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 2 Feb 2024 12:49:30 +0000 (09:49 -0300)
The functions were previously written in C, but were not compiled
with unwind information. The ENTRY/END macros includes .cfi_startproc
and .cfi_endproc which adds unwind information. This caused the
tests cleanup-8 and cleanup-10 in the GCC testsuite to fail.
This patch adds a version of the ENTRY/END macros without the
CFI instructions that can be used instead.

sigaction registers a restorer address that is located two instructions
before the stub function. This patch adds a two instruction padding to
avoid that the unwinder accesses the unwind information from the function
that the linker has placed right before it in memory. This fixes an issue
with pthread_cancel that caused tst-mutex8-static (and other tests) to fail.

Signed-off-by: Daniel Cederman <cederman@gaisler.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 7bd06985c0a143cdcba2762bfe020e53514a53de)

sysdeps/sparc/sysdep.h
sysdeps/unix/sysv/linux/sparc/sparc32/sigreturn_stub.S

index 687e6261823e7dcef2bb30c302e2829a6bfdeeae..151baa5e10f72c0c68274154a3abf8cbaf8a9723 100644 (file)
@@ -76,6 +76,15 @@ C_LABEL(name)                                \
        cfi_endproc;                    \
        .size name, . - name
 
+#define ENTRY_NOCFI(name)                      \
+       .align  4;                      \
+       .global C_SYMBOL_NAME(name);    \
+       .type   name, @function;        \
+C_LABEL(name)
+
+#define END_NOCFI(name)                        \
+       .size name, . - name
+
 #undef LOC
 #define LOC(name)  .L##name
 
index cf509c8d5ced47cdf6a7f300802cc12a6d1efb46..1962f9053ca7b0fa055b5cd3a4bcae2e57ac9a4e 100644 (file)
 
    [1] https://lkml.org/lkml/2016/5/27/465  */
 
-ENTRY (__rt_sigreturn_stub)
+       nop
+       nop
+
+ENTRY_NOCFI (__rt_sigreturn_stub)
        mov     __NR_rt_sigreturn, %g1
        ta      0x10
-END (__rt_sigreturn_stub)
+END_NOCFI (__rt_sigreturn_stub)
 
-ENTRY (__sigreturn_stub)
+ENTRY_NOCFI (__sigreturn_stub)
        mov     __NR_sigreturn, %g1
        ta      0x10
-END (__sigreturn_stub)
+END_NOCFI (__sigreturn_stub)