[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170322155354.18436-1-david@redhat.com>
Date: Wed, 22 Mar 2017 16:53:54 +0100
From: David Hildenbrand <david@...hat.com>
To: kvm@...r.kernel.org
Cc: Paolo Bonzini <pbonzini@...hat.com>, rkrcmar@...hat.com,
Dmitry Vyukov <dvyukov@...gle.com>, stable@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>, david@...hat.com
Subject: [PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM
If we already entered/are about to enter SMM, don't allow
switching to INIT/SIPI_RECEIVED, otherwise the next call to
kvm_apic_accept_events() will report a warning.
Fixes: cd7764fe9f73 ("KVM: x86: latch INITs while in system management mode")
Cc: stable@...r.kernel.org # 4.2+
Reported-by: Dmitry Vyukov <dvyukov@...gle.com>
Signed-off-by: David Hildenbrand <david@...hat.com>
---
arch/x86/kvm/x86.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1faf620..7d0ec1b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7355,6 +7355,12 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
mp_state->mp_state != KVM_MP_STATE_RUNNABLE)
return -EINVAL;
+ /* INITs are latched while in SMM */
+ if ((is_smm(vcpu) || vcpu->arch.smi_pending) &&
+ (mp_state->mp_state == KVM_MP_STATE_SIPI_RECEIVED ||
+ mp_state->mp_state == KVM_MP_STATE_INIT_RECEIVED))
+ return -EINVAL;
+
if (mp_state->mp_state == KVM_MP_STATE_SIPI_RECEIVED) {
vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED;
set_bit(KVM_APIC_SIPI, &vcpu->arch.apic->pending_events);
--
2.9.3
Powered by blists - more mailing lists