mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Andy Lutomirski" <luto@kernel.org>
To: "Dave Hansen" <dave.hansen@intel.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	linux-mm@kvack.org
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	shuah@kernel.org, "Babu Moger" <babu.moger@amd.com>,
	dave.kleikamp@oracle.com, linuxram@us.ibm.com,
	bauerman@linux.ibm.com
Subject: Re: [PATCH 0/5] x86/pkeys: PKRU manipulation bug fixes and cleanups
Date: Fri, 28 May 2021 10:13:32 -0700	[thread overview]
Message-ID: <3781d3ec-6d1b-4d04-8bed-19985115153d@www.fastmail.com> (raw)
In-Reply-To: <4c3bfc27-a542-8e91-7ccf-4be8b1e6c844@intel.com>



On Fri, May 28, 2021, at 9:11 AM, Dave Hansen wrote:
> On 5/28/21 8:32 AM, Thomas Gleixner wrote:
> >>
> >> This series:
> >>  * Moves the PKRU manipulation to a more appropriate location,
> >>    away from the page table code
> >>  * Wraps get_xsave_addr() with more structured, less error-prone
> >>    interfaces.
> >>  * Conditionally hides a pkey debugfs file, eliminating the need
> >>    for new runtime checks to work with the new interface.
> >>  * Add a selftest to make it more likely to catch bugs like this
> >>    in the future.  This improved selftest catches this issue on
> >>    Intel CPUs.  Without the improvement, it only triggers on AMD.
> > I think all of this is fundamentaly wrong.
> > 
> > Contrary to FPU state, PKRU has to be updated at context switch
> > time. There is absolutely no point in having PKRU XSAVES managed.
> > 
> > It's broken in several ways. Anything which clears and loads the FPU
> > will load the wrong PKRU value. Go figure...
> > 
> > So the right thing is to disable PKRU in XCR0 and on sched out simply do
> > 
> >    task->thread.pkru = read_pkru();
> > 
> > and on sched in
> > 
> >    write_pkru(task->thread.pkru);
> > 
> > Simple, trivial and not going to be wreckaged by anything which fiddles
> > with xstates. We all know by now that xstates is a trainwreck and not
> > having stuff like that in there is making the fixes I'm doing way
> > simpler.
> 
> As for the general sentiment that PKRU is not suitable for management
> with XSAVE, I'm with you.
> 
> I have a few concerns about moving away from XSAVE management, though.
> I'm not nixing the whole idea, but there are some things we need to resolve.
> 
> First is that there _may_ be ABI concerns.  

I tend to think that, for -stable, we should fix the bug without an ABI change.

  reply	other threads:[~2021-05-28 17:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 23:51 Dave Hansen
2021-05-27 23:51 ` [PATCH 1/5] x86/pkeys: move read_pkru() and write_pkru() Dave Hansen
2021-05-27 23:51 ` [PATCH 2/5] x86/pkeys: rename write_pkru() Dave Hansen
2021-05-27 23:51 ` [PATCH 3/5] x86/pkeys: skip 'init_pkru' debugfs file creation when pkeys not supported Dave Hansen
2021-05-27 23:51 ` [PATCH 4/5] x86/pkeys: replace PKRU modification infrastructure Dave Hansen
2021-05-28  1:17   ` Mika Penttilä
2021-05-28 17:00   ` Dave Kleikamp
2021-06-01 21:54   ` Babu Moger
2021-06-01 22:43     ` Dave Kleikamp
2021-06-01 22:49       ` Dave Hansen
2021-05-27 23:51 ` [PATCH 5/5] selftests/vm/pkeys: exercise x86 XSAVE init state Dave Hansen
2021-05-28 15:32 ` [PATCH 0/5] x86/pkeys: PKRU manipulation bug fixes and cleanups Thomas Gleixner
2021-05-28 16:11   ` Dave Hansen
2021-05-28 17:13     ` Andy Lutomirski [this message]
2021-05-28 17:19       ` Thomas Gleixner
2021-05-28 17:19     ` Thomas Gleixner

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=3781d3ec-6d1b-4d04-8bed-19985115153d@www.fastmail.com \
    --to=luto@kernel.org \
    --cc=babu.moger@amd.com \
    --cc=bauerman@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.kleikamp@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxram@us.ibm.com \
    --cc=mingo@redhat.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®