[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251007114808.GB3441843@ziepe.ca>
Date: Tue, 7 Oct 2025 08:48:08 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Alejandro Jimenez <alejandro.j.jimenez@...cle.com>
Cc: Alex Mastro <amastro@...com>,
Alex Williamson <alex.williamson@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vfio: fix VFIO_IOMMU_UNMAP_DMA when end of range would
overflow u64
On Mon, Oct 06, 2025 at 09:23:56PM -0400, Alejandro Jimenez wrote:
> I mentioned this issue on the cover letter for:
> https://lore.kernel.org/qemu-devel/20250919213515.917111-1-alejandro.j.jimenez@oracle.com/
Use iommufd for this kind of work?
> I mentioned in the notes for the patch above why I chose a slightly more
> complex method than the '- 1' approach, since there is a chance that
> iova+size could also go beyond the end of the address space and actually
> wrap around.
At the uapi boundary it should check that size != 0 and
!check_add_overflow(iova+size). It is much easier to understand if the
input from userspace is validated immediately at userspace.
Then the rest of the code safely computes the last with 'iova+size-1'
and does range logic based on last not end.
Jason
Powered by blists - more mailing lists