From: Dave Hansen <dave.hansen@intel.com>
To: Jeff Xu <jeffxu@chromium.org>, Kyle Huey <me@kylehuey.com>
Cc: linux-mm@kvack.org, "Stephen Röttger" <sroettger@chromium.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"Jorge Lucangeli Obes" <jorgelo@chromium.org>,
"Kees Cook" <keescook@chromium.org>,
"Guenter Roeck" <groeck@chromium.org>
Subject: Re: x86/pkeys in early kernel version
Date: Mon, 13 Mar 2023 17:24:59 -0700 [thread overview]
Message-ID: <c9e2f096-fc22-09b3-c85b-97cb8d9e07dc@intel.com> (raw)
In-Reply-To: <CABi2SkW_eTrEmxaoTv_2D+hT1PxHduqptpC-_Wenw1BNyzoxfg@mail.gmail.com>
On 3/13/23 16:24, Jeff Xu wrote:
> I have another case of test_ptrace_modifier_pkru failure.
> This is happening in AMD 5000 CPU and 5.15.98 kernel.
> The odd thing about this is:
> if I run the whole set of protection_keys (20 cases), it will pass.
> If I run the last case (by comment out the others), it will fail with
> below error:
>
> has pkeys: 1
> startup pkey_reg: 0000000055555550
> assert() at protection_keys.c::1623 test_nr: 0 iteration: 1
> running abort_hooks()...
> errno at assert: 0
>
> And the same test on Intel CPU is passing.
>
> I wonder if this is known or someone has a repro ?
>
> Another question regarding PKRU, may or maynot related to this failure on AMD:
> During the thread context switch, will PKRU be saved to the thread's
> user space stack? Is this what XSAVE does (pre-5.14), and if we are
> not using XSAVE after 5.15, what is used ?
One Intel vs. AMD delta that I seem to recall is their init trackers.
On Intel, the only "normal" way to get an XSAVE component back to being
tracked as in its init state is with XRSTOR and the right incantations
of XSTATE_BV and RFBM.
On AMD, I think the init tracker is much more magic and aggressive. In
addition to a careful XRSTOR, WRPKRU(0) _can_ put the PKRU state
component back to being tracked as being in its init state. Also an
XRSTOR with a PKRU value of 0 can do it.
Basically, on AMD the register state matters for init tracking. On
Intel, the actual register contents are not taken into account.
It might be interesting to dump xgetbv(1) around the failures to see
what's going on with the init tracker.
next prev parent reply other threads:[~2023-03-14 0:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 19:02 Jeff Xu
2023-01-25 19:12 ` Dave Hansen
2023-01-26 1:43 ` Jeff Xu
2023-01-27 5:36 ` Jeff Xu
2023-01-27 5:55 ` Kyle Huey
2023-01-27 19:08 ` Jeff Xu
2023-01-27 19:22 ` Kyle Huey
2023-01-27 19:30 ` Kyle Huey
2023-01-27 21:12 ` Jeff Xu
2023-03-13 23:24 ` Jeff Xu
2023-03-14 0:24 ` Dave Hansen [this message]
2023-01-27 15:22 ` Dave Hansen
2023-01-27 17:58 ` Jeff Xu
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=c9e2f096-fc22-09b3-c85b-97cb8d9e07dc@intel.com \
--to=dave.hansen@intel.com \
--cc=groeck@chromium.org \
--cc=jeffxu@chromium.org \
--cc=jorgelo@chromium.org \
--cc=keescook@chromium.org \
--cc=linux-mm@kvack.org \
--cc=me@kylehuey.com \
--cc=sroettger@chromium.org \
--cc=tglx@linutronix.de \
/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