RE: [PATCH v2 13/22] iommufd: Add mmap interface

From: Tian, Kevin
Date: Thu May 08 2025 - 05:16:32 EST


> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Thursday, May 8, 2025 11:50 AM
>
> On Wed, May 07, 2025 at 07:08:09PM -0300, Jason Gunthorpe wrote:
> > On Wed, May 07, 2025 at 02:09:31PM -0700, Nicolin Chen wrote:
> > > I have another question: while I don't think my code is handling
> > > this well either, how should we validate the input address is an
> > > allowed one?
> >
> > The pgoff to mmap? If it isn't in the maple tree it is not allowed, if
> > it isn't at the start of range it is not allowed, if the size is not
> > exactly the same as the range it is not allowed.
>
> Kevin suggested to allow a partial mmap, i.e allow the size to be
> smaller than what the cookie describes. Yet, surely the mmap size
> should not above the allocated size.
>

let me clarify - I didn't suggested it. Instead it's what the code
does hence I suggested to make it explicit. 😊