From patchwork Tue Jan 16 08:31:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Cederman X-Patchwork-Id: 84164 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2CF97385843E for ; Tue, 16 Jan 2024 08:32:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp-out3.simply.com (smtp-out3.simply.com [94.231.106.210]) by sourceware.org (Postfix) with ESMTPS id EBA1B3858D38 for ; Tue, 16 Jan 2024 08:31:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EBA1B3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=gaisler.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gaisler.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EBA1B3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=94.231.106.210 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705393913; cv=none; b=nA48HVv4QsLp1eGuDpA7hsvY4f0ncLRUbPDCWM+UAvzZItSqJt+iTEkT6M2qxcRnep+Wc+O9czfJpXgPkBh59dD498883CqWgdsvOI+E9Hbg3Ct0WIu3h6Z8bE+N5TFraSkxSwlNFiBliP60DWBi7i/m771E6j3kW+8hBU/ttuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705393913; c=relaxed/simple; bh=xjb3CD7nlxRgUk2HCNhlT7eXhZLvF2bbhs4xURmElss=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=O5s6pT9NLQof0EYV3c9WVnxQYYrP/4cUdwRZit3CcaenmQWfoh1xVyU+0LG8zWz2ZpIZHVZlnDhTvcTfgwRLFtksVJWaO48EAyfhI8y5hlnuls+muqV3NDQWk2fTDQ7g0PNboA/Me0fPuOHiiFyM91nlvYqGOtFYObhi2p4l6pw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4TDj0g6RH6z67td; Tue, 16 Jan 2024 09:31:47 +0100 (CET) Received: from cederman.got.gaisler.com (h-98-128-223-123.NA.cust.bahnhof.se [98.128.223.123]) by smtp.simply.com (Simply.com) with ESMTPA id 4TDj0g4xhFz67vT; Tue, 16 Jan 2024 09:31:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaisler.com; s=unoeuro; t=1705393907; bh=lGxypdftmPqf5CxBm2q6jd4jzDY9Ppwrx5WFwZ+QhPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ik+29VuiVcldJZwhM3ilPF1A8t1GKgEjX19dheEfok9eMW8YqYToNfO57eDFwcjMH OhV2f2WyJf1b5OKptK9JAWL8sA1jZfzsy2bbU8KQTvsH4Xqm21O16mHrLDgSwhQFHt 8BOMXU+xDgn/1CjrNEYjl4VvCQTqVD7mjcK092Gk= From: Daniel Cederman To: libc-alpha@sourceware.org Cc: daniel@gaisler.com, andreas@gaisler.com Subject: [PATCH v2] sparc: Remove unwind information from signal return stubs [BZ #31244] Date: Tue, 16 Jan 2024 09:31:41 +0100 Message-Id: <20240116083141.3395401-2-cederman@gaisler.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240116083141.3395401-1-cederman@gaisler.com> References: <20240116083141.3395401-1-cederman@gaisler.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org 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 --- sysdeps/sparc/sysdep.h | 9 +++++++++ .../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 c00fe79fec..44a6952bff 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 832223f8ce..21d36c50df 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)