From: Dave Hansen <dave.hansen@intel.com>
To: Brian Geffon <bgeffon@google.com>, Thomas Gleixner <tglx@linutronix.de>
Cc: Willis Kung <williskung@google.com>,
Guenter Roeck <groeck@google.com>, Borislav Petkov <bp@suse.de>,
Andy Lutomirski <luto@kernel.org>,
stable@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH stable 5.4,5.10] x86/fpu: Correct pkru/xstate inconsistency
Date: Thu, 24 Feb 2022 07:16:17 -0800 [thread overview]
Message-ID: <e495d70b-f138-367d-e1d7-67c77149db7a@intel.com> (raw)
In-Reply-To: <20220215192233.8717-1-bgeffon@google.com>
On 2/15/22 11:22, Brian Geffon wrote:
> When eagerly switching PKRU in switch_fpu_finish() it checks that
> current is not a kernel thread as kernel threads will never use PKRU.
> It's possible that this_cpu_read_stable() on current_task
> (ie. get_current()) is returning an old cached value. To resolve this
> reference next_p directly rather than relying on current.
>
> As written it's possible when switching from a kernel thread to a
> userspace thread to observe a cached PF_KTHREAD flag and never restore
> the PKRU. And as a result this issue only occurs when switching
> from a kernel thread to a userspace thread, switching from a non kernel
> thread works perfectly fine because all that is considered in that
> situation are the flags from some other non kernel task and the next fpu
> is passed in to switch_fpu_finish().
>
> This behavior only exists between 5.2 and 5.13 when it was fixed by a
> rewrite decoupling PKRU from xstate, in:
> commit 954436989cc5 ("x86/fpu: Remove PKRU handling from switch_fpu_finish()")
>
> Unfortunately backporting the fix from 5.13 is probably not realistic as
> it's part of a 60+ patch series which rewrites most of the PKRU handling.
>
> Fixes: 0cecca9d03c9 ("x86/fpu: Eager switch PKRU state")
> Signed-off-by: Brian Geffon <bgeffon@google.com>
> Signed-off-by: Willis Kung <williskung@google.com>
> Tested-by: Willis Kung <williskung@google.com>
> Cc: <stable@vger.kernel.org> # v5.4.x
> Cc: <stable@vger.kernel.org> # v5.10.x
I don't like forking the stable code from mainline. But I also think
that backporting the FPU reworking that changed the PKRU handling is
likely to cause more bugs in stable than it fixes.
This fix is at least isolated to the protection keys code.
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
next prev parent reply other threads:[~2022-02-24 15:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 15:36 [PATCH] x86/fpu: Correct pkru/xstate inconsistency Brian Geffon
2022-02-15 15:57 ` Guenter Roeck
2022-02-15 16:19 ` Brian Geffon
2022-02-15 17:02 ` Guenter Roeck
2022-02-15 17:10 ` Dave Hansen
2022-02-15 16:20 ` Greg KH
2022-02-15 17:07 ` Dave Hansen
2022-02-15 17:50 ` Brian Geffon
2022-02-15 17:55 ` Dave Hansen
2022-02-15 19:22 ` [PATCH stable 5.4,5.10] " Brian Geffon
2022-02-15 19:44 ` Greg KH
2022-02-15 21:32 ` Brian Geffon
2022-02-15 21:42 ` Dave Hansen
2022-02-15 21:48 ` Brian Geffon
2022-02-16 2:01 ` Brian Geffon
2022-02-16 10:05 ` Greg KH
2022-02-16 10:05 ` Greg KH
2022-02-16 15:14 ` Brian Geffon
2022-02-16 15:16 ` Dave Hansen
2022-02-17 13:31 ` Brian Geffon
2022-02-17 16:44 ` Dave Hansen
2022-02-17 20:42 ` Brian Geffon
2022-02-24 15:16 ` Dave Hansen [this message]
2022-02-25 12:01 ` Greg KH
2022-02-15 21:14 ` [PATCH] " Guenter Roeck
2022-02-15 21:36 ` Brian Geffon
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=e495d70b-f138-367d-e1d7-67c77149db7a@intel.com \
--to=dave.hansen@intel.com \
--cc=bgeffon@google.com \
--cc=bp@suse.de \
--cc=groeck@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=williskung@google.com \
--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