lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJHc60yak=kOQmap7Tmp=84cx7Z=h_15K_ZP9kdvxBc1h15rgg@mail.gmail.com>
Date: Fri, 31 Oct 2025 10:09:22 -0700
From: Raghavendra Rao Ananta <rananta@...gle.com>
To: liulongfang <liulongfang@...wei.com>
Cc: Jason Gunthorpe <jgg@...pe.ca>, David Matlack <dmatlack@...gle.com>, Josh Hilke <jrhilke@...gle.com>, 
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org, alex@...zbot.org
Subject: Re: [PATCH] vfio: Fix ksize arg while copying user struct in vfio_df_ioctl_bind_iommufd()

On Thu, Oct 30, 2025 at 6:34 PM liulongfang <liulongfang@...wei.com> wrote:
>
> On 2025/10/31 1:12, Raghavendra Rao Ananta wrote:
> > For the cases where user includes a non-zero value in 'token_uuid_ptr'
> > field of 'struct vfio_device_bind_iommufd', the copy_struct_from_user()
> > in vfio_df_ioctl_bind_iommufd() fails with -E2BIG. For the 'minsz' passed,
> > copy_struct_from_user() expects the newly introduced field to be zero-ed,
> > which would be incorrect in this case.
> >
> > Fix this by passing the actual size of the kernel struct. If working
> > with a newer userspace, copy_struct_from_user() would copy the
> > 'token_uuid_ptr' field, and if working with an old userspace, it would
> > zero out this field, thus still retaining backward compatibility.
> >
> > Fixes: 86624ba3b522 ("vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD")
>
> Hi Ananta,
>
> This patch also has another bug: in the hisi_acc_vfio_pci.c driver, It have two "struct vfio_device_ops"
> Only one of them, "hisi_acc_vfio_pci_ops" has match_token_uuid added,
> while the other one, "hisi_acc_vfio_pci_migrn_ops", is missing it.
> This will cause a QEMU crash (call trace) when QEMU tries to start the device.
>
> Could you please help include this fix in your patchset as well?
>
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1637,6 +1637,7 @@ static const struct vfio_device_ops hisi_acc_vfio_pci_migrn_ops = {
>         .mmap = hisi_acc_vfio_pci_mmap,
>         .request = vfio_pci_core_request,
>         .match = vfio_pci_core_match,
> +       .match_token_uuid = vfio_pci_core_match_token_uuid,
>         .bind_iommufd = vfio_iommufd_physical_bind,
>         .unbind_iommufd = vfio_iommufd_physical_unbind,
>         .attach_ioas = vfio_iommufd_physical_attach_ioas,
>
Sent as a separate patch in v2:
https://lore.kernel.org/all/20251031170603.2260022-3-rananta@google.com/
(untested).

Thank you.
Raghavendra

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ