public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Fix handling of pending signal on uninitialized AP
@ 2017-09-05 22:27 Jan H. Schönherr
       [not found] ` <a41dda44-9d6d-100f-d900-ef8f10bd07ee@redhat.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Jan H. Schönherr @ 2017-09-05 22:27 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář; +Cc: Jan H. Schönherr, kvm

KVM API says that KVM_RUN will return with -EINTR when a signal is
pending. However, if a vCPU is in KVM_MP_STATE_UNINITIALIZED, then
the return value is unconditionally -EAGAIN.

Copy over some code from vcpu_run(), so that the case of a pending
signal results in the expected return value.

Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
---
 arch/x86/kvm/x86.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 272320e..40039cd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7203,6 +7203,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 		kvm_apic_accept_events(vcpu);
 		kvm_clear_request(KVM_REQ_UNHALT, vcpu);
 		r = -EAGAIN;
+		if (signal_pending(current)) {
+			r = -EINTR;
+			vcpu->run->exit_reason = KVM_EXIT_INTR;
+			++vcpu->stat.signal_exits;
+		}
 		goto out;
 	}
 
-- 
2.3.1.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-13 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 22:27 [PATCH] KVM: x86: Fix handling of pending signal on uninitialized AP Jan H. Schönherr
     [not found] ` <a41dda44-9d6d-100f-d900-ef8f10bd07ee@redhat.com>
2017-09-06 15:33   ` Jan H. Schönherr
2017-09-13 15:31     ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox