This is a note to let you know that I've just added the patch titled KVM: VMX: Do not advertise RDPID if ENABLE_RDTSCP control is unsupported to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kvm-vmx-do-not-advertise-rdpid-if-enable_rdtscp-control-is-unsupported.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8aec21c04caa2000f91cf8822ae0811e4b0c3971 Mon Sep 17 00:00:00 2001 From: Sean Christopherson <seanjc@xxxxxxxxxx> Date: Tue, 4 May 2021 10:17:20 -0700 Subject: KVM: VMX: Do not advertise RDPID if ENABLE_RDTSCP control is unsupported From: Sean Christopherson <seanjc@xxxxxxxxxx> commit 8aec21c04caa2000f91cf8822ae0811e4b0c3971 upstream. Clear KVM's RDPID capability if the ENABLE_RDTSCP secondary exec control is unsupported. Despite being enumerated in a separate CPUID flag, RDPID is bundled under the same VMCS control as RDTSCP and will #UD in VMX non-root if ENABLE_RDTSCP is not enabled. Fixes: 41cd02c6f7f6 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> Message-Id: <20210504171734.1434054-2-seanjc@xxxxxxxxxx> Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx> Reviewed-by: Reiji Watanabe <reijiw@xxxxxxxxxx> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/vmx/vmx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7352,9 +7352,11 @@ static __init void vmx_set_cpu_caps(void if (!cpu_has_vmx_xsaves()) kvm_cpu_cap_clear(X86_FEATURE_XSAVES); - /* CPUID 0x80000001 */ - if (!cpu_has_vmx_rdtscp()) + /* CPUID 0x80000001 and 0x7 (RDPID) */ + if (!cpu_has_vmx_rdtscp()) { kvm_cpu_cap_clear(X86_FEATURE_RDTSCP); + kvm_cpu_cap_clear(X86_FEATURE_RDPID); + } if (cpu_has_vmx_waitpkg()) kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG); Patches currently in stable-queue which might be from seanjc@xxxxxxxxxx are queue-5.12/kvm-vmx-disable-preemption-when-probing-user-return-msrs.patch queue-5.12/kvm-vmx-do-not-advertise-rdpid-if-enable_rdtscp-control-is-unsupported.patch queue-5.12/crypto-ccp-free-sev-device-if-sev-init-fails.patch queue-5.12/kvm-lapic-accurately-guarantee-busy-wait-for-timer-t.patch queue-5.12/kvm-x86-add-support-for-rdpid-without-rdtscp.patch queue-5.12/kvm-x86-move-rdpid-emulation-intercept-to-its-own-enum.patch queue-5.12/kvm-x86-emulate-rdpid-only-if-rdtscp-is-supported.patch