1
linux/arch/x86/kvm
Marcelo Tosatti e9571ed54b KVM: fix kvm_vcpu_kick vs __vcpu_run race
There is a window open between testing of pending IRQ's
and assignment of guest_mode in __vcpu_run.

Injection of IRQ's can race with __vcpu_run as follows:

CPU0                                CPU1
kvm_x86_ops->run()
vcpu->guest_mode = 0                SET_IRQ_LINE ioctl
..
kvm_x86_ops->inject_pending_irq
kvm_cpu_has_interrupt()

                                    apic_test_and_set_irr()
                                    kvm_vcpu_kick
                                    if (vcpu->guest_mode)
                                        send_ipi()

vcpu->guest_mode = 1

So move guest_mode=1 assignment before ->inject_pending_irq, and make
sure that it won't reorder after it.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-04-27 18:21:32 +03:00
..
i8254.c KVM: Rename VCPU_MP_STATE_* to KVM_MP_STATE_* 2008-04-27 12:04:13 +03:00
i8254.h KVM: Add reset support for in kernel PIT 2008-04-27 12:00:23 +03:00
i8259.c
irq.c KVM: hlt emulation should take in-kernel APIC/PIT timers into account 2008-04-27 12:04:11 +03:00
irq.h KVM: hlt emulation should take in-kernel APIC/PIT timers into account 2008-04-27 12:04:11 +03:00
Kconfig KVM: Add kvm trace userspace interface 2008-04-27 12:01:22 +03:00
kvm_svm.h KVM: SVM: allocate the MSR permission map per VCPU 2008-04-27 11:53:21 +03:00
lapic.c KVM: Rename VCPU_MP_STATE_* to KVM_MP_STATE_* 2008-04-27 12:04:13 +03:00
lapic.h KVM: Accelerated apic support 2008-01-30 18:01:20 +02:00
Makefile KVM: Add kvm trace userspace interface 2008-04-27 12:01:22 +03:00
mmu.c KVM: MMU: Don't assume struct page for x86 2008-04-27 12:01:15 +03:00
mmu.h KVM: MMU: add TDP support to the KVM MMU 2008-04-27 11:53:20 +03:00
paging_tmpl.h KVM: MMU: Don't assume struct page for x86 2008-04-27 12:01:15 +03:00
svm.c KVM: SVM: do not intercept task switch with NPT 2008-04-27 12:01:23 +03:00
svm.h KVM: x86: hardware task switching support 2008-04-27 12:00:39 +03:00
tss.h KVM: x86: hardware task switching support 2008-04-27 12:00:39 +03:00
vmx.c KVM: Add trace markers 2008-04-27 12:01:19 +03:00
vmx.h KVM: VMX: fix typo in VMX header define 2008-04-27 11:53:21 +03:00
x86_emulate.c KVM: x86 emulator: fix sparse warnings in x86_emulate.c 2008-04-27 11:53:24 +03:00
x86.c KVM: fix kvm_vcpu_kick vs __vcpu_run race 2008-04-27 18:21:32 +03:00