x86/fpu: Add a pkru argument to copy_uabi_from_kernel_to_xstate().
authorKyle Huey <me@kylehuey.com>
Tue, 15 Nov 2022 23:09:28 +0000 (15:09 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Jan 2023 09:33:40 +0000 (10:33 +0100)
commita442736b704d4194ae68f75f4ee2e64cf2b8a142
treec6f4d6796af21e518fff9acada8436b30196e084
parentf28418b06f6b1e83c81369ef1705ee53da106ae6
x86/fpu: Add a pkru argument to copy_uabi_from_kernel_to_xstate().

commit 1c813ce0305571e1b2e4cc4acca451da9e6ad18f upstream.

Both KVM (through KVM_SET_XSTATE) and ptrace (through PTRACE_SETREGSET
with NT_X86_XSTATE) ultimately call copy_uabi_from_kernel_to_xstate(),
but the canonical locations for the current PKRU value for KVM guests
and processes in a ptrace stop are different (in the kvm_vcpu_arch and
the thread_state structs respectively).

In preparation for eventually handling PKRU in
copy_uabi_to_xstate, pass in a pointer to the PKRU location.

Signed-off-by: Kyle Huey <me@kylehuey.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20221115230932.7126-3-khuey%40kylehuey.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/regset.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kernel/fpu/xstate.h