public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Guinevere Larsen <blarsen@redhat.com>
To: "Schimpe, Christina" <christina.schimpe@intel.com>,
	"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: Shadow stack backtrace command name
Date: Wed, 20 Dec 2023 11:59:54 +0100	[thread overview]
Message-ID: <2bae9689-e638-262d-ad5f-6ae38c900ce0@redhat.com> (raw)
In-Reply-To: <SN7PR11MB7638DE1337F8F0F0282EBD56F996A@SN7PR11MB7638.namprd11.prod.outlook.com>

On 20/12/2023 10:42, Schimpe, Christina via Gdb wrote:
> Hi all,
>
> I am writing to you to collect feedback for the name of a new command, we would
> like to introduce.  The command shall be used to print the shadow stack backtrace.
>
> A shadow stack is a second stack for a program introduced in the Intel (R)
> Control-Flow Enforcement Technology (CET).  The shadow stack is used for
> control transfer operations to store the return addresses.
>
> This is an example command name and output for the shadow stack backtrace:
> ~~~~
> (gdb) info shadow-stack bt
>     Address            Symbol
> #0 0x0000000000401131 call1
> #1 0x0000000000401145 main
> #2 0x00007ffff7c3fe70 __libc_start_call_main
> #3 0x00007ffff7c3ff20 __libc_start_main_impl
> (gdb) set print symbol-filename on
> (gdb) info shadow-stack bt
>     Address            Symbol
> #0 0x0000000000401131 call1 at amd64-shstk.c:51
> #1 0x0000000000401145 main at amd64-shstk.c:56
> #2 0x00007ffff7c3fe70 __libc_start_call_main
> #3 0x00007ffff7c3ff20 __libc_start_main_impl
> (gdb) help info shadow-stack bt
> info shadow-stack backtrace, info shadow-stack bt
> Print the entire backtrace of shadow stack,
> or the innermost [COUNT | -COUNT] addresses for the current process.
> To print the source filename and line number in the backtrace,
> the "symbol-filename" option of the print command should be toggled on.
> (See "show print symbol-filename")
> ~~~

Hi!

My first thought about this output is that I don't think most users are 
interested in what goes on below the main function. I think it would be 
nice to suppress that output (I personally would like that to be the 
default, but as long as its an option I'm happy).

As for names, I don't see a need for starting with "info". In my 
opinion, just calling it "shadow-stack backtrace" is fine. Users could 
then set their own abbreviations, like shstk or cet if they like.

As for if the name should have 'backtrace', I think it would be good 
that if actual command has it, but then adding an abbreviation to just 
"shadow-stack" if backtrace is the only command associated with it, but 
I can see how that could be confusing for end users if we add a new 
command after one or more releases, so I'm not married to this idea.

Some more thoughts below

>
> It is configurable using "print symbol-filename" and COUNT.
> The command can be called by the following names:
> - "info shadow-stack bt", "info shadow-stack backtrace"
>
>  From my perspective, the command name has the following pros and cons:
> (+) Easy to understand by just looking at the command name.
> (-) Rather long syntax
>
> We also considered other command names such as
>
> - "info cet bt", "info cet backtrace"
> (+) Short syntax possible
> (-) Not so easy to understand by just looking at the command name. I miss the
> name "shadow stack".
I don't like this one very much, because searching CET online won't give 
you much info, so a user would need to look at the help text to then 
figure out keywords to search to learn more.
>
> - "info shstk bt", "info shstk backtrace"
> (+) Short syntax possible
> (-) "shstk" ist not an official abbreviation (in contrast to "cet"). "shstk" is
> mostly used by the linux kernel and might not be known by the user.
I like this better because it is much easier to find what is going on, 
but as you said, users may not be familiar, so I still lean towards 
spelling out shadow-stack and letting users make their own abbreviations.
>
> - "info shstk", "info shadow-stack"
> (+) short syntax possible
> (-) Without "backtrace" in the name, it might not be so easy to understand.
>
> Having in mind that that the shadow stack is not only a x86-specific feature
> but can be seen as a generic concept we also considered that it could be
> part of the existing backtrace command, e.g.:
> - "bt -shadow"
> (+) Short syntax
> (+/-) Most of the settings of the bt command don't apply to the shadow
> stack (frame arguments and info). This might cause confusion.
I started really disliking this option, but the more I think about it, 
the more it sounds like a neutral one to me.
sure, the output is much more basic, and many options/commands wont 
apply, but if the regular backtrace is failing due to some stack 
corruption or something, this feels like a more natural approach to 
solving that issue, which I imagine would be the most common use case 
for most users. That said, this is all speculations pulled from thin 
air, so feel free to ignore this last part.

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>
> For this option, it might make sense to introduce a new setting for the bt
> command which is for shadow stack only, e.g. "-symbol-filename [on|off]".
>
> What are your thoughts on this topic? Any feedback and new ideas are welcome.
>
> Best Regards,
> Christina
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
>


  reply	other threads:[~2023-12-20 10:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  9:42 Schimpe, Christina
2023-12-20 10:59 ` Guinevere Larsen [this message]
2023-12-20 15:11   ` Schimpe, Christina
2023-12-20 11:38 ` Luis Machado
2023-12-20 15:35   ` Schimpe, Christina
2023-12-20 15:57     ` Luis Machado
2023-12-21  4:35       ` Thiago Jung Bauermann
2023-12-21 22:26 ` Shadow stack command to host related subcommands (was Re: Shadow stack backtrace command name) Thiago Jung Bauermann
2024-01-09  8:34   ` Schimpe, Christina
2023-12-23 18:22 ` Shadow stack backtrace command name Tom Tromey
2023-12-28 22:34   ` Thiago Jung Bauermann
2024-01-09 10:21     ` Schimpe, Christina

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=2bae9689-e638-262d-ad5f-6ae38c900ce0@redhat.com \
    --to=blarsen@redhat.com \
    --cc=christina.schimpe@intel.com \
    --cc=gdb@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).