1
linux/arch/x86/kvm/mmu
Sean Christopherson 28cf497881 KVM: x86/mmu: Add lockdep assert to enforce safe usage of kvm_unmap_gfn_range()
Add a lockdep assertion in kvm_unmap_gfn_range() to ensure that either
mmu_invalidate_in_progress is elevated, or that the range is being zapped
due to memslot removal (loosely detected by slots_lock being held).
Zapping SPTEs without mmu_invalidate_{in_progress,seq} protection is unsafe
as KVM's page fault path snapshots state before acquiring mmu_lock, and
thus can create SPTEs with stale information if vCPUs aren't forced to
retry faults (due to seeing an in-progress or past MMU invalidation).

Memslot removal is a special case, as the memslot is retrieved outside of
mmu_invalidate_seq, i.e. doesn't use the "standard" protections, and
instead relies on SRCU synchronization to ensure any in-flight page faults
are fully resolved before zapping SPTEs.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20241009192345.1148353-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-10-20 07:31:05 -04:00
..
mmu_internal.h Merge tag 'kvm-x86-mmu-6.12' of https://github.com/kvm-x86/linux into HEAD 2024-09-17 12:39:53 -04:00
mmu.c KVM: x86/mmu: Add lockdep assert to enforce safe usage of kvm_unmap_gfn_range() 2024-10-20 07:31:05 -04:00
mmutrace.h KVM: x86/mmu: Trigger unprotect logic only on write-protection page faults 2024-09-09 20:16:19 -07:00
page_track.c KVM: Use vfree for memory allocated by vcalloc()/__vcalloc() 2024-04-09 12:18:38 -07:00
page_track.h
paging_tmpl.h KVM: x86/mmu: Trigger unprotect logic only on write-protection page faults 2024-09-09 20:16:19 -07:00
spte.c KVM: x86/mmu: Fixup comments missed by the REMOVED_SPTE=>FROZEN_SPTE rename 2024-08-22 11:25:31 -07:00
spte.h KVM: x86/mmu: Fixup comments missed by the REMOVED_SPTE=>FROZEN_SPTE rename 2024-08-22 11:25:31 -07:00
tdp_iter.c
tdp_iter.h KVM: x86/mmu: Add sanity checks that KVM doesn't create EPT #VE SPTEs 2024-05-23 12:27:26 -04:00
tdp_mmu.c Merge tag 'kvm-x86-mmu-6.12' of https://github.com/kvm-x86/linux into HEAD 2024-09-17 12:39:53 -04:00
tdp_mmu.h KVM: x86/tdp_mmu: Take a GFN in kvm_tdp_mmu_fast_pf_get_last_sptep() 2024-06-20 18:43:31 -04:00