[PATCH 2/5] kvm-s390: fix interruption casued by signal - v2

ehrhardt
2009-05-28T15:43:46Z

merged a small piece of code from patch 1/1 that belongs here themtically

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>
---

[diffstat]
kvm-s390.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

[diff]
Index: kvm/arch/s390/kvm/kvm-s390.c
===================================================================
--- kvm.orig/arch/s390/kvm/kvm-s390.c
+++ kvm/arch/s390/kvm/kvm-s390.c
@@ -509,6 +509,7 @@ rerun_vcpu:
vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
break;
case KVM_EXIT_UNKNOWN:
+ case KVM_EXIT_INTR:
case KVM_EXIT_S390_RESET:
break;
default:
@@ -525,8 +526,10 @@ rerun_vcpu:
if (rc == SIE_INTERCEPT_CHECKREQUESTS)
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 */