[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251030183120.GD1204670@ziepe.ca>
Date: Thu, 30 Oct 2025 15:31:20 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Raghavendra Rao Ananta <rananta@...gle.com>
Cc: Alex Williamson <alex.williamson@...hat.com>,
	David Matlack <dmatlack@...gle.com>,
	Josh Hilke <jrhilke@...gle.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vfio: Fix ksize arg while copying user struct in
 vfio_df_ioctl_bind_iommufd()
On Thu, Oct 30, 2025 at 05:12:38PM +0000, 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")
> Signed-off-by: Raghavendra Rao Ananta <rananta@...gle.com>
> ---
>  drivers/vfio/device_cdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
Cc: stable@...r.kernel.org
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Though I feel this was copied from some other spot in vfio so I wonder
if we have a larger set of things that are a little off..
Jason
Powered by blists - more mailing lists
 
