Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f173d26 authored by Jan H. Schönherr's avatar Jan H. Schönherr Committed by Radim Krčmář
Browse files

KVM: x86: Fix immediate_exit handling for uninitialized AP



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: 460df4c1 ("KVM: race-free exit from KVM_RUN without POSIX signals")
Signed-off-by: default avatarJan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent a0595000
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -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);
		sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);


	if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
	if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
		if (kvm_run->immediate_exit) {
			r = -EINTR;
			goto out;
		}
		kvm_vcpu_block(vcpu);
		kvm_vcpu_block(vcpu);
		kvm_apic_accept_events(vcpu);
		kvm_apic_accept_events(vcpu);
		kvm_clear_request(KVM_REQ_UNHALT, vcpu);
		kvm_clear_request(KVM_REQ_UNHALT, vcpu);