linux/arch/x86/kvm/mmu
Junaid Shahid b64d740ea7 kvm: x86: mmu: Always flush TLBs when enabling dirty logging
When A/D bits are not available, KVM uses a software access tracking
mechanism, which involves making the SPTEs inaccessible. However,
the clear_young() MMU notifier does not flush TLBs. So it is possible
that there may still be stale, potentially writable, TLB entries.
This is usually fine, but can be problematic when enabling dirty
logging, because it currently only does a TLB flush if any SPTEs were
modified. But if all SPTEs are in access-tracked state, then there
won't be a TLB flush, which means that the guest could still possibly
write to memory and not have it reflected in the dirty bitmap.

So just unconditionally flush the TLBs when enabling dirty logging.
As an alternative, KVM could explicitly check the MMU-Writable bit when
write-protecting SPTEs to decide if a flush is needed (instead of
checking the Writable bit), but given that a flush almost always happens
anyway, so just making it unconditional seems simpler.

Signed-off-by: Junaid Shahid <junaids@google.com>
Message-Id: <20220810224939.2611160-1-junaids@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-08-19 07:38:03 -04:00
..
mmu_internal.h KVM: x86/mmu: Don't require refcounted "struct page" to create huge SPTEs 2022-07-28 13:22:22 -04:00
mmu.c kvm: x86: mmu: Always flush TLBs when enabling dirty logging 2022-08-19 07:38:03 -04:00
mmutrace.h KVM: x86/mmu: Add RET_PF_CONTINUE to eliminate bool+int* "returns" 2022-05-12 09:51:42 -04:00
page_track.c KVM: use __vcalloc for very large allocations 2022-03-08 09:30:57 -05:00
paging_tmpl.h KVM: Rename mmu_notifier_* to mmu_invalidate_* 2022-08-19 04:05:41 -04:00
spte.c KVM: x86/mmu: Add sanity check that MMIO SPTE mask doesn't overlap gen 2022-08-10 15:08:26 -04:00
spte.h kvm: x86: mmu: Always flush TLBs when enabling dirty logging 2022-08-19 07:38:03 -04:00
tdp_iter.c KVM: x86/mmu: Don't bottom out on leafs when zapping collapsible SPTEs 2022-07-28 13:22:24 -04:00
tdp_iter.h KVM: x86/mmu: Don't bottom out on leafs when zapping collapsible SPTEs 2022-07-28 13:22:24 -04:00
tdp_mmu.c KVM, x86/mmu: Fix the comment around kvm_tdp_mmu_zap_leafs() 2022-07-28 14:02:07 -04:00
tdp_mmu.h KVM: x86/mmu: Zap only TDP MMU leafs in zap range and mmu_notifier unmap 2022-04-02 05:34:39 -04:00