]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: avoid simultaneous queueing of both IRQ and SMI
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 1 Jun 2016 20:26:00 +0000 (22:26 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Fri, 3 Jun 2016 13:28:19 +0000 (15:28 +0200)
commit778783a79d8803174dfc8acd74e9d425068e3679
tree3e840308b235aa1a338ce88b21a88238a71f3c6d
parent160df1415e1ffc469e3b1a545b343b3045ecdd77
KVM: x86: avoid simultaneous queueing of both IRQ and SMI

If the processor exits to KVM while delivering an interrupt,
the hypervisor then requeues the interrupt for the next vmentry.
Trying to enter SMM in this same window causes to enter non-root
mode in emulated SMM (i.e. with IF=0) and with a request to
inject an IRQ (i.e. with a valid VM-entry interrupt info field).
This is invalid guest state (SDM 26.3.1.4 "Check on Guest RIP
and RFLAGS") and the processor fails vmentry.

The fix is to defer the injection from KVM_REQ_SMI to KVM_REQ_EVENT,
like we already do for e.g. NMIs.  This patch doesn't change the
name of the process_smi function so that it can be applied to
stable releases.  The next patch will modify the names so that
process_nmi and process_smi handle respectively KVM_REQ_NMI and
KVM_REQ_SMI.

This is especially common with Windows, probably due to the
self-IPI trick that it uses to deliver deferred procedure
calls (DPCs).

Reported-by: Laszlo Ersek <lersek@redhat.com>
Reported-by: Michał Zegan <webczat_200@poczta.onet.pl>
Fixes: 541407eab49aee056485de5237119fc46b82bf5e
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/x86.c