public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: GDB <gdb-patches@sourceware.org>, John Baldwin <jhb@freebsd.org>,
	 Felix Willgerodt <felix.willgerodt@intel.com>
Subject: [PATCH] gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32
Date: Tue, 19 Mar 2024 11:36:11 -0700	[thread overview]
Message-ID: <CAMe9rOo9zm4h2UVxrOipjo3+55_LU+Lf__bFTHxxKfOKMAHxcA@mail.gmail.com> (raw)
In-Reply-To: <20240319152558.45742-1-hjl.tools@gmail.com>

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.

       reply	other threads:[~2024-03-19 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240319152558.45742-1-hjl.tools@gmail.com>
2024-03-19 18:36 ` H.J. Lu [this message]
2024-03-20  8:40   ` Willgerodt, Felix
2024-03-20 10:48     ` 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=CAMe9rOo9zm4h2UVxrOipjo3+55_LU+Lf__bFTHxxKfOKMAHxcA@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).