From: David Hildenbrand <david@redhat.com>
To: "Dmitry Vyukov" <dvyukov@google.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Cc: KVM list <kvm@vger.kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
stable <stable@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>
Subject: Re: [PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM
Date: Thu, 23 Mar 2017 11:23:54 +0100 [thread overview]
Message-ID: <1f21bbc9-baf3-723d-a140-1afecaa857e3@redhat.com> (raw)
In-Reply-To: <CACT4Y+Yh+NnuNmTar4qjcMCbB0w+vG8=Q2zxAArgiGApyawAQA@mail.gmail.com>
> This program still triggers the warning in kvm_apic_accept_events with
> the patch applied (on top of
> 093b995e3b55a0ae0670226ddfcb05bfbf0099ae):
>
> https://gist.githubusercontent.com/dvyukov/2a39303347aa417aea2afd9fd99b7086/raw/09693aa7ed78d22b23948c726767f540b2276a99/gistfile1.txt
>
> ------------[ cut here ]------------
> WARNING: CPU: 3 PID: 2964 at arch/x86/kvm/lapic.c:2461
> kvm_apic_accept_events+0x46c/0x550 arch/x86/kvm/lapic.c:2461
> CPU: 3 PID: 2964 Comm: a.out Not tainted 4.11.0-rc3+ #365
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:16 [inline]
> dump_stack+0x1b8/0x28d lib/dump_stack.c:52
> panic+0x20c/0x423 kernel/panic.c:180
> __warn+0x1c4/0x1e0 kernel/panic.c:541
> warn_slowpath_null+0x2c/0x40 kernel/panic.c:584
> kvm_apic_accept_events+0x46c/0x550 arch/x86/kvm/lapic.c:2461
> vcpu_block arch/x86/kvm/x86.c:7010 [inline]
> vcpu_run arch/x86/kvm/x86.c:7048 [inline]
> kvm_arch_vcpu_ioctl_run+0xefc/0x59e0 arch/x86/kvm/x86.c:7207
> kvm_vcpu_ioctl+0x627/0x1100 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2573
> vfs_ioctl fs/ioctl.c:45 [inline]
> do_vfs_ioctl+0x1af/0x16d0 fs/ioctl.c:685
> SYSC_ioctl fs/ioctl.c:700 [inline]
> SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
> entry_SYSCALL_64_fastpath+0x1f/0xc2
> RIP: 0033:0x447109
> RSP: 002b:00007ffcb458a038 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00000000004002b0 RCX: 0000000000447109
> RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
> RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
> R13: 00000000004073f0 R14: 0000000000407480 R15: 0000000000000000
>
I think we're seeing what Radim describes. So this is now a different
call order.
The VCPU is set to KVM_MP_STATE_SIPI_RECEIVED (which results in
KVM_MP_STATE_INIT_RECEIVED). Then, KVM_SET_VCPU_EVENTS
is set with KVM_VCPUEVENT_VALID_SMM | KVM_VCPUEVENT_VALID_NMI_PENDING,
enabling SMM.
Calling kvm_apic_accept_events() then will result in a warning on the
next VCPU run.
So the right thing is indeed adding an additional checks for
KVM_SET_VCPU_EVENTS.
--
Thanks,
David
prev parent reply other threads:[~2017-03-23 10:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 15:53 David Hildenbrand
2017-03-22 16:49 ` Radim Krčmář
2017-03-23 9:49 ` Dmitry Vyukov
2017-03-23 10:23 ` David Hildenbrand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f21bbc9-baf3-723d-a140-1afecaa857e3@redhat.com \
--to=david@redhat.com \
--cc=dvyukov@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=stable@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®