From patchwork Thu Feb 9 19:00:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 64546 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 C10A6385B510 for ; Thu, 9 Feb 2023 19:01:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id E46F33858032 for ; Thu, 9 Feb 2023 19:00:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E46F33858032 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id AF9502014E; Thu, 9 Feb 2023 20:00:53 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r7LuF1yoUxz1; Thu, 9 Feb 2023 20:00:53 +0100 (CET) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id F09DD2014D; Thu, 9 Feb 2023 20:00:52 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pQCA8-00FCv6-27; Thu, 09 Feb 2023 20:00:52 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: Fix unwinding over INTR_MSG_TRAP Date: Thu, 9 Feb 2023 20:00:52 +0100 Message-Id: <20230209190052.3624577-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP 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.29 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 Sender: "Libc-alpha" We used to use .cfi_adjust_cfa_offset around %esp manipulation asm instructions to fix unwinding, but when building glibc with -fno-omit-frame-pointer this is bogus since in that case %ebp is the CFA and does not move. Instead, let's force -fno-omit-frame-pointer when building intr-msg.c so that %ebp can always be used and no .cfi_adjust_cfa_offset is needed. --- hurd/Makefile | 3 +++ sysdeps/mach/hurd/i386/intr-msg.h | 13 ------------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/hurd/Makefile b/hurd/Makefile index 77cb16cdf7..7c34e9ad0d 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -89,6 +89,9 @@ generated += $(inlines:=.c) # Avoid ssp before TLS is initialized. CFLAGS-hurdstartup.o = $(no-stack-protector) CFLAGS-RPC_exec_startup_get_info.o = $(no-stack-protector) + +# Make it simpler to unwind over INTR_MSG_TRAP +CFLAGS-intr-msg.o = -fno-omit-frame-pointer # Make generated headers compatible with all support standards migheaderpipe := | sed -e 's/\/__ino64_t/' -e 's/\/__loff_t/' diff --git a/sysdeps/mach/hurd/i386/intr-msg.h b/sysdeps/mach/hurd/i386/intr-msg.h index 58f2f37c17..29cb4620da 100644 --- a/sysdeps/mach/hurd/i386/intr-msg.h +++ b/sysdeps/mach/hurd/i386/intr-msg.h @@ -41,21 +41,13 @@ "_hurd_intr_rpc_msg_do:" \ /* Ok, push the mach_msg_trap arguments. */ \ " pushl 24(%4)\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl %2\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl 16(%4)\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl 12(%4)\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl 8(%4)\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl %1\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl (%4)\n" \ - " .cfi_adjust_cfa_offset 4\n" \ " pushl $0\n" \ - " .cfi_adjust_cfa_offset 4\n" \ /* TODO: remove this ecx kludge, we don't need it any more */ \ " movl %%esp, %%ecx\n" \ "_hurd_intr_rpc_msg_cx_sp: movl $-25, %%eax\n" \ @@ -63,15 +55,10 @@ "_hurd_intr_rpc_msg_in_trap:" \ /* Ok, clean the arguments and update OPTION and TIMEOUT. */ \ " addl $8, %%esp\n" \ - " .cfi_adjust_cfa_offset -8\n" \ " popl %1\n" \ - " .cfi_adjust_cfa_offset -4\n" \ " addl $12, %%esp\n" \ - " .cfi_adjust_cfa_offset -12\n" \ " popl %2\n" \ - " .cfi_adjust_cfa_offset -4\n" \ " addl $4, %%esp\n" \ - " .cfi_adjust_cfa_offset -4\n" \ "_hurd_intr_rpc_msg_sp_restored:" \ : "=a" (err), "+r" (option), "+r" (timeout), "=m" (*intr_port_p) \ : "r" (&msg), "m" (*cancel_p), "i" (EINTR) \