Skip to content

Commit c1f173f

Browse files
committed
KVM: x86/mmu: WARN if KVM attempts to map into an invalid TDP MMU root
When mapping into the TDP MMU, WARN (if KVM_PROVE_MMU=y) if the root is invalid, e.g. if KVM is attempting to insert a mapping without checking if the information and MMU context is fresh. Reviewed-by: Kai Huang <kai.huang@intel.com> Reviewed-by: Yan Zhao <yan.y.zhao@intel.com> Tested-by: Yan Zhao <yan.y.zhao@intel.com> Tested-by: Kai Huang <kai.huang@intel.com> Link: https://patch.msgid.link/20251030200951.3402865-6-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 3ab3283 commit c1f173f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,8 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
12731273
struct kvm_mmu_page *sp;
12741274
int ret = RET_PF_RETRY;
12751275

1276+
KVM_MMU_WARN_ON(!root || root->role.invalid);
1277+
12761278
kvm_mmu_hugepage_adjust(vcpu, fault);
12771279

12781280
trace_kvm_mmu_spte_requested(fault);

0 commit comments

Comments
 (0)