• Paolo Bonzini's avatar
    KVM: x86/mmu: fix KVM_X86_QUIRK_SLOT_ZAP_ALL for shadow MMU · fcd1ec9c
    Paolo Bonzini authored
    As was tried in commit 4e103134 ("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: default avatarPaolo Bonzini <pbonzini@redhat.com>
    fcd1ec9c
mmu.c 218 KB