Skip to content

Commit

Permalink
KVM: s390: Avoid endless loops of specification exceptions
Browse files Browse the repository at this point in the history
If the new PSW for program interrupts is invalid, the VM ends up
in an endless loop of specification exceptions. Since there is not
much left we can do in this case, we should better drop to userspace
instead so that the crash can be reported to the user.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
  • Loading branch information
Thomas Huth authored and Christian Borntraeger committed May 16, 2014
1 parent a3fb577 commit 684135e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/s390/kvm/intercept.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static int handle_itdb(struct kvm_vcpu *vcpu)
static int handle_prog(struct kvm_vcpu *vcpu)
{
struct kvm_s390_pgm_info pgm_info;
psw_t psw;
int rc;

vcpu->stat.exit_program_interruption++;
Expand All @@ -207,7 +208,14 @@ static int handle_prog(struct kvm_vcpu *vcpu)
}

trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc);

if (vcpu->arch.sie_block->iprcc == PGM_SPECIFICATION) {
rc = read_guest_lc(vcpu, __LC_PGM_NEW_PSW, &psw, sizeof(psw_t));
if (rc)
return rc;
/* Avoid endless loops of specification exceptions */
if (!is_valid_psw(&psw))
return -EOPNOTSUPP;
}
rc = handle_itdb(vcpu);
if (rc)
return rc;
Expand Down

0 comments on commit 684135e

Please sign in to comment.