Skip to content

Commit 988da78

Browse files
yanzhao56sean-jc
authored andcommitted
KVM: x86/tdp_mmu: WARN if PFN changes for spurious faults
Add a WARN() to assert that KVM does _not_ change the PFN of a shadow-present SPTE during spurious fault handling. KVM should _never_ change the PFN of a shadow-present SPTE and TDP MMU already BUG()s on this. However, spurious faults just return early before the existing BUG() could be hit. Suggested-by: Sean Christopherson <[email protected]> Signed-off-by: Yan Zhao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent d17cc13 commit 988da78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,10 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu,
11551155

11561156
if (is_shadow_present_pte(iter->old_spte) &&
11571157
(fault->prefetch || is_access_allowed(fault, iter->old_spte)) &&
1158-
is_last_spte(iter->old_spte, iter->level))
1158+
is_last_spte(iter->old_spte, iter->level)) {
1159+
WARN_ON_ONCE(fault->pfn != spte_to_pfn(iter->old_spte));
11591160
return RET_PF_SPURIOUS;
1161+
}
11601162

11611163
if (unlikely(!fault->slot))
11621164
new_spte = make_mmio_spte(vcpu, iter->gfn, ACC_ALL);

0 commit comments

Comments
 (0)