s390: vfio-ap: implement VFIO_DEVICE_GET_INFO ioctl
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 46 lines · Cornelia Huck
Quoted 27 lines · On Fri, 27 Jul 2018 17:29:07 +0200 Thomas Huth <[email protected]> wrote:
Quoted 26 lines · Christian Borntraeger
From: Tony Krowiak <[email protected]>
Introduces ioctl access to the VFIO AP Matrix device driver by implementing the
VFIO_DEVICE_GET_INFOioctl. This ioctl provides the VFIO AP Matrix device driver information to the guest machine.Signed-off-by Tony Krowiak <[email protected]>Reviewed-by Pierre Morel <[email protected]>Acked-by Halil Pasic <[email protected]>Tested-by Michael Mueller <[email protected]>Tested-by Farhan Ali <[email protected]>Tested-by Pierre Morel <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- drivers/s390/crypto/vfio_ap_ops.c | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)drivers/s390/crypto/vfio_ap_ops.c +0
-0@@ -867,6 +867,48 @@ static void vfio_ap_mdev_release(struct mdev_device *mdev)module_put (THIS_MODULE ); }Quoted 16 lines
drivers/s390/crypto/vfio_ap_ops.c static void vfio_ap_mdev_release(struct mdev_device *mdev) · line 882
Quoted 13 lines
drivers/s390/crypto/vfio_ap_ops.c +13
-0+static int vfio_ap_mdev_get_device_info (unsigned long arg) +{ +unsigned long minsz; +struct vfio_device_info info; + + minsz = offsetofend(struct vfio_device_info, num_irqs); + +if (copy_from_user (&info, (void __user *)arg, minsz)) +return -EFAULT ; + +if (info.argsz < minsz) { +pr_warn ("%s: Argument size %u less than min size %li\n" , +VFIO_AP_MODULE_NAME , info.argsz, minsz);Do you really need this
pr_warnhere? The-EINVALshould give a clear indication about the problem already. (and in the worst case, a malicious userspace program could use it to flood the kernel log)
Quoted 2 lines
Agreed, that
pr_warnshould be dropped. FWIW, the other vfio drivers don't do this, either.
yes, done,
Thanks
Pierre
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/s390/crypto/vfio_ap_ops.c +9
-0+return -EINVAL ; + } + + info.flags =VFIO_DEVICE_FLAGS_AP ; + info.num_regions =0 ; + info.num_irqs =0 ; + +return copy_to_user ((void __user *)arg, &info, minsz); +}
Signature · 2 lines
Pierre Morel Linux/KVM/QEMU in B�blingen - Germany