android_kernel_oneplus_msm8998/virt/kvm
Lan Tianyu 49e065f504 KVM/Eventfd: Avoid crash when assign and deassign specific eventfd in parallel.
commit b5020a8e6b54d2ece80b1e7dedb33c79a40ebd47 upstream.

Syzbot reports crashes in kvm_irqfd_assign(), caused by use-after-free
when kvm_irqfd_assign() and kvm_irqfd_deassign() run in parallel
for one specific eventfd. When the assign path hasn't finished but irqfd
has been added to kvm->irqfds.items list, another thead may deassign the
eventfd and free struct kvm_kernel_irqfd(). The assign path then uses
the struct kvm_kernel_irqfd that has been freed by deassign path. To avoid
such issue, keep irqfd under kvm->irq_srcu protection after the irqfd
has been added to kvm->irqfds.items list, and call synchronize_srcu()
in irq_shutdown() to make sure that irqfd has been fully initialized in
the assign path.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Tianyu Lan <tianyu.lan@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-25 10:18:15 +02:00
..
arm KVM: arm/arm64: Fix occasional warning from the timer work function 2017-12-09 18:42:42 +01:00
async_pf.c
async_pf.h
coalesced_mmio.c
coalesced_mmio.h
eventfd.c KVM/Eventfd: Avoid crash when assign and deassign specific eventfd in parallel. 2018-07-25 10:18:15 +02:00
irqchip.c
Kconfig
kvm_main.c KVM: mmu: Fix overlap between public and private memslots 2018-03-11 16:19:45 +01:00
vfio.c vfio: New external user group/file match 2017-07-27 15:06:07 -07:00
vfio.h