Re: [PATCH] KVM: x86: Fix immediate_exit handling for uninitialized AP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2017-09-06 18:34+0200, Jan H. Schönherr:
> 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@xxxxxxxxx>
> ---
> compile-time tested only
> ---
>  arch/x86/kvm/x86.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 40039cd..a69a948 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7199,6 +7199,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);

Without immediate_exit, we would also execute the following code, but I
think it's ok not to ... queued, thanks.

>  		kvm_apic_accept_events(vcpu);
>  		kvm_clear_request(KVM_REQ_UNHALT, vcpu);
> -- 
> 2.3.1.dirty
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux