From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 2B712385802F; Fri, 2 Feb 2024 13:25:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B712385802F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706880357; bh=Ta6NEVEL1kiXx4Z/kTshczg5OzgtoNsHrZUTbHBbYI4=; h=From:To:Subject:Date:From; b=vrl4rjD1WxsGKUOsT1zp4wBhvkdMfq/m1xkBZIWZv27fiflt7GKe4QUJLjBghpVaR V+5Cuin1iOpou3i98kIL9QUk3oG4sC+zjoCIKRJt/zcAAGMyNEfxdBV0Hm0RQahy7m ocu1Mr+4iGF6eCyMmsacS7u5G5vFIojRf8flPPL4= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/release/2.36/master] sparc: Remove unwind information from signal return stubs [BZ #31244] X-Act-Checkin: glibc X-Git-Author: Daniel Cederman X-Git-Refname: refs/heads/release/2.36/master X-Git-Oldrev: f4171ba5e5a772217ed0ebb80701fe1698407252 X-Git-Newrev: 2853e541c58af1f5d868c4161ea9562e7876a989 Message-Id: <20240202132557.2B712385802F@sourceware.org> Date: Fri, 2 Feb 2024 13:25:57 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2853e541c58af1f5d868c4161ea9562e7876a989 commit 2853e541c58af1f5d868c4161ea9562e7876a989 Author: Daniel Cederman Date: Tue Jan 16 09:31:41 2024 +0100 sparc: Remove unwind information from signal return stubs [BZ #31244] 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 Reviewed-by: Adhemerval Zanella (cherry picked from commit 7bd06985c0a143cdcba2762bfe020e53514a53de) Diff: --- sysdeps/sparc/sysdep.h | 9 +++++++++ sysdeps/unix/sysv/linux/sparc/sparc32/sigreturn_stub.S | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sysdeps/sparc/sysdep.h b/sysdeps/sparc/sysdep.h index 95068071cc..baab6817a6 100644 --- a/sysdeps/sparc/sysdep.h +++ b/sysdeps/sparc/sysdep.h @@ -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 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigreturn_stub.S b/sysdeps/unix/sysv/linux/sparc/sparc32/sigreturn_stub.S index 2829e881eb..a1492ea59e 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigreturn_stub.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigreturn_stub.S @@ -23,12 +23,15 @@ [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)