summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Mattson <jmattson@google.com>2022-09-29 15:51:59 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-10 18:15:41 +0100
commitef7716398a781abe764d560eb20edd72ea62542a (patch)
tree029f82bad5316e9c96c9571e02cd019142749f95
parenta88998446b6d7d8dae201862db470abe1b5097d2 (diff)
downloadlinux-stable-ef7716398a781abe764d560eb20edd72ea62542a.tar.gz
linux-stable-ef7716398a781abe764d560eb20edd72ea62542a.tar.bz2
linux-stable-ef7716398a781abe764d560eb20edd72ea62542a.zip
KVM: x86: Mask off reserved bits in CPUID.80000006H
commit eeb69eab57c6604ac90b3fd8e5ac43f24a5535b1 upstream. KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM actually supports. CPUID.80000006H:EDX[17:16] are reserved bits and should be masked off. Fixes: 43d05de2bee7 ("KVM: pass through CPUID(0x80000006)") Signed-off-by: Jim Mattson <jmattson@google.com> Message-Id: <20220929225203.2234702-2-jmattson@google.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/kvm/cpuid.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index d85a0808a446..76893975b116 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -906,7 +906,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
cpuid_entry_override(entry, CPUID_8000_0001_ECX);
break;
case 0x80000006:
- /* L2 cache and TLB: pass through host info. */
+ /* Drop reserved bits, pass host L2 cache and TLB info. */
+ entry->edx &= ~GENMASK(17, 16);
break;
case 0x80000007: /* Advanced power management */
/* invariant TSC is CPUID.80000007H:EDX[8] */