From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbdBOJ0k (ORCPT ); Wed, 15 Feb 2017 04:26:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37236 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbdBOJ0i (ORCPT ); Wed, 15 Feb 2017 04:26:38 -0500 Subject: Re: kvm: WARNING In kvm_apic_accept_events To: Dmitry Vyukov , Paolo Bonzini References: <1516d642-081c-c5f5-e3ea-083fcd47011a@redhat.com> <04b94434-50af-766d-0248-e999bdf80655@redhat.com> Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "x86@kernel.org" , KVM list , LKML , Steve Rutherford , syzkaller From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <04a86494-a032-83d9-b9f2-abd4e0c57f08@redhat.com> Date: Wed, 15 Feb 2017 10:26:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 15 Feb 2017 09:26:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> From: David Hildenbrand >>> Date: Mon, 23 Jan 2017 16:42:23 +0100 >>> Subject: [PATCH] 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") >>> Reported-by: Dmitry Vyukov >>> Signed-off-by: David Hildenbrand >>> --- >>> 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 57d8a85..06ffc91 100644 >>> --- a/arch/x86/kvm/x86.c >>> +++ b/arch/x86/kvm/x86.c >>> @@ -7247,6 +7247,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); >>> >> >> Looks good, thanks for analyzing it. I'll try making a minimal testcase... > > > Any progress with this? Should we commit this as is? > Paolo, should I resend as a proper notcopieddiff mail? -- Thanks, David