Skip to content
Commit d7e5acea authored by Kyle Huey's avatar Kyle Huey Committed by Dave Hansen
Browse files

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



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
ptrace behave identically. KVM has never used XRSTOR and never had this
behavior, so KVM opts-out of this emulation by passing a NULL pkru pointer
to copy_uabi_to_xstate().

Fixes: e84ba47e ("x86/fpu: Hook up PKRU into ptrace()")
Signed-off-by: default avatarKyle Huey <me@kylehuey.com>
Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20221115230932.7126-6-khuey%40kylehuey.com
parent 4a804c4f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment