]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
KVM: x86: Mask off reserved bits in CPUID.80000001H
authorJim Mattson <jmattson@google.com>
Thu, 29 Sep 2022 22:51:58 +0000 (00:51 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 6 Dec 2022 13:45:46 +0000 (14:45 +0100)
BugLink: https://bugs.launchpad.net/bugs/1998843
commit 0469e56a14bf8cfb80507e51b7aeec0332cdbc13 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kvm/cpuid.c

index 478721a33a1f18dcca93d159164e53600489220a..8f2a803ad0360c35870d0932240fb069dcb34a80 100644 (file)
@@ -902,6 +902,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
                entry->eax = min(entry->eax, 0x8000001f);
                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;