Skip to content

Commit

Permalink
KVM: s390: fix signal handling
Browse files Browse the repository at this point in the history
If signal pending is true we exit without updating kvm_run, userspace
currently just does nothing and jumps to kvm_run again.
Since we did not set an exit_reason we might end up with a random one
(whatever was the last exit). Therefore it was possible to e.g. jump to
the psw position the last real interruption set.
Setting the INTR exit reason ensures that no old psw data is swapped
in on reentry.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Christian Ehrhardt authored and Avi Kivity committed Sep 10, 2009
1 parent 9ace903 commit b1d16c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/s390/kvm/kvm-s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
if (rc == SIE_INTERCEPT_RERUNVCPU)
goto rerun_vcpu;

if (signal_pending(current) && !rc)
if (signal_pending(current) && !rc) {
kvm_run->exit_reason = KVM_EXIT_INTR;
rc = -EINTR;
}

if (rc == -ENOTSUPP) {
/* intercept cannot be handled in-kernel, prepare kvm-run */
Expand Down

0 comments on commit b1d16c4

Please sign in to comment.