[PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

Daniel Vetter daniel at ffwll.ch
Wed Nov 20 12:04:37 UTC 2019


On Wed, Nov 20, 2019 at 12:40 PM Gerd Hoffmann <kraxel at redhat.com> wrote:
>
>   Hi,
>
> > > Anything building on shmem helpers should be able to use
> > > obj->filp->f_mapping, right?  So allocating an inode unconditionally
> > > doesn't look like a good plan.
> >
> > Not sure the shmem helpers forward the mmap to the underlying shmem file,
> > so not sure this is the greatest way either.
>
> I think so, shmem helpers already zap the fake offset, and this would
> not work without per-object address space I think.

That's why I think shmem helpers have a problem right now, and why
it's probably best to go back to the fake offset for everything. But
we seem to have lost Rob Herring in all this thread, so readding him.

> > > Guess I'll go look at ttm-local changes for starters and see how it
> > > goes.
> >
> > I think for ttm just consistently using the one per-device mapping for
> > everything, with all the fake offsets, is probably the quickest route.
>
> Hmm, not clear how to fit dmabufs into this.  dmabufs already have their
> own file, inode and address space.  I'm not sure you can switch that
> over to the per-device mapping in the first place, and even if you can I
> have my doubts this is a good idea from a security point of view ...

You can (plenty drivers do that already), and not sure how that breaks
security? Imo it's more consistent, since everything ends up pointing
to the same underlying resource.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list