The patch below does not apply to the 4.19-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:
86c4f0d547f6 ("KVM: x86: Mask off reserved bits in CPUID.8000001FH") e39f00f60ebd ("KVM: x86: Use kernel's x86_phys_bits to handle reduced MAXPHYADDR") 4bf48e3c0aaf ("KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled") d9db0fd6c5c9 ("KVM: SEV: Mask CPUID[0x8000001F].eax according to supported features") 013380782d4d ("KVM: x86: Move reverse CPUID helpers to separate header file") 01de8682b32d ("KVM: x86: Add reverse-CPUID lookup support for scattered SGX features") 4e66c0cb79b7 ("KVM: x86: Add support for reverse CPUID lookup of scattered features") e42033342293 ("KVM: x86: Advertise INVPCID by default") 916391a2d1dc ("KVM: SVM: Add support for SEV-ES capability in KVM") 9d4747d02376 ("KVM: SVM: Remove the call to sev_platform_status() during setup") dc46515cf838 ("KVM: x86: Move illegal GPA helper out of the MMU code") 1dbf5d68af6f ("KVM: VMX: Add guest physical address check in EPT violation and misconfig") a0c134347baf ("KVM: VMX: introduce vmx_need_pf_intercept") ec7771ab471b ("KVM: x86: mmu: Add guest physical address check in translate_gpa()") cd313569f581 ("KVM: x86: mmu: Move translate_gpa() to mmu.c") 985ab2780164 ("KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only") 6ca9a6f3adef ("KVM: x86/mmu: Add MMU-internal header") 06e7852c0ffb ("KVM: SVM: Add vmcb_ prefix to mark_*() functions") f25a9dec2da3 ("KVM: x86/mmu: Drop kvm_arch_write_log_dirty() wrapper") 2dbebf7ae1ed ("KVM: nVMX: Plumb L2 GPA through to PML emulation")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 86c4f0d547f6460d0426ebb3ba0614f1134b8cda Mon Sep 17 00:00:00 2001 From: Jim Mattson jmattson@google.com Date: Thu, 29 Sep 2022 15:52:03 -0700 Subject: [PATCH] KVM: x86: Mask off reserved bits in CPUID.8000001FH
KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM actually supports. CPUID.8000001FH:EBX[31:16] are reserved bits and should be masked off.
Fixes: 8765d75329a3 ("KVM: X86: Extend CPUID range to include new leaf") Signed-off-by: Jim Mattson jmattson@google.com Message-Id: 20220929225203.2234702-6-jmattson@google.com Cc: stable@vger.kernel.org [Clear NumVMPL too. - Paolo] Signed-off-by: Paolo Bonzini pbonzini@redhat.com
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index a0292ba650df..0810e93cbedc 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -1199,7 +1199,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) entry->eax = entry->ebx = entry->ecx = entry->edx = 0; } else { cpuid_entry_override(entry, CPUID_8000_001F_EAX); - + /* Clear NumVMPL since KVM does not support VMPL. */ + entry->ebx &= ~GENMASK(31, 12); /* * Enumerate '0' for "PA bits reduction", the adjusted * MAXPHYADDR is enumerated directly (see 0x80000008).
linux-stable-mirror@lists.linaro.org