]> git.baikalelectronics.ru Git - 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)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 22 Oct 2022 11:54:35 +0000 (07:54 -0400)
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: c01a15210615 ("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>
arch/x86/kvm/cpuid.c

index 7065462378e2933d7c76711a54cc64c70140443a..834feeb0a828dda1c4d5ac87698f51eb3b79778f 100644 (file)
@@ -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;