On 2/17/20 4:00 PM, Christian Borntraeger wrote: > > > On 17.02.20 15:47, Janosch Frank wrote: >> On 2/17/20 12:08 PM, David Hildenbrand wrote: >>>> @@ -4460,6 +4489,10 @@ static long kvm_s390_guest_mem_op(struct kvm_vcpu *vcpu, >>>> >>>> switch (mop->op) { >>>> case KVM_S390_MEMOP_LOGICAL_READ: >>>> + if (kvm_s390_pv_is_protected(vcpu->kvm)) { >>>> + r = -EINVAL; >>>> + break; >>>> + } >>> >>> Could we have a possible race with disabling code, especially while >>> concurrently freeing? (sorry if I ask again, there was just a flood of >>> emails) > > see my other reply. Hopefully fixed soon.[...] > >>>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h >>>> index 207915488502..0fdee1bc3798 100644 >>>> --- a/include/uapi/linux/kvm.h >>>> +++ b/include/uapi/linux/kvm.h >>>> @@ -475,11 +475,15 @@ struct kvm_s390_mem_op { >>>> __u32 op; /* type of operation */ >>>> __u64 buf; /* buffer in userspace */ >>>> __u8 ar; /* the access register number */ >>>> - __u8 reserved[31]; /* should be set to 0 */ >>>> + __u8 reserved21[3]; /* should be set to 0 */ >>>> + __u32 sida_offset; /* offset into the sida */ >>>> + __u8 reserved28[24]; /* should be set to 0 */ >>>> }; >>> >>> As discussed, I'd prefer an overlaying layout for the sida, as the ar >>> does not make any sense (correct me if I'm wrong :) ) >> >> That wouldn't work, because we still check mop->ar < 16 in >> kvm_s390_guest_mem_op(). Also we currently check mop contents twice >> because we overload mem_op() with the SIDA operations. >> >> Using a separate IOCTL is cleaner... > > I would rather use the current patch instead of adding a new ioctl. > Well, then I'd suggest moving the normal memop ops into an own function and also move the ar check into there.