linux/arch
David Woodhouse 7a36d68065 KVM: x86/xen: fix recursive deadlock in timer injection
The fast-path timer delivery introduced a recursive locking deadlock
when userspace configures a timer which has already expired and is
delivered immediately. The call to kvm_xen_inject_timer_irqs() can
call to kvm_xen_set_evtchn() which may take kvm->arch.xen.xen_lock,
which is already held in kvm_xen_vcpu_get_attr().

 ============================================
 WARNING: possible recursive locking detected
 6.8.0-smp--5e10b4d51d77-drs #232 Tainted: G           O
 --------------------------------------------
 xen_shinfo_test/250013 is trying to acquire lock:
 ffff938c9930cc30 (&kvm->arch.xen.xen_lock){+.+.}-{3:3}, at: kvm_xen_set_evtchn+0x74/0x170 [kvm]

 but task is already holding lock:
 ffff938c9930cc30 (&kvm->arch.xen.xen_lock){+.+.}-{3:3}, at: kvm_xen_vcpu_get_attr+0x38/0x250 [kvm]

Now that the gfn_to_pfn_cache has its own self-sufficient locking, its
callers no longer need to ensure serialization, so just stop taking
kvm->arch.xen.xen_lock from kvm_xen_set_evtchn().

Fixes: 77c9b9dea4 ("KVM: x86/xen: Use fast path for Xen timer delivery")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Link: https://lore.kernel.org/r/20240227115648.3104-6-dwmw2@infradead.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
2024-03-04 16:22:39 -08:00
..
alpha RTC for 6.8 2024-01-18 17:25:39 -08:00
arc IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
arm Samsung fixes for v6.8 2024-01-25 18:23:10 +01:00
arm64 KVM: define __KVM_HAVE_GUEST_DEBUG unconditionally 2024-02-08 08:41:06 -05:00
csky vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
hexagon asm-generic cleanups for 6.8 2024-01-10 18:13:44 -08:00
loongarch kvm: replace __KVM_HAVE_READONLY_MEM with Kconfig symbol 2024-02-08 08:41:06 -05:00
m68k kbuild: Replace tabs with spaces when followed by conditionals 2024-01-31 23:24:27 +09:00
microblaze Microblaze patches for 6.8-rc1 2024-01-17 11:27:23 -08:00
mips kvm: replace __KVM_HAVE_READONLY_MEM with Kconfig symbol 2024-02-08 08:41:06 -05:00
nios2 percpu: 2024-01-18 15:01:28 -08:00
openrisc
parisc parisc architecture fixes for kernel v6.8-rc3: 2024-02-01 12:32:43 -08:00
powerpc KVM: define __KVM_HAVE_GUEST_DEBUG unconditionally 2024-02-08 08:41:06 -05:00
riscv kvm: replace __KVM_HAVE_READONLY_MEM with Kconfig symbol 2024-02-08 08:41:06 -05:00
s390 KVM: s390: Refactor kvm_is_error_gpa() into kvm_is_gpa_in_memslot() 2024-02-20 07:37:45 -08:00
sh sh updates for v6.8 2024-01-20 09:24:06 -08:00
sparc sparc: Use device_get_match_data() 2024-01-19 08:08:53 -06:00
um um: Fix adding '-no-pie' for clang 2024-01-28 01:13:37 +09:00
x86 KVM: x86/xen: fix recursive deadlock in timer injection 2024-03-04 16:22:39 -08:00
xtensa percpu: 2024-01-18 15:01:28 -08:00
.gitignore
Kconfig scs: add CONFIG_MMU dependency for vfree_atomic() 2024-01-25 23:52:21 -08:00