]> git.baikalelectronics.ru Git - kernel.git/commit
x86/fpu: Extend fpu_xstate_prctl() with guest permissions
authorThomas Gleixner <tglx@linutronix.de>
Wed, 5 Jan 2022 12:35:12 +0000 (04:35 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Jan 2022 18:33:03 +0000 (13:33 -0500)
commit69e3a858e771f04527aac2e87e5fd8770ea6ec31
treebc14f810c770b0229f35c02cecd9e8bd6ac7a043
parent9855c78884573c1473bbd7abec1adc8c39d4b979
x86/fpu: Extend fpu_xstate_prctl() with guest permissions

KVM requires a clear separation of host user space and guest permissions
for dynamic XSTATE components.

Add a guest permissions member to struct fpu and a separate set of prctl()
arguments: ARCH_GET_XCOMP_GUEST_PERM and ARCH_REQ_XCOMP_GUEST_PERM.

The semantics are equivalent to the host user space permission control
except for the following constraints:

  1) Permissions have to be requested before the first vCPU is created

  2) Permissions are frozen when the first vCPU is created to ensure
     consistency. Any attempt to expand permissions via the prctl() after
     that point is rejected.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220105123532.12586-2-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/fpu/api.h
arch/x86/include/asm/fpu/types.h
arch/x86/include/uapi/asm/prctl.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kernel/fpu/xstate.h
arch/x86/kernel/process.c