public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32
Date: Thu, 21 Mar 2024 19:45:14 +0000 (GMT)	[thread overview]
Message-ID: <20240321194515.63FAC3858D28@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4bb20a6244b7091a9a7a2ae35dfbd7e8db27550a

commit 4bb20a6244b7091a9a7a2ae35dfbd7e8db27550a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 20 04:13:18 2024 -0700

    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.
    Reviewed-by: Felix Willgerodt <felix.willgerodt@intel.com>

Diff:
---
 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.  */

                 reply	other threads:[~2024-03-21 19:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240321194515.63FAC3858D28@sourceware.org \
    --to=hjl@sourceware.org \
    --cc=gdb-cvs@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).