]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
KVM: x86: Fix immediate_exit handling for uninitialized AP
authorJan H. Schönherr <jschoenh@amazon.de>
Wed, 6 Sep 2017 16:34:06 +0000 (18:34 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Wed, 13 Sep 2017 14:40:24 +0000 (16:40 +0200)
When user space sets kvm_run->immediate_exit, KVM is supposed to
return quickly. However, when a vCPU is in KVM_MP_STATE_UNINITIALIZED,
the value is not considered and the vCPU blocks.

Fix that oversight.

Fixes: 460df4c1fc7c008 ("KVM: race-free exit from KVM_RUN without POSIX signals")
Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/x86.c

index b27f7f0020e3f7f9269f6563682b4e866078da40..c777a8f681a87cb670acbca748d2ae2aad62baf2 100644 (file)
@@ -7231,6 +7231,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
 
        if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
+               if (kvm_run->immediate_exit) {
+                       r = -EINTR;
+                       goto out;
+               }
                kvm_vcpu_block(vcpu);
                kvm_apic_accept_events(vcpu);
                kvm_clear_request(KVM_REQ_UNHALT, vcpu);