From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: libc-alpha@sourceware.org
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>, commit-hurd@gnu.org
Subject: [hurd,commited] hurd: Fix unwinding over INTR_MSG_TRAP
Date: Thu, 9 Feb 2023 20:00:52 +0100 [thread overview]
Message-ID: <20230209190052.3624577-1-samuel.thibault@ens-lyon.org> (raw)
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
\f
# Make generated headers compatible with all support standards
migheaderpipe := | sed -e 's/\<ino64_t\>/__ino64_t/' -e 's/\<loff_t\>/__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) \
--
2.39.1
reply other threads:[~2023-02-09 19:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230209190052.3624577-1-samuel.thibault@ens-lyon.org \
--to=samuel.thibault@ens-lyon.org \
--cc=commit-hurd@gnu.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).