diff mbox series

[4/6] KVM: x86: Mask off reserved bits in CPUID.8000001AH

Message ID 20220929225203.2234702-4-jmattson@google.com (mailing list archive)
State New, archived
Headers show
Series [1/6] KVM: x86: Mask off reserved bits in CPUID.80000001H | expand

Commit Message

Jim Mattson Sept. 29, 2022, 10:52 p.m. UTC
KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM
actually supports. In the case of CPUID.8000001AH, only three bits are
currently defined. The 125 reserved bits should be masked off.

Fixes: 24c82e576b78 ("KVM: Sanitize cpuid")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/cpuid.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 15318f3f415e..5d1ec390aa45 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -1175,6 +1175,9 @@  static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 		entry->ecx = entry->edx = 0;
 		break;
 	case 0x8000001a:
+		entry->eax &= GENMASK(2, 0);
+		entry->ebx = entry->ecx = entry->edx = 0;
+		break;
 	case 0x8000001e:
 		break;
 	case 0x8000001F: