mirror_ubuntu-kernels/arch/x86/include/asm/fpu
Sean Christopherson 18164f66e6 x86/fpu: Allow caller to constrain xfeatures when copying to uabi buffer
Plumb an xfeatures mask into __copy_xstate_to_uabi_buf() so that KVM can
constrain which xfeatures are saved into the userspace buffer without
having to modify the user_xfeatures field in KVM's guest_fpu state.

KVM's ABI for KVM_GET_XSAVE{2} is that features that are not exposed to
guest must not show up in the effective xstate_bv field of the buffer.
Saving only the guest-supported xfeatures allows userspace to load the
saved state on a different host with a fewer xfeatures, so long as the
target host supports the xfeatures that are exposed to the guest.

KVM currently sets user_xfeatures directly to restrict KVM_GET_XSAVE{2} to
the set of guest-supported xfeatures, but doing so broke KVM's historical
ABI for KVM_SET_XSAVE, which allows userspace to load any xfeatures that
are supported by the *host*.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230928001956.924301-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-10-12 11:08:58 -04:00
..
api.h x86/fpu: Allow caller to constrain xfeatures when copying to uabi buffer 2023-10-12 11:08:58 -04:00
regset.h x86: Add PTRACE interface for shadow stack 2023-08-02 15:01:51 -07:00
sched.h x86/shstk: Handle thread shadow stack 2023-08-02 15:01:50 -07:00
signal.h x86/signal: Add ABI prefixes to frame setup functions 2022-10-19 09:58:49 +02:00
types.h x86/fpu/xstate: Introduce CET MSR and XSAVES supervisor states 2023-08-02 15:01:50 -07:00
xcr.h cpuidle, intel_idle: Fix CPUIDLE_FLAG_INIT_XSTATE 2023-01-13 11:48:15 +01:00
xstate.h x86/fpu/xstate: Introduce CET MSR and XSAVES supervisor states 2023-08-02 15:01:50 -07:00