KVM: x86/cpuid: Exclude unpermitted xfeatures sizes at KVM_GET_SUPPORTED_CPUID
authorLike Xu <likexu@tencent.com>
Tue, 25 Jan 2022 11:52:23 +0000 (19:52 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 26 Jan 2022 17:14:58 +0000 (12:14 -0500)
commit1ffce0924a8c86cf0590c039cd5f5c9375d32e9b
tree2650f7f7266ccc207f34c916bdbb686342941544
parent35fe7cfbab2e81f1afb23fc4212210b1de6d9633
KVM: x86/cpuid: Exclude unpermitted xfeatures sizes at KVM_GET_SUPPORTED_CPUID

With the help of xstate_get_guest_group_perm(), KVM can exclude unpermitted
xfeatures in cpuid.0xd.0.eax, in which case the corresponding xfeatures
sizes should also be matched to the permitted xfeatures.

To fix this inconsistency, the permitted_xcr0 and permitted_xss are defined
consistently, which implies 'supported' plus certain permissions for this
task, and it also fixes cpuid.0xd.1.ebx and later leaf-by-leaf queries.

Fixes: 445ecdf79be0 ("kvm: x86: Exclude unpermitted xfeatures at KVM_GET_SUPPORTED_CPUID")
Signed-off-by: Like Xu <likexu@tencent.com>
Message-Id: <20220125115223.33707-1-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c