KVM: s390: Return error on SIDA memop on normal guest
authorJanis Schoetterl-Glausch <scgl@linux.ibm.com>
Fri, 28 Jan 2022 14:06:43 +0000 (15:06 +0100)
committerChristian Borntraeger <borntraeger@linux.ibm.com>
Wed, 2 Feb 2022 09:02:00 +0000 (10:02 +0100)
Refuse SIDA memops on guests which are not protected.
For normal guests, the secure instruction data address designation,
which determines the location we access, is not under control of KVM.

Fixes: 19e122776886 (KVM: S390: protvirt: Introduce instruction data area bounce buffer)
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
arch/s390/kvm/kvm-s390.c

index 577f1ead6a518715fa91b4372b818c2820f07a2c..2296b1ff1e0232ca3cb54e7f095834ab2addd555 100644 (file)
@@ -4667,6 +4667,8 @@ static long kvm_s390_guest_sida_op(struct kvm_vcpu *vcpu,
                return -EINVAL;
        if (mop->size + mop->sida_offset > sida_size(vcpu->arch.sie_block))
                return -E2BIG;
+       if (!kvm_s390_pv_cpu_is_protected(vcpu))
+               return -EINVAL;
 
        switch (mop->op) {
        case KVM_S390_MEMOP_SIDA_READ: