]> git.dujemihanovic.xyz Git - linux.git/commit
KVM: x86/mmu: fix KVM_X86_QUIRK_SLOT_ZAP_ALL for shadow MMU
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 27 Sep 2024 10:25:35 +0000 (06:25 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 3 Oct 2024 22:51:13 +0000 (18:51 -0400)
commitfcd1ec9cb59c4375803c2c3c18ba7f473fe91cdc
tree802c647596b345b652e1f3593475fe3252b7208c
parent76f972c2cfdf4beba8221c94b983e10a0de797c5
KVM: x86/mmu: fix KVM_X86_QUIRK_SLOT_ZAP_ALL for shadow MMU

As was tried in commit 4e103134b862 ("KVM: x86/mmu: Zap only the relevant
pages when removing a memslot"), all shadow pages, i.e. non-leaf SPTEs,
need to be zapped.  All of the accounting for a shadow page is tied to the
memslot, i.e. the shadow page holds a reference to the memslot, for all
intents and purposes.  Deleting the memslot without removing all relevant
shadow pages, as is done when KVM_X86_QUIRK_SLOT_ZAP_ALL is disabled,
results in NULL pointer derefs when tearing down the VM.

Reintroduce from that commit the code that walks the whole memslot when
there are active shadow MMU pages.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c