ACK: [SRU][F][PATCH 1/1] x86/pkeys: Revert a5eff7259790 ("x86/pkeys: Add PKRU value to init_fpstate")
Stefan Bader
stefan.bader at canonical.com
Thu Aug 10 16:01:58 UTC 2023
On 10.08.23 17:56, Roxana Nicolescu wrote:
> From: Thomas Gleixner <tglx at linutronix.de>
>
> BugLink: https://bugs.launchpad.net/bugs/2031022
>
> This cannot work and it's unclear how that ever made a difference.
>
> init_fpstate.xsave.header.xfeatures is always 0 so get_xsave_addr() will
> always return a NULL pointer, which will prevent storing the default PKRU
> value in init_fpstate.
>
> Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
> Signed-off-by: Borislav Petkov <bp at suse.de>
> Reviewed-by: Borislav Petkov <bp at suse.de>
> Link: https://lkml.kernel.org/r/20210623121451.451391598@linutronix.de
> (cherry picked from commit b3607269ff57fd3c9690cb25962c5e4b91a0fd3b)
> Signed-off-by: Roxana Nicolescu <roxana.nicolescu at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
> ---
> arch/x86/kernel/cpu/common.c | 5 -----
> arch/x86/mm/pkeys.c | 6 ------
> 2 files changed, 11 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 9a91b5706aae..b0ea0c1f44c1 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -449,8 +449,6 @@ static bool pku_disabled;
>
> static __always_inline void setup_pku(struct cpuinfo_x86 *c)
> {
> - struct pkru_state *pk;
> -
> /* check the boot processor, plus compile options for PKU: */
> if (!cpu_feature_enabled(X86_FEATURE_PKU))
> return;
> @@ -461,9 +459,6 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c)
> return;
>
> cr4_set_bits(X86_CR4_PKE);
> - pk = get_xsave_addr(&init_fpstate.xsave, XFEATURE_PKRU);
> - if (pk)
> - pk->pkru = init_pkru_value;
> /*
> * Seting X86_CR4_PKE will cause the X86_FEATURE_OSPKE
> * cpuid bit to be set. We need to ensure that we
> diff --git a/arch/x86/mm/pkeys.c b/arch/x86/mm/pkeys.c
> index c6f84c0b5d7a..ca77af96033b 100644
> --- a/arch/x86/mm/pkeys.c
> +++ b/arch/x86/mm/pkeys.c
> @@ -10,7 +10,6 @@
>
> #include <asm/cpufeature.h> /* boot_cpu_has, ... */
> #include <asm/mmu_context.h> /* vma_pkey() */
> -#include <asm/fpu/internal.h> /* init_fpstate */
>
> int __execute_only_pkey(struct mm_struct *mm)
> {
> @@ -154,7 +153,6 @@ static ssize_t init_pkru_read_file(struct file *file, char __user *user_buf,
> static ssize_t init_pkru_write_file(struct file *file,
> const char __user *user_buf, size_t count, loff_t *ppos)
> {
> - struct pkru_state *pk;
> char buf[32];
> ssize_t len;
> u32 new_init_pkru;
> @@ -177,10 +175,6 @@ static ssize_t init_pkru_write_file(struct file *file,
> return -EINVAL;
>
> WRITE_ONCE(init_pkru_value, new_init_pkru);
> - pk = get_xsave_addr(&init_fpstate.xsave, XFEATURE_PKRU);
> - if (!pk)
> - return -EINVAL;
> - pk->pkru = new_init_pkru;
> return count;
> }
>
--
- Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE8675DEECBEECEA3.asc
Type: application/pgp-keys
Size: 44613 bytes
Desc: OpenPGP public key
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20230810/bf3dd3ec/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20230810/bf3dd3ec/attachment-0001.sig>
More information about the kernel-team
mailing list