Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	 "Joos, Christina" <christina.joos@intel.com>
Subject: Re: [PATCH v2 7/8] Windows gdb: Implement XState (Intel AVX) support
Date: Wed, 26 Aug 2026 15:20:17 +0000 (UTC)	[thread overview]
Message-ID: <1041475645.327467.1787757617271@mail.yahoo.com> (raw)
In-Reply-To: <SN7PR11MB7638D75A111388607FC684BD89AE2@SN7PR11MB7638.namprd11.prod.outlook.com>

 Am Mittwoch, 26. August 2026 um 16:28:41 MESZ hat Joos, Christina <christina.joos@intel.com> Folgendes geschrieben:

> Hi Hannes,
> 
> Thanks a lot for working on this.
> 
> I did not find the time to try this out on windows myself, since I was not able to work last week.
> This is my code-based review for now.
> 
> > -----Original Message-----
> > From: Hannes Domani <ssbssa@yahoo.de>
> > Sent: Montag, 27. Juli 2026 19:43
> > To: gdb-patches@sourceware.org
> > Subject: [PATCH v2 7/8] Windows gdb: Implement XState (Intel AVX) support
> 
> The commit message header still seems somewhat misleading, as it references only
> Intel AVX, while the commit also includes changes related to AVX-512 and shadow stack.
> 
> I think it would be helpful if we'd adapt the commit message header of this patch to
> include AVX-512, too.
> 
> For shadow stack I think it would make sense to move this to a separate commit and give
> more details on the tests that are passing/ not passing and the limitations we have in
> windows for shadow stack enabled programs.

I agree, at least shadow stack should be its own commit.

And I wonder if, instead of splitting up into gdb/gdbserver as it is now,
maybe I should merge them, and split them again into AVX/AVX-512/shadow-stack.


> Besides reading or writing the shadow stack pointer for linux we had to enable
> - displaced stepping
> - the return command
> - inferior calls
> for shadow stack enabled programs, which are all covered by current shadow stack tests.
> 
> Based on what you said
> 
> ~~~
> It turns out binutils/gcc really don't support this on windows yet.
> To enable this in the executable, at least a special marker bit has to be set in the Extended DLL Characteristics [1].
> With msvc you can do that with the /CETCOMPAT linker argument [2].
> 
> So I compiled amd64-shadow-stack.c with msvc and /CETCOMPAT, and tried it out with my gdb build.
> Before I always got $pl3_ssp=0, and with this new exe I always get $pl3_ssp=1.
> ~~~
> I assume you cannot execute those tests. Can you confirm?
> 
> Would it make sense to add dedicated tests for windows shadow stack  (in the
> shadow-stack specific patch), based on the current enablement you describe above ?
> 
> Or, maybe even better, can you adapt the proc allow_ssp_tests for window support?
> You said:
> " It turns out binutils/gcc really don't support this on windows yet."
> Could you add a fix to make this work for windows using msvc and /CETCOMPAT ?

I'm not sure what you mean here.
Instead of the binutils linker, use the one from msvc?


> In any case, all this information should be part of the commit message.
> 
> I also wonder if we should provide some feedback to the user when he attempts to
> write the shadow stack pointer.
> 
> Currently we see this, right?
> 
> ~~~
> (gdb) p $pl3_ssp=0x12345678
> $11 = (void *) 0x12345678
> (gdb) ni
> error return C:/gdb/src/gdb.git/gdb/x86-windows-nat.c:242 was 1660: The thread context could not be updated because this has been restricted for the process.
> 0x00007ffd63720574 in ntdll!ZwMapViewOfSection () from C:\WINDOWS\SYSTEM32\ntdll.dll
> ~~~
> 
> I am not GDB windows expert, so I am not sure if that is useful information for the user.
> Whatever we display when attempting to write the register, I think it would make sense
> to document this somehow. At least in the commits message + even better we could add
> a test for this.

To be honest, the shadow stack stuff is not that important to me.
And since binutils/gcc currently can't create executables with this
enabled, maybe it's not worth it including it at this time.
I only added it because windows suddenly provided this register info,
probably after some update.


> > This adds support for the Intel AVX and AVX-512 registers on Windows.
> > It enables accessing registers $ymm0 - $ymm31, $zmm0 - $zmm31, and
> > $k0 - $k7 where they are available.
> >
> > It also enables reading the shadow stack pointer register $pl3_ssp (for
> > executables marked compatible with CET shadow stack [1]), but modifying it
> > seems to be restricted restricted by windows.
> 
> Nit: duplicate restricted
> 
> >
> > After this patch the tests gdb.arch/i386-avx.exp and gdb.arch/i386-avx512.exp
> > pass on windows.
> 
> Nit: let's add for on windows for Unix boardfile, or something like that.
> So it's clear that gdbserver support is missing.

What gdbserver support is missing?


> Did you run the tests for 32 bit, too ?

Yes, the same tests succeed for 32 bit as well (with both 32 and 64 bit gdb).


Hannes

  reply	other threads:[~2026-08-26 15:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260727174619.1089041-1-ssbssa.ref@yahoo.de>
2026-07-27 17:42 ` [PATCH v2 1/8] gdb/testsuite: Add Windows replacement for aligned_alloc Hannes Domani
2026-07-27 17:42   ` [PATCH v2 2/8] Windows gdb: Use allocated buffer for CONTEXT Hannes Domani
2026-08-21 18:03     ` Tom Tromey
2026-08-21 18:37       ` Hannes Domani
2026-08-22  1:14         ` Tom Tromey
2026-07-27 17:42   ` [PATCH v2 3/8] Windows gdb: Remove mappings member from windows_per_inferior Hannes Domani
2026-08-21 18:06     ` Tom Tromey
2026-07-27 17:42   ` [PATCH v2 4/8] Windows gdb: Refactor getting pointer to register inside context Hannes Domani
2026-08-21 18:27     ` Tom Tromey
2026-07-27 17:42   ` [PATCH v2 5/8] Windows gdb: Prepare XState functions Hannes Domani
2026-08-21 18:22     ` Tom Tromey
2026-07-27 17:42   ` [PATCH v2 6/8] Windows gdb: Get available XState features Hannes Domani
2026-08-21 18:37     ` Tom Tromey
2026-07-27 17:42   ` [PATCH v2 7/8] Windows gdb: Implement XState (Intel AVX) support Hannes Domani
2026-08-10 17:25     ` Hannes Domani
2026-08-13  6:39       ` Joos, Christina
2026-08-26 14:28     ` Joos, Christina
2026-08-26 15:20       ` Hannes Domani [this message]
2026-08-27 10:42         ` Joos, Christina
2026-08-27 14:20           ` Hannes Domani
2026-08-27 15:17             ` Joos, Christina
2026-08-27 16:05               ` Hannes Domani
2026-08-27 16:30                 ` Joos, Christina
2026-07-27 17:42   ` [PATCH v2 8/8] Windows gdbserver: " Hannes Domani
2026-08-12 22:00   ` [PATCH v2 1/8] gdb/testsuite: Add Windows replacement for aligned_alloc Luis
2026-08-12 22:08     ` Hannes Domani
2026-08-21 17:56   ` Tom Tromey

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=1041475645.327467.1787757617271@mail.yahoo.com \
    --to=ssbssa@yahoo.de \
    --cc=christina.joos@intel.com \
    --cc=gdb-patches@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