Re: [RFC PATCH 12/13] iommufd, guestmemfs: Ensure persistent file used for persistent DMA

Jason Gunthorpe
2024-10-03T13:37:00Z

On Mon, Sep 16, 2024 at 01:31:01PM +0200, James Gowans wrote:

> +#ifdef CONFIG_GUESTMEMFS_FS
> + struct vm_area_struct *vma;
> + struct mm_struct *mm = current->mm;
> +
> + mmap_read_lock(mm);
> + vma = find_vma_intersection(current->mm,
> + cmd->user_va, cmd->user_va + cmd->length);
> + if (!vma || !is_guestmemfs_file(vma->vm_file)) {
> + mmap_read_unlock(mm);
> + return -EFAULT;
> + }
> + mmap_read_unlock(mm);
> +#else

Any kind of FD interaction needs to go through the new FD path that
Steve is building:

https://lore.kernel.org/linux-iommu/1727190338-385692-1-git-send-email-steven.sistare@oracle.com

I'm expecting multiple kinds of fds to fall into that pattern,
including memfs, guestmemfd, and dmabuf. guestmemfd can just be one
more..

Jason