linux-stable/include
Sean Christopherson ca4efed095 KVM: Fully serialize gfn=>pfn cache refresh via mutex
commit 93984f19e7 upstream.

Protect gfn=>pfn cache refresh with a mutex to fully serialize refreshes.
The refresh logic doesn't protect against

- concurrent unmaps, or refreshes with different GPAs (which may or may not
  happen in practice, for example if a cache is only used under vcpu->mutex;
  but it's allowed in the code)

- a false negative on the memslot generation.  If the first refresh sees
  a stale memslot generation, it will refresh the hva and generation before
  moving on to the hva=>pfn translation.  If it then drops gpc->lock, a
  different user of the cache can come along, acquire gpc->lock, see that
  the memslot generation is fresh, and skip the hva=>pfn update due to the
  userspace address also matching (because it too was updated).

The refresh path can already sleep during hva=>pfn resolution, so wrap
the refresh with a mutex to ensure that any given refresh runs to
completion before other callers can start their refresh.

Cc: stable@vger.kernel.org
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220429210025.3293691-7-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-17 15:13:43 +02:00
..
acpi ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported 2022-07-05 20:36:11 +02:00
asm-generic asm-generic fixes for 5.19, part 2 2022-07-27 09:50:18 -07:00
clocksource pwm: Changes for v5.19-rc1 2022-06-01 10:49:11 -07:00
crypto
drm drm/scheduler: Don't kill jobs in interrupt context 2022-07-15 10:09:15 -04:00
dt-bindings Char / Misc / Other smaller driver subsystem updates for 5.19-rc1 2022-06-03 11:36:34 -07:00
keys certs: Move load_certificate_list() to be with the asymmetric keys code 2022-06-21 16:05:06 +01:00
kunit
kvm
linux KVM: Fully serialize gfn=>pfn cache refresh via mutex 2022-08-17 15:13:43 +02:00
math-emu
media
memory
misc
net ipv6/addrconf: fix a null-ptr-deref bug for ip6_ptr 2022-07-28 10:42:44 -07:00
pcmcia
ras
rdma
scsi
soc
sound ASoC: Remove unused hw_write_t type 2022-06-24 16:21:41 +01:00
target
trace Including fixes from netfilter, bpf and wireless. 2022-07-14 12:48:07 -07:00
uapi asm-generic fixes for 5.19, part 2 2022-07-27 09:50:18 -07:00
ufs
vdso
video video: of_display_timing.h: include errno.h 2022-07-06 17:16:20 +02:00
xen arm/xen: Assign xen-grant DMA ops for xen-grant DMA devices 2022-06-06 16:07:30 +02:00