linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] KVM: x86/mmu: Zap invalid TDP MMU roots when unmapping
@ 2021-12-15  1:15 Sean Christopherson
  2021-12-15  1:15 ` [PATCH 1/4] KVM: x86/mmu: Use common TDP MMU zap helper for MMU notifier unmap hook Sean Christopherson
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Sean Christopherson @ 2021-12-15  1:15 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, Ben Gardon

Patches 01-03 implement a bug fix by ensuring KVM zaps both valid and
invalid roots when unmapping a gfn range (including the magic "all" range).
Failure to zap invalid roots means KVM doesn't honor the mmu_notifier's
requirement that all references are dropped.

set_nx_huge_pages() is the most blatant offender, as it doesn't elevate
mm_users and so a VM's entire mm can be released, but the same underlying
bug exists for any "unmap" command from the mmu_notifier in combination
with a memslot update.  E.g. if KVM is deleting a memslot, and a
mmu_notifier hook acquires mmu_lock while it's dropped by
kvm_mmu_zap_all_fast(), the mmu_notifier hook will see the to-be-deleted
memslot but won't zap entries from the invalid roots.

Patch 04 is cleanup to reuse the common iterator for walking _only_
invalid roots.

Sean Christopherson (4):
  KVM: x86/mmu: Use common TDP MMU zap helper for MMU notifier unmap
    hook
  KVM: x86/mmu: Move "invalid" check out of kvm_tdp_mmu_get_root()
  KVM: x86/mmu: Zap _all_ roots when unmapping gfn range in TDP MMU
  KVM: x86/mmu: Use common iterator for walking invalid TDP MMU roots

 arch/x86/kvm/mmu/tdp_mmu.c | 116 +++++++++++++++++--------------------
 arch/x86/kvm/mmu/tdp_mmu.h |   3 -
 2 files changed, 53 insertions(+), 66 deletions(-)

-- 
2.34.1.173.g76aa8bc2d0-goog


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-16  0:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15  1:15 [PATCH 0/4] KVM: x86/mmu: Zap invalid TDP MMU roots when unmapping Sean Christopherson
2021-12-15  1:15 ` [PATCH 1/4] KVM: x86/mmu: Use common TDP MMU zap helper for MMU notifier unmap hook Sean Christopherson
2021-12-15  1:15 ` [PATCH 2/4] KVM: x86/mmu: Move "invalid" check out of kvm_tdp_mmu_get_root() Sean Christopherson
2021-12-15  1:15 ` [PATCH 3/4] KVM: x86/mmu: Zap _all_ roots when unmapping gfn range in TDP MMU Sean Christopherson
2021-12-15  1:15 ` [PATCH 4/4] KVM: x86/mmu: Use common iterator for walking invalid TDP MMU roots Sean Christopherson
2021-12-15 17:20 ` [PATCH 0/4] KVM: x86/mmu: Zap invalid TDP MMU roots when unmapping Paolo Bonzini
2021-12-15 20:41   ` Sean Christopherson
2021-12-16  0:44     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).