All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/8] KVM: Fix mmu_notifier vs. pfncache vs. pfncache races
@ 2022-04-29 21:00 Sean Christopherson
  2022-04-29 21:00 ` [PATCH v3 1/8] Revert "KVM: Do not speculatively mark pfn cache valid to "fix" race" Sean Christopherson
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Sean Christopherson @ 2022-04-29 21:00 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm, linux-kernel, Sean Christopherson, Lai Jiangshan,
	David Woodhouse, Mingwei Zhang

Fix races between mmu_notifier invalidation and pfncache refresh, and
within the pfncache itself.

The first two patches are reverts of the patches sitting in kvm/queue,
trying to separate and fix the races independently is nigh impossible.
I assume/hope they can be ignored and the original patches dropped.

I've proven all the races, though I was never able to trigger an actual
error in the race with the mmu_notifier, just a WARN I added on the
hva=>pfn translation being invalid/not-present when accessing memory
via the khva.  Hitting the race also required a series of handoffs in the
kernel between the two tasks, i.e. I can't provide any upstream-worthy
test :-(

v3:
  - Split the refresh serialization to a separate patch.
  - Use a mutex to serialize refrehses. [Lai Jiangshan]
  - Add back Cc to stable@ (omitted in v2 because I was less confident
    that backporting the mess would be a good idea].

v2:
  - https://lore.kernel.org/all/20220427014004.1992589-1-seanjc@google.com
  - Map the pfn=>khva outside of gpc->lock. [Maxim]
  - Fix a page leak.
  - Fix more races.

v1:
  https://lore.kernel.org/all/20220420004859.3298837-1-seanjc@google.com

Sean Christopherson (8):
  Revert "KVM: Do not speculatively mark pfn cache valid to "fix" race"
  Revert "KVM: Fix race between mmu_notifier invalidation and pfncache
    refresh"
  KVM: Drop unused @gpa param from gfn=>pfn cache's __release_gpc()
    helper
  KVM: Put the extra pfn reference when reusing a pfn in the gpc cache
  KVM: Do not incorporate page offset into gfn=>pfn cache user address
  KVM: Fully serialize gfn=>pfn cache refresh via mutex
  KVM: Fix multiple races in gfn=>pfn cache refresh
  KVM: Do not pin pages tracked by gfn=>pfn caches

 include/linux/kvm_types.h |   2 +
 virt/kvm/pfncache.c       | 180 +++++++++++++++++++++++---------------
 2 files changed, 113 insertions(+), 69 deletions(-)


base-commit: 2a39d8b39bffdaf1a4223d0d22f07baee154c8f3
-- 
2.36.0.464.gb9c8b46e94-goog


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

end of thread, other threads:[~2022-05-20 16:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 21:00 [PATCH v3 0/8] KVM: Fix mmu_notifier vs. pfncache vs. pfncache races Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 1/8] Revert "KVM: Do not speculatively mark pfn cache valid to "fix" race" Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 2/8] Revert "KVM: Fix race between mmu_notifier invalidation and pfncache refresh" Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 3/8] KVM: Drop unused @gpa param from gfn=>pfn cache's __release_gpc() helper Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 4/8] KVM: Put the extra pfn reference when reusing a pfn in the gpc cache Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 5/8] KVM: Do not incorporate page offset into gfn=>pfn cache user address Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 6/8] KVM: Fully serialize gfn=>pfn cache refresh via mutex Sean Christopherson
2022-05-20 15:24   ` Paolo Bonzini
2022-05-20 15:53     ` Sean Christopherson
2022-05-20 16:01       ` Paolo Bonzini
2022-04-29 21:00 ` [PATCH v3 7/8] KVM: Fix multiple races in gfn=>pfn cache refresh Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 8/8] KVM: Do not pin pages tracked by gfn=>pfn caches Sean Christopherson
2022-05-20 16:04 ` [PATCH v3 0/8] KVM: Fix mmu_notifier vs. pfncache vs. pfncache races Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.