[PATCH v2 0/2] KVM: VMX: Explicitly track TDX VMs' root level

Sean Christopherson posted 2 patches 1 month ago
There is a newer version of this series
arch/x86/include/asm/kvm_host.h |  1 +
arch/x86/kvm/cpuid.c            | 14 --------------
arch/x86/kvm/cpuid.h            |  1 -
arch/x86/kvm/mmu/mmu.c          | 19 +++++++++++--------
arch/x86/kvm/vmx/tdx.c          | 20 +++++++++++---------
5 files changed, 23 insertions(+), 32 deletions(-)
[PATCH v2 0/2] KVM: VMX: Explicitly track TDX VMs' root level
Posted by Sean Christopherson 1 month ago
Fix a bug where a misbehaving (or niave?) userspace can configure guest CPUID
such that KVM will use the "wrong" root level for its mirror EPTs and trip the
KVM_BUG_ON() in tdx_load_mmu_pgd().

v2:
 - Rewrite the comment in kvm_mmu_get_tdp_level(). [Rick]
 - Check for kvm_has_mirrored_tdp() in kvm_mmu_get_tdp_level(), and yell if
   arch.mirror_root_level isn't also set. [Rick]
 - Separate the removal of TDX_SHARED_BIT_PWL_{4,5} from the bug fix. [Rick]
 - Fix a buring => buried typo. [Binbin]
 - Collect Tested/Reviewed-by. [Binbin, Rick, Yan] (I applied 'em only to
   patch 1, please  holler if that doesn't seem right).

v1: https://lore.kernel.org/all/20260814224509.2342760-1-seanjc@google.com

Sean Christopherson (2):
  KVM: VMX: Explicitly track TDX VMs' root level instead of guessing it
    from CPUID
  KVM: VMX: Drop TDX_SHARED_BIT_PWL_{4,5} and dedup related code

 arch/x86/include/asm/kvm_host.h |  1 +
 arch/x86/kvm/cpuid.c            | 14 --------------
 arch/x86/kvm/cpuid.h            |  1 -
 arch/x86/kvm/mmu/mmu.c          | 19 +++++++++++--------
 arch/x86/kvm/vmx/tdx.c          | 20 +++++++++++---------
 5 files changed, 23 insertions(+), 32 deletions(-)


base-commit: 76671054f9a1ff6abb976583cd8da37650acdc97
-- 
2.55.0.887.g758fc8c411-goog