Skip to content

Commit 0a28e06

Browse files
author
Claudio Imbrenda
committed
KVM: s390: Fix KVM_S390_VCPU_FAULT ioctl
A previous commit changed the behaviour of the KVM_S390_VCPU_FAULT ioctl. The current (wrong) implementation will trigger a guest addressing exception if the requested address lies outside of a memslot, unless the VM is UCONTROL. Restore the previous behaviour by open coding the fault-in logic. Fixes: 3762e90 ("KVM: s390: use __kvm_faultin_pfn()") Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
1 parent a12cc7e commit 0a28e06

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

arch/s390/kvm/kvm-s390.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5520,9 +5520,21 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
55205520
}
55215521
#endif
55225522
case KVM_S390_VCPU_FAULT: {
5523-
idx = srcu_read_lock(&vcpu->kvm->srcu);
5524-
r = vcpu_dat_fault_handler(vcpu, arg, 0);
5525-
srcu_read_unlock(&vcpu->kvm->srcu, idx);
5523+
gpa_t gaddr = arg;
5524+
5525+
scoped_guard(srcu, &vcpu->kvm->srcu) {
5526+
r = vcpu_ucontrol_translate(vcpu, &gaddr);
5527+
if (r)
5528+
break;
5529+
5530+
r = kvm_s390_faultin_gfn_simple(vcpu, NULL, gpa_to_gfn(gaddr), false);
5531+
if (r == PGM_ADDRESSING)
5532+
r = -EFAULT;
5533+
if (r <= 0)
5534+
break;
5535+
r = -EIO;
5536+
KVM_BUG_ON(r, vcpu->kvm);
5537+
}
55265538
break;
55275539
}
55285540
case KVM_ENABLE_CAP:

0 commit comments

Comments
 (0)