Re: [PATCH] iommufd: reject mapping an iommufd file into an IOAS

From: Jason Gunthorpe

Date: Fri Nov 13 2026 - 19:41:21 EST


On Thu, Nov 12, 2026 at 10:59:45AM +0800, Jiahao Xu wrote:
> iopt_map_file_pages() takes the fd passed to IOMMU_IOAS_MAP_FILE and, for
> every file that is not a dma-buf, stores a reference to it in the pages
> of the new mapping:
>
> iopt_map_file_pages()
> iopt_alloc_file_pages()
> pages->file = get_file(file)

I've know about this for a bit but haven't got to figuring out a
solution.

This patch is not quite good enough as any fd that can hold an
iommufd, like vfio is also a problem.

Really it needs to be reversed so only a memfd or dmabuf is held, but
I don't know how to do that..

Jason