The patch below does not apply to the 4.9-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to stable@vger.kernel.org.
Possible dependencies:
0469e56a14bf ("KVM: x86: Mask off reserved bits in CPUID.80000001H") bd7919999047 ("KVM: x86: Override host CPUID results with kvm_cpu_caps") 09f628a0b49c ("KVM: x86: Fold CPUID 0x7 masking back into __do_cpuid_func()") 90d2f60f41f7 ("KVM: x86: Use KVM cpu caps to track UMIP emulation") b3d895d5c415 ("KVM: x86: Move XSAVES CPUID adjust to VMX's KVM cpu cap update") 3ec6fd8cf0ba ("KVM: VMX: Convert feature updates from CPUID to KVM cpu caps") 9b58b9857f22 ("KVM: SVM: Convert feature updates from CPUID to KVM cpu caps") 66a6950f9995 ("KVM: x86: Introduce kvm_cpu_caps to replace runtime CPUID masking") 9e6d01c2d908 ("KVM: x86: Refactor handling of XSAVES CPUID adjustment") fb7d4377d513 ("KVM: x86: handle GBPAGE CPUID adjustment for EPT with generic code") dbd068040c64 ("KVM: x86: Handle Intel PT CPUID adjustment in VMX code") 733deafc00df ("KVM: x86: Handle RDTSCP CPUID adjustment in VMX code") d64d83d1e026 ("KVM: x86: Handle PKU CPUID adjustment in VMX code") e574768f841b ("KVM: x86: Handle UMIP emulation CPUID adjustment in VMX code") 5ffec6f910dc ("KVM: x86: Handle INVPCID CPUID adjustment in VMX code") 6c7ea4b56bfe ("KVM: x86: Handle MPX CPUID adjustment in VMX code") e745e37d4977 ("KVM: x86: Refactor cpuid_mask() to auto-retrieve the register") b32666b13a72 ("KVM: x86: Introduce cpuid_entry_{change,set,clear}() mutators") 4c61534aaae2 ("KVM: x86: Introduce cpuid_entry_{get,has}() accessors") 5e12b2bb34e9 ("KVM: x86: Replace bare "unsigned" with "unsigned int" in cpuid helpers")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0469e56a14bf8cfb80507e51b7aeec0332cdbc13 Mon Sep 17 00:00:00 2001 From: Jim Mattson jmattson@google.com Date: Fri, 30 Sep 2022 00:51:58 +0200 Subject: [PATCH] KVM: x86: Mask off reserved bits in CPUID.80000001H
KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM actually supports. CPUID.80000001:EBX[27:16] are reserved bits and should be masked off.
Fixes: 0771671749b5 ("KVM: Enhance guest cpuid management") Signed-off-by: Jim Mattson jmattson@google.com Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini pbonzini@redhat.com
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 7065462378e2..834feeb0a828 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -1133,6 +1133,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) entry->eax = max(entry->eax, 0x80000021); break; case 0x80000001: + entry->ebx &= ~GENMASK(27, 16); cpuid_entry_override(entry, CPUID_8000_0001_EDX); cpuid_entry_override(entry, CPUID_8000_0001_ECX); break;
linux-stable-mirror@lists.linaro.org