* [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 [not found] <20240319152558.45742-1-hjl.tools@gmail.com> @ 2024-03-19 18:36 ` H.J. Lu 2024-03-20 8:40 ` Willgerodt, Felix 0 siblings, 1 reply; 3+ messages in thread From: H.J. Lu @ 2024-03-19 18:36 UTC (permalink / raw) To: GDB, John Baldwin, Felix Willgerodt Since MPX isn't available for x32, we should clear X86_XSTATE_MPX bits on x32. PR server/31511 * linux-x86-low.cc (x86_linux_read_description): Clear X86_XSTATE_MPX bits in xcr0 on x32. --- gdbserver/linux-x86-low.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 3af0a009052..28b5d523b8e 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -938,6 +938,10 @@ x86_linux_read_description (void) xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET / sizeof (uint64_t))]; + /* No MPX on x32. */ + if (!is_elf64) + xcr0 &= ~X86_XSTATE_MPX; + xsave_len = x86_xsave_length (); /* Use PTRACE_GETREGSET if it is available. */ -- 2.44.0 -- H.J. ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 2024-03-19 18:36 ` [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 H.J. Lu @ 2024-03-20 8:40 ` Willgerodt, Felix 2024-03-20 10:48 ` H.J. Lu 0 siblings, 1 reply; 3+ messages in thread From: Willgerodt, Felix @ 2024-03-20 8:40 UTC (permalink / raw) To: H.J. Lu, GDB, John Baldwin > -----Original Message----- > From: H.J. Lu <hjl.tools@gmail.com> > Sent: Dienstag, 19. März 2024 19:36 > To: GDB <gdb-patches@sourceware.org>; John Baldwin <jhb@freebsd.org>; > Willgerodt, Felix <felix.willgerodt@intel.com> > Subject: [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 > > Since MPX isn't available for x32, we should clear X86_XSTATE_MPX bits > on x32. > > PR server/31511 > * linux-x86-low.cc (x86_linux_read_description): Clear > X86_XSTATE_MPX bits in xcr0 on x32. > --- > gdbserver/linux-x86-low.cc | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc > index 3af0a009052..28b5d523b8e 100644 > --- a/gdbserver/linux-x86-low.cc > +++ b/gdbserver/linux-x86-low.cc > @@ -938,6 +938,10 @@ x86_linux_read_description (void) > xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET > / sizeof (uint64_t))]; > > + /* No MPX on x32. */ > + if (!is_elf64) > + xcr0 &= ~X86_XSTATE_MPX; > + Doesn't that also disable it for 32-bit? x86_target::low_siginfo_fixup() uses this to check x32: /* No fixup for native x32 GDB. */ else if (!is_elf64 && sizeof (void *) == 8) Felix 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 2024-03-20 8:40 ` Willgerodt, Felix @ 2024-03-20 10:48 ` H.J. Lu 0 siblings, 0 replies; 3+ messages in thread From: H.J. Lu @ 2024-03-20 10:48 UTC (permalink / raw) To: Willgerodt, Felix; +Cc: GDB, John Baldwin On Wed, Mar 20, 2024 at 1:40 AM Willgerodt, Felix <felix.willgerodt@intel.com> wrote: > > > -----Original Message----- > > From: H.J. Lu <hjl.tools@gmail.com> > > Sent: Dienstag, 19. März 2024 19:36 > > To: GDB <gdb-patches@sourceware.org>; John Baldwin <jhb@freebsd.org>; > > Willgerodt, Felix <felix.willgerodt@intel.com> > > Subject: [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 > > > > Since MPX isn't available for x32, we should clear X86_XSTATE_MPX bits > > on x32. > > > > PR server/31511 > > * linux-x86-low.cc (x86_linux_read_description): Clear > > X86_XSTATE_MPX bits in xcr0 on x32. > > --- > > gdbserver/linux-x86-low.cc | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc > > index 3af0a009052..28b5d523b8e 100644 > > --- a/gdbserver/linux-x86-low.cc > > +++ b/gdbserver/linux-x86-low.cc > > @@ -938,6 +938,10 @@ x86_linux_read_description (void) > > xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET > > / sizeof (uint64_t))]; > > > > + /* No MPX on x32. */ > > + if (!is_elf64) > > + xcr0 &= ~X86_XSTATE_MPX; > > + > > Doesn't that also disable it for 32-bit? Fixed in the v2 patch with + /* No MPX on x32. */ + if (machine == EM_X86_64 && !is_elf64) + xcr0 &= ~X86_XSTATE_MPX; + > x86_target::low_siginfo_fixup() uses this to check x32: > > /* No fixup for native x32 GDB. */ > else if (!is_elf64 && sizeof (void *) == 8) > > Thanks. -- H.J. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-20 10:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20240319152558.45742-1-hjl.tools@gmail.com> 2024-03-19 18:36 ` [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32 H.J. Lu 2024-03-20 8:40 ` Willgerodt, Felix 2024-03-20 10:48 ` H.J. Lu
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).