On Wed, 26 Feb 2020 14:31:36 +0100 Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote: > On 26.02.20 13:26, Cornelia Huck wrote: > > On Tue, 25 Feb 2020 16:48:22 -0500 > > Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote: > > > >> From: Janosch Frank <frankja@xxxxxxxxxxxxx> > >> > >> This contains 3 main changes: > >> 1. changes in SIE control block handling for secure guests > >> 2. helper functions for create/destroy/unpack secure guests > >> 3. KVM_S390_PV_COMMAND ioctl to allow userspace dealing with secure > >> machines > >> > >> Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx> > >> [borntraeger@xxxxxxxxxx: patch merging, splitting, fixing] > >> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> > >> --- > >> arch/s390/include/asm/kvm_host.h | 24 ++- > >> arch/s390/include/asm/uv.h | 69 ++++++++ > >> arch/s390/kvm/Makefile | 2 +- > >> arch/s390/kvm/kvm-s390.c | 209 +++++++++++++++++++++++- > >> arch/s390/kvm/kvm-s390.h | 33 ++++ > >> arch/s390/kvm/pv.c | 269 +++++++++++++++++++++++++++++++ > >> include/uapi/linux/kvm.h | 31 ++++ > >> 7 files changed, 633 insertions(+), 4 deletions(-) > >> create mode 100644 arch/s390/kvm/pv.c > >> @@ -2262,6 +2419,27 @@ long kvm_arch_vm_ioctl(struct file *filp, > >> mutex_unlock(&kvm->slots_lock); > >> break; > >> } > >> + case KVM_S390_PV_COMMAND: { > >> + struct kvm_pv_cmd args; > >> + > >> + r = 0; > >> + if (!is_prot_virt_host()) { > >> + r = -EINVAL; > >> + break; > >> + } > >> + if (copy_from_user(&args, argp, sizeof(args))) { > >> + r = -EFAULT; > >> + break; > >> + } > > > > The api states that args.flags must be 0... better enforce that? > > > yes > @@ -2431,6 +2431,10 @@ long kvm_arch_vm_ioctl(struct file *filp, > r = -EFAULT; > break; > } > + if (args.flags) { > + r = -EINVAL; > + break; > + } > mutex_lock(&kvm->lock); > r = kvm_s390_handle_pv(kvm, &args); > mutex_unlock(&kvm->lock); Looks good.