Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Willgerodt, Felix" <felix.willgerodt@intel.com>
To: "H.J. Lu" <hjl.tools@gmail.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "jhb@FreeBSD.org" <jhb@FreeBSD.org>
Subject: RE: [PATCH v2] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32
Date: Wed, 20 Mar 2024 14:45:57 +0000	[thread overview]
Message-ID: <MN2PR11MB45662D61E59220FE921DADDB8E332@MN2PR11MB4566.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20240320111318.117728-1-hjl.tools@gmail.com>

> -----Original Message-----
> From: H.J. Lu <hjl.tools@gmail.com>
> Sent: Mittwoch, 20. März 2024 12:13
> To: gdb-patches@sourceware.org
> Cc: Willgerodt, Felix <felix.willgerodt@intel.com>; jhb@FreeBSD.org
> Subject: [PATCH v2] 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..933d1fb012a 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 (machine == EM_X86_64 && !is_elf64)
> +	    xcr0 &= ~X86_XSTATE_MPX;
> +
>  	  xsave_len = x86_xsave_length ();
> 
>  	  /* Use PTRACE_GETREGSET if it is available.  */
> --
> 2.44.0

+1 from me.

Reviewed-by: Felix Willgerodt <felix.willgerodt@intel.com>

Regards,
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

  reply	other threads:[~2024-03-20 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 11:13 H.J. Lu
2024-03-20 14:45 ` Willgerodt, Felix [this message]
2024-03-21 17:29   ` John Baldwin
2024-03-23 11:29 ` Andrew Burgess
2024-03-23 16:39   ` Andrew Burgess
2024-03-23 17:08     ` H.J. Lu

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=MN2PR11MB45662D61E59220FE921DADDB8E332@MN2PR11MB4566.namprd11.prod.outlook.com \
    --to=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=jhb@FreeBSD.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