[PATCH] RFC: dma-buf: Require VM_SPECIAL vma for mmap
Jason Gunthorpe
jgg at ziepe.ca
Thu Feb 4 16:13:39 UTC 2021
On Wed, Feb 03, 2021 at 10:19:48PM +0100, Daniel Vetter wrote:
> tldr; DMA buffers aren't normal memory, expecting that you can use
> them like that (like calling get_user_pages works, or that they're
> accounting like any other normal memory) cannot be guaranteed.
>
> Since some userspace only runs on integrated devices, where all
> buffers are actually all resident system memory, there's a huge
> temptation to assume that a struct page is always present and useable
> like for any more pagecache backed mmap. This has the potential to
> result in a uapi nightmare.
>
> To stop this gap require that DMA buffer mmaps are VM_SPECIAL, which
> blocks get_user_pages and all the other struct page based
> infrastructure for everyone. In spirit this is the uapi counterpart to
> the kernel-internal CONFIG_DMABUF_DEBUG.
Fast gup needs the special flag set on the PTE as well.. Feels weird
to have a special VMA without also having special PTEs?
Jason
More information about the dri-devel
mailing list