Patch "x86/fpu: Emulate XRSTOR's behavior if the xfeatures PKRU bit is not set" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/fpu: Emulate XRSTOR's behavior if the xfeatures PKRU bit is not set

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-fpu-emulate-xrstor-s-behavior-if-the-xfeatures-pkru-bit-is-not-set.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From me@xxxxxxxxxxxx Mon Jan  9 22:02:39 2023
From: Kyle Huey <me@xxxxxxxxxxxx>
Date: Mon,  9 Jan 2023 13:02:13 -0800
Subject: x86/fpu: Emulate XRSTOR's behavior if the xfeatures PKRU bit is not set
To: stable@xxxxxxxxxxxxxxx, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Sean Christopherson <seanjc@xxxxxxxxxx>, Robert O'Callahan <robert@xxxxxxxxxxxxx>, David Manouchehri <david.manouchehri@xxxxxxxxxx>, Kyle Huey <me@xxxxxxxxxxxx>
Message-ID: <20230109210214.71068-6-khuey@xxxxxxxxxxxx>

From: Kyle Huey <me@xxxxxxxxxxxx>

From: Kyle Huey <me@xxxxxxxxxxxx>

commit d7e5aceace51 upstream

The hardware XRSTOR instruction resets the PKRU register to its hardware
init value (namely 0) if the PKRU bit is not set in the xfeatures mask.
Emulating that here restores the pre-5.14 behavior for PTRACE_SET_REGSET
with NT_X86_XSTATE, and makes sigreturn (which still uses XRSTOR) and
behave identically.

Fixes: e84ba47e313d ("x86/fpu: Hook up PKRU into ptrace()")
Signed-off-by: Kyle Huey <me@xxxxxxxxxxxx>
Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/all/20221115230932.7126-6-khuey%40kylehuey.com
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/kernel/fpu/xstate.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -1168,7 +1168,8 @@ static int copy_uabi_to_xstate(struct xr
 
 		xpkru = __raw_xsave_addr(xsave, XFEATURE_PKRU);
 		*pkru = xpkru->pkru;
-	}
+	} else
+		*pkru = 0;
 
 	/*
 	 * The state that came in from userspace was user-state only.


Patches currently in stable-queue which might be from me@xxxxxxxxxxxx are

queue-5.15/x86-fpu-take-task_struct-in-copy_sigframe_from_user_to_xstate.patch
queue-5.15/selftests-vm-pkeys-add-a-regression-test-for-setting-pkru-through-ptrace.patch
queue-5.15/x86-fpu-emulate-xrstor-s-behavior-if-the-xfeatures-pkru-bit-is-not-set.patch
queue-5.15/x86-fpu-allow-pkru-to-be-once-again-written-by-ptrace.patch
queue-5.15/x86-fpu-add-a-pkru-argument-to-copy_uabi_to_xstate.patch
queue-5.15/x86-fpu-add-a-pkru-argument-to-copy_uabi_from_kernel_to_xstate.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux