KVM: s390: Send program check on access error
authorCarsten Otte <cotte@de.ibm.com>
Wed, 21 May 2008 11:37:40 +0000 (13:37 +0200)
committerAvi Kivity <avi@qumranet.com>
Fri, 6 Jun 2008 18:08:26 +0000 (21:08 +0300)
If the guest accesses non-existing memory, the sie64a function returns
-EFAULT. We must check the return value and send a program check to the
guest if the sie instruction faulted, otherwise the guest will loop at
the faulting code.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/s390/kvm/kvm-s390.c

index ded27c7777cc436a6d3c7e3e06faec7a4de09250..6558b09ff579fa9ae3fe11de2191f783525adff1 100644 (file)
@@ -443,7 +443,10 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
        local_irq_enable();
        VCPU_EVENT(vcpu, 6, "entering sie flags %x",
                   atomic_read(&vcpu->arch.sie_block->cpuflags));
-       sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs);
+       if (sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs)) {
+               VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
+               kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
+       }
        VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
                   vcpu->arch.sie_block->icptcode);
        local_irq_disable();