]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86/mmu: Check for !leaf=>leaf, not PFN change, in TDP MMU SP removal
authorSean Christopherson <seanjc@google.com>
Sat, 26 Feb 2022 00:15:25 +0000 (00:15 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 2 Mar 2022 17:58:23 +0000 (12:58 -0500)
commitbb691d2561eb9c315334f29b7a4ba69bf38f9809
tree989b2ba3b523a3620661a597155e6ff8174e1ea7
parent3681e1a118db16166148402a98bd84f2c661a282
KVM: x86/mmu: Check for !leaf=>leaf, not PFN change, in TDP MMU SP removal

Look for a !leaf=>leaf conversion instead of a PFN change when checking
if a SPTE change removed a TDP MMU shadow page.  Convert the PFN check
into a WARN, as KVM should never change the PFN of a shadow page (except
when its being zapped or replaced).

From a purely theoretical perspective, it's not illegal to replace a SP
with a hugepage pointing at the same PFN.  In practice, it's impossible
as that would require mapping guest memory overtop a kernel-allocated SP.
Either way, the check is odd.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220226001546.360188-8-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c