Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Schimpe, Christina" <christina.schimpe@intel.com>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH v2 0/9] Add new command to print the shadow stack backtrace
Date: Mon, 18 May 2026 10:08:18 +0000	[thread overview]
Message-ID: <PH0PR11MB763672F2BB1005D894F449E1F9032@PH0PR11MB7636.namprd11.prod.outlook.com> (raw)
In-Reply-To: <87mryb956r.fsf@linaro.org>

Hi Thiago,

please find my comments below.

> -----Original Message-----
> From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
> Sent: Donnerstag, 7. Mai 2026 07:09
> To: Schimpe, Christina <christina.schimpe@intel.com>
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH v2 0/9] Add new command to print the shadow stack
> backtrace
> 
> Hello again,
> 
> There's always something more after you hit "send"...
> 
> Thiago Jung Bauermann <thiago.bauermann@linaro.org> writes:
> 
> > I had a look at the review threads for v1 and v2 of this patch series,
> > and I think the discussion below cover the loose ends that were still
> > unaddressed.
> 
> Of course, thank you for having summarized the loose ends. It was very
> helpful.
> 
> > Please let me know if I am missing anything, or if there anything else
> > you want to bring up before posting v3.
> 
> It turns out that there was this matter from patch 7 in the v1 thread¹:
> 
> ----
> >> My only comment is that there a also the "set backtrace past-main"
> >> and "set backtrace past-entry" options, which "bt shadow" should also
> >> respect.  So if the former setting is on, the output above should stop at
> frame #3.
> >
> > Ah those settings, ... I tried to add past-main/past-entry but stopped
> > at some point, since it turned out to be complicated - but I don't remember
> the exact reasons.
> > Do you think I missed something and adding those settings should be
> straight-forward?
> 
> I don't actually know. I would try to do what inside_main_func and
> inside_entry_func in gdb/frame.c do, but if that is what you tried and it didn't
> work or was too complicated then I don't have any ideas...

My internal prototype for v3 implements -past-main but not -past-entry. The use cases
for this flag are pretty special, and I don't think -past-entry is applicable for the shadow
stack bt. At least for x86 I think the shadow stack is always enabled after entry...

> inside_entry_func in particular seems tricky, since it uses get_frame_func
> which at least from a first look does appear to be complicated.
> 
> > I then decided to first post the basic functionality of "bt shadow"
> > without support for past-main/past-entry. Do you think this is a problem ?
> 
> I don't think it's a problem.
> ----
> 
> And there was also this part from your latest reply in the patch 6 thread that I
> forgot to paste and reply to:
> 
> ----
> > In case the normal backtrace is broken due for instance a programming
> > error such as a buffer overflow the user can use "bt -shadow" as
> > alternative.  In that case, implementing frame arguments would
> > probably be helpful, too. But if we do this afterwards, we'll change
> > the default behavior of "bt -shadow". On the other hand, this series is
> already big enough...
> > And, if we go that direction, I wonder if we shouldn't somehow
> > construct frame #0 for the shadow stack. But as described above, I've also
> some concerns for that.
> >
> > What do you think?
> 
> I don't think changing the default behaviour of "bt -shadow" between
> printing and not printing arguments would be a problem, because the output
> is meant for human consumption.
> 
> With the MI output it could be a problem? I'm not very familiar with MI to
> have an informed opinion though.

It seems that also for the normal -stack-list-frames command we don't print frame
arguments, so I think we should be safe here.

> Regarding printing or not frame 0, in the case where the normal backtrace is
> broken due to stack corruption, can it happen that GDB doesn't print frame
> 0? I think it will because frame 0 is just the regcache, so doesn't depend on
> the regular stack. But I haven't checked how GDB actually behaves in this
> scenario.
> 
> But IMHO this is not a good reason to construct frame 0 in the shadow stack
> backtrace. :)
> ----

It probably depends how it's broken 😊
And I agree, we shouldn't construct frame 0.

Christina
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  reply	other threads:[~2026-05-18 10:14 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  8:05 Christina Schimpe
2026-01-23  8:05 ` [PATCH v2 1/9] gdb: Generalize handling of the shadow stack pointer Christina Schimpe
2026-02-19 17:55   ` Tom Tromey
2026-02-27 18:09     ` Schimpe, Christina
2026-02-27 18:26       ` Tom Tromey
2026-03-02 11:53         ` Schimpe, Christina
2026-04-09  9:49           ` Schimpe, Christina
2026-04-14 17:34             ` Tom Tromey
2026-04-15  7:35               ` Schimpe, Christina
2026-04-15 15:54                 ` Tom Tromey
2026-02-27 22:54       ` Thiago Jung Bauermann
2026-03-06  3:15   ` Thiago Jung Bauermann
2026-03-06  3:57     ` Thiago Jung Bauermann
2026-04-09 11:57       ` Schimpe, Christina
2026-04-10  5:03         ` Thiago Jung Bauermann
2026-04-10  7:53           ` Schimpe, Christina
2026-04-09 12:06   ` Schimpe, Christina
2026-04-10  5:05     ` Thiago Jung Bauermann
2026-01-23  8:05 ` [PATCH v2 2/9] gdb: Refactor 'stack.c:print_frame' Christina Schimpe
2026-01-23  8:05 ` [PATCH v2 3/9] gdb: Introduce 'stack.c:print_pc' function without frame argument Christina Schimpe
2026-01-23  8:05 ` [PATCH v2 4/9] gdb: Refactor 'find_symbol_funname' and 'info_frame_command_core' in stack.c Christina Schimpe
2026-02-19 17:32   ` Tom Tromey
2026-04-09 12:40     ` Schimpe, Christina
2026-01-23  8:05 ` [PATCH v2 5/9] gdb: Refactor 'stack.c:print_frame_info' Christina Schimpe
2026-01-23  8:05 ` [PATCH v2 6/9] gdb: Add command option 'bt -shadow' to print the shadow stack backtrace Christina Schimpe
2026-01-23  8:52   ` Eli Zaretskii
2026-02-13 16:42     ` Schimpe, Christina
2026-04-14  8:43       ` Schimpe, Christina
2026-04-14 11:53         ` Eli Zaretskii
2026-04-14 13:28           ` Schimpe, Christina
2026-04-14 14:12             ` Eli Zaretskii
2026-04-14 15:05               ` Schimpe, Christina
2026-02-19 18:19   ` Tom Tromey
2026-04-09 16:48     ` Schimpe, Christina
2026-03-06  4:31   ` Thiago Jung Bauermann
2026-03-06  9:39     ` Schimpe, Christina
2026-04-09 15:12     ` Schimpe, Christina
2026-04-10  6:21       ` Thiago Jung Bauermann
2026-04-10 12:12         ` Schimpe, Christina
2026-05-12  3:32   ` Thiago Jung Bauermann
2026-05-18 10:06     ` Schimpe, Christina
2026-01-23  8:05 ` [PATCH v2 7/9] gdb: Provide gdbarch hook to distinguish shadow stack backtrace elements Christina Schimpe
2026-01-23  8:47   ` Eli Zaretskii
2026-02-19 17:41   ` Tom Tromey
2026-05-12  3:49   ` Thiago Jung Bauermann
2026-05-18 10:11     ` Schimpe, Christina
2026-01-23  8:05 ` [PATCH v2 8/9] gdb: Implement the hook 'is_no_return_shadow_stack_address' for amd64 linux Christina Schimpe
2026-02-19 17:43   ` Tom Tromey
2026-05-12  3:58   ` Thiago Jung Bauermann
2026-05-18 10:13     ` Schimpe, Christina
2026-01-23  8:05 ` [PATCH v2 9/9] gdb, mi: Add -shadow-stack-list-frames command Christina Schimpe
2026-01-23  8:46   ` Eli Zaretskii
2026-02-13 19:17     ` Schimpe, Christina
2026-02-19 18:26   ` Tom Tromey
2026-04-22 19:25     ` Schimpe, Christina
2026-03-02 12:39 ` [PATCH v2 0/9] Add new command to print the shadow stack backtrace Schimpe, Christina
2026-05-07  4:14 ` Thiago Jung Bauermann
2026-05-07  5:09   ` Thiago Jung Bauermann
2026-05-18 10:08     ` Schimpe, Christina [this message]
2026-05-18 10:10   ` Schimpe, Christina
2026-05-21  2:57     ` Thiago Jung Bauermann
2026-05-18  8:39 ` Schimpe, Christina
2026-05-21  2:23   ` Thiago Jung Bauermann

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=PH0PR11MB763672F2BB1005D894F449E1F9032@PH0PR11MB7636.namprd11.prod.outlook.com \
    --to=christina.schimpe@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thiago.bauermann@linaro.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