Re: [Linaro-mm-sig] [PATCH 1/2] dma-buf: Require VM_PFNMAP vma for mmap

Daniel Vetter
2021-02-25T10:49:29Z

On Thu, Feb 25, 2021 at 11:30:23AM +0100, Christian König wrote:
>
>
> Am 24.02.21 um 19:46 schrieb Jason Gunthorpe:
> > On Wed, Feb 24, 2021 at 09:45:51AM +0100, Daniel Vetter wrote:
> >
> > > Hm I figured everyone just uses MAP_SHARED for buffer objects since
> > > COW really makes absolutely no sense. How would we enforce this?
> > In RDMA we test
> >
> > drivers/infiniband/core/ib_core_uverbs.c: if (!(vma->vm_flags & VM_SHARED))
> >
> > During mmap to reject use of MAP_PRIVATE on BAR pages.
>
> That's a really good idea. MAP_PRIVATE and any driver mappings doesn't
> really work at all.

Yeah I feel like this is the next patch we need to add on this little
series of locking down dma-buf mmap semantics. Probably should also push
these into drm gem mmap code (and maybe ttm can switch over to that, it's
really the same).

One at a time.
-Daniel
>
> Christian.
>
> >
> > Jason
>

--
Daniel Vetter
Software Engineer, Intel Corporation