From: Andrew Cagney <cagney@gnu.org>
To: Andrew Cagney <cagney@gnu.org>,
Mark Kettenis <kettenis@chello.nl>,
drow@false.org
Cc: gdb-patches@sources.redhat.com, roland@redhat.com
Subject: Re: Revamp sniffer; Was: [obish?sym;rfa:doc] Wire up vsyscall
Date: Tue, 15 Jun 2004 20:17:00 -0000 [thread overview]
Message-ID: <40CF5935.70007@gnu.org> (raw)
In-Reply-To: <40C9ECBA.1060108@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1750 bytes --]
Ok,
I just figured out why amd64 GNU/Linux signal trampolines don't work
correctly and the reason is scary!
After signal delivery (e.x., sigaltstack testcase) the stack looks like:
sentinel: SENTINEL_FRAME
catcher: NORMAL_FRAME, dwarf2 unwinder
<sigtramp>: SIGTRAMP_FRAME, sigtramp unwinder
thrower: NORMAL_FRAME, dwarf2 unwinder
while later after catcher has "finish"ed it looks like:
sentinel: SENTINEL_FRAME
__restore_rt: NORMAL_FRAME, dwarf2 unwinder
<corrupt stack>
Notice how the first time round the trampoline was correctly identified
but not the second. What happened?
In the first case:
- linux jumps to catcher setting it's return address to <sigtramp>'s
entry point
- gdb correctly identifies catcher as a callee or normal frame
- gdb goes to unwind catcher and starts sniffing <sigtramp>
- the dwarf2 sniffer, when sniffing <sigtramp>, asks for that frame's
address-in-block, since the catcher is a normal frame, that translates
to <catcher's-return-address>-1
- <catcher's-return-address>-1 translates into <sigtramp>-1
- since <sigtramp>-1 doesn't have any CFI (lucky eh?) dwarf2 dismisses
the frame
- the sigtramp unwinder gets to take a wiff and identifies the frame
while in the second case (no catcher):
- the dwarf2 sniffer, when sniffing <sigtramp>, asks for that frame's
address-in-block, since the next frame is a sentinel that translates
into <catcher's-return-address>
- <catcher's-return-address> translates into <sigtramp>
- <sigtramp> does have CFI so dwarf2 claims the frame marking it
"normal", outch!
So for the moment, I think the sigtramp frame should always be sniffed
before the dwarf2 frame. We can revisit the possability of modifing
dwarf2 later, much later.
Andrew
[-- Attachment #2: Attached Message --]
[-- Type: message/rfc822, Size: 13206 bytes --]
[-- Attachment #2.1.1: Type: text/plain, Size: 5 bytes --]
ping
[-- Attachment #2.1.2: Attached Message --]
[-- Type: message/rfc822, Size: 9162 bytes --]
[-- Attachment #2.1.2.1.1: Type: text/plain, Size: 175 bytes --]
Mark,
Want do you want to do here? Commit daniel's patch for the short term
while I clean this up proper over the medium term (appending it to the
vsyscall list)?
Andrew
[-- Attachment #2.1.2.1.2: Attached Message --]
[-- Type: message/rfc822, Size: 4991 bytes --]
From: Andrew Cagney <cagney@gnu.org>
To: Mark Kettenis <kettenis@chello.nl>
Cc: drow@false.org, gdb-patches@sources.redhat.com, roland@redhat.com
Subject: Revamp sniffer; Was: [obish?sym;rfa:doc] Wire up vsyscall
Date: Mon, 17 May 2004 13:14:48 -0400
Message-ID: <40A8F308.9040900@gnu.org>
> 2004-01-25 Daniel Jacobowitz <drow@mvista.com>
>
> * i386-tdep.c (i386_gdbarch_init): Check for signal frame first.
> * i386-linux-tdep.c (i386_linux_pc_in_sigtramp): Handle
> __kernel_sigreturn.
>
[...]
> I'm somewhat reluctant to throw the CFI completely overboard.
Yes.
> How
> about extending the DWARF2 unwinder such that we can set the
> [SIGTRAMP_FRAME] attribute based on the function's name?
The frame attributes (tramp et.al.) in many cases are orthogonal to the
unwind mechanism, but sometimes they are not).
At present the frame sniffer is focused solely on identifying and
returning an unwinder. The frame's type being identified as an
unexpected sid effect. I think this should be inverted vis:
frame_sniffer () ->
- attributes
- unwinder (or NULL, indicating sniff for unwinder)
- base (or NULL, indicating sniff for base)
- ...
so while the type is determined up front, other things are optional.
That way here the tramp code would look like:
if (name == _kernel_sigreturn)
if (cfi at address)
return { attribute=TRAMP; unwinder=cfi_unwinder; base=NULL };
else
return { attribute=TRAMP; unwinder=alt_unwinder; base=NULL };
this also opens the way for us doing:
if (name == solib-trampoline)
return { attribute=TRAMP|CALLEE; unwinder=NULL; base=NULL }
i.e., it's a trampoline (need to skip it) but let something more generic
identify the unwinder.
Andrew
next prev parent reply other threads:[~2004-06-15 20:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-07 1:19 Andrew Cagney
2004-05-07 0:48 ` Roland McGrath
2004-05-07 1:31 ` Daniel Jacobowitz
2004-05-10 21:39 ` Andrew Cagney
2004-05-07 1:19 ` Andrew Cagney
2004-05-07 1:25 ` Daniel Jacobowitz
2004-05-10 21:27 ` Andrew Cagney
2004-05-11 5:15 ` Mark Kettenis
2004-05-11 14:49 ` Andrew Cagney
2004-05-11 14:53 ` Daniel Jacobowitz
[not found] ` <40A0FFB1.8030407@gnu.org>
2004-05-11 17:26 ` Daniel Jacobowitz
2004-05-12 0:28 ` Andrew Cagney
2004-05-15 20:58 ` Mark Kettenis
2004-05-17 17:14 ` Revamp sniffer; Was: " Andrew Cagney
2004-05-25 22:55 ` Andrew Cagney
2004-06-11 17:32 ` Andrew Cagney
2004-06-15 20:17 ` Andrew Cagney [this message]
2004-06-16 23:07 ` Roland McGrath
2004-06-24 18:10 ` Andrew Cagney
2004-06-24 20:59 ` Roland McGrath
2004-06-24 21:20 ` Mark Kettenis
2004-05-17 20:10 ` Andrew Cagney
[not found] ` <20040517131914.332fa347@saguaro>
2004-05-18 5:59 ` Eli Zaretskii
2004-05-18 20:09 ` Andrew Cagney
2004-05-19 5:50 ` Eli Zaretskii
2004-05-19 14:47 ` Andrew Cagney
2004-05-19 21:10 ` Eli Zaretskii
2004-05-20 5:33 ` Eli Zaretskii
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=40CF5935.70007@gnu.org \
--to=cagney@gnu.org \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@chello.nl \
--cc=roland@redhat.com \
/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