Skip to content

Commit 3b77daa

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: WARN on any reserved SPTE value when making a valid SPTE
Replace make_spte()'s WARN on a collision with the magic MMIO value with a generic WARN on reserved bits being set (including EPT's reserved WX combination). Warning on any reserved bits covers MMIO, A/D tracking bits with PAE paging, and in theory any future goofs that are introduced. Opportunistically convert to ONCE behavior to avoid spamming the kernel log, odds are very good that if KVM screws up one SPTE, it will botch all SPTEs for the same MMU. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210622175739.3610207-49-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 961f844 commit 3b77daa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

arch/x86/kvm/mmu/spte.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ int make_spte(struct kvm_vcpu *vcpu, unsigned int pte_access, int level,
175175
spte = mark_spte_for_access_track(spte);
176176

177177
out:
178-
WARN_ON(is_mmio_spte(spte));
178+
WARN_ONCE(is_rsvd_spte(&vcpu->arch.mmu->shadow_zero_check, spte, level),
179+
"spte = 0x%llx, level = %d, rsvd bits = 0x%llx", spte, level,
180+
get_rsvd_bits(&vcpu->arch.mmu->shadow_zero_check, spte, level));
181+
179182
*new_spte = spte;
180183
return ret;
181184
}

0 commit comments

Comments
 (0)