Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1606753
| From | Radim Krčmář <rkrcmar@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM |
| Date | 2017-03-22 18:00 +0100 |
| Message-ID | <tnRM6-5ys-17@gated-at.bofh.it> (permalink) |
| References | <tnQQ2-4OP-45@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
2017-03-22 16:53+0100, David Hildenbrand:
> 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@vger.kernel.org # 4.2+
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> 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) &&
I think that userspace can still set the mpstate first and then enter
SMM with KVM_SET_VCPU_EVENTS, which would result in the same warning ...
Don't we need a similar check in kvm_vcpu_ioctl_x86_set_vcpu_events()?
Thanks.
> + (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
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM David Hildenbrand <david@redhat.com> - 2017-03-22 17:00 +0100
Re: [PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM Radim Krčmář <rkrcmar@redhat.com> - 2017-03-22 18:00 +0100
Re: [PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM Dmitry Vyukov <dvyukov@google.com> - 2017-03-23 11:00 +0100
Re: [PATCH v1] KVM: x86: fix illegal MP_STATE when in/entering SMM David Hildenbrand <david@redhat.com> - 2017-03-23 11:30 +0100
csiph-web