From: Martin Peres <martin.peres@free.fr>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 0/6] DRM: VMA Access Management and Render Nodes
Date: Sun, 25 Aug 2013 20:22:55 +0200 [thread overview]
Message-ID: <521A4B7F.5010201@free.fr> (raw)
In-Reply-To: <CANq1E4RW8Pv+E-NvuQzKez0hfeOYLFeF6SfC44mYdTsMwzEKqg@mail.gmail.com>
On 25/08/2013 17:09, David Herrmann wrote:
> Hi
>
> On Fri, Aug 23, 2013 at 2:00 PM, Martin Peres <martin.peres@free.fr> wrote:
>> Le 23/08/2013 13:13, David Herrmann a écrit :
>>
>>> Hi
>>>
>>> I reduced the vma access-management patches to a minimum. I now do filp*
>>> tracking in gem unconditionally and force drm_gem_mmap() to check this.
>>> Hence,
>>> all gem drivers are safe now. For TTM drivers, I now use the already
>>> available
>>> verify_access() callback to get access to the underlying gem-object.
>>> Pretty
>>> simple.. Why hadn't I thought of that before?
>>>
>>> Long story short: All drivers using GEM are safe now. This leaves vmwgfx..
>>> But
>>> they do their own access-management, anyway.
>>
>> Great! Thanks! Have you checked they are really safe with my "exploits"?
>> I'll have another round of review even if it looked good the last time I
>> checked.
> Good you asked. I tested whether it works, I didn't actually verify
> that it correctly fails in case of exploits. And in fact there is a
> small bug (I return "1" instead of -EACCES, stupid verify_access()) so
> user-space gets a segfault accessing the mmap when trying to exploit
> this. That actually doesn't sound that bad, does it? ;)
Good to know I could contribute a little to your work. You're doing a
great job!
> v2 is on its way.
Yep, saw it.
>
>>> The 3 patches on top implement render-nodes. I added a "drm_rnodes" module
>>> parameter to core drm. You need to pass "drm.rnodes=1" on the kernel
>>> command-line or via sysfs _before_ loading a driver. Otherwise, render
>>> nodes
>>> will not be created.
>>
>> By default, having the render nodes doesn't change the way the userspace
>> works at all. So, what is the point of protecting it behind a parameter?
>>
>> Is it to make it clear this isn't part of the API yet? I would say that as
>> long
>> as libdrm hasn't been updated, this isn't part of the API anyway.
> Hm, I wouldn't say so. Applications like weston and kmscon no longer
> use the legacy drmOpen() facility. They use udev+open(). So once it's
> upstream, it's part of the API regardless of libdrm. So the sole
> purpose of drm_rnodes is to mark it as "experimental".
Ah, I guess I'll have to have a look at this. I basically got preempted
from adding render node support to Weston and I didn't take the time
to check it again, the vma patches were more important first. Thanks
for saving me a giant headache with GEM/TTM, I spent two week ends
trying to track a leak for radeon cards.
>>> This allows us to test render-nodes and play with the API. I added FLINK
>>> for
>>> now so we can better test it. Not sure whether we should allow it in the
>>> end,
>>> though.
>>
>> From a security point of view, I don't think we should keep it as
>> applications shouldn't
>> be trusted for not doing stupid things (because of code injection). So,
>> unless we
>> plan on adding access control to flink via LSM, we shouldn't expose the
>> feature
>> on render nodes.
> This is also what I think. We have a chance to get rid of all legacy
> stuff, so maybe we should just drop it all.
Great!
>
>> From a dev point of view, keeping it means that the XServer doesn't
>> have to know whether mesa supports render nodes or not. This is because
>> the authentication dance isn't available on render nodes so the x-server
>> has to tell mesa if it should authenticate or not. The other solution is to
>> allow
>> the authentication ioctls on render nodes and just return 0 if this is a
>> render node.
>> This way, we won't need any modification in mesa/xserver/dri2proto to pass
>> the information that no authentication is needed. In this solution, only
>> libdrm and
>> the ddx should be modified to make use of the render node. That's not how I
>> did it on my render node patchset, can't remember why...
>>
>> What do you guys think?
> We discussed that a bit on IRC. Of course, we can add a lot of
> wrappers and workarounds. We can make all the drmAuth stuff *just
> work*. But that means, we keep all the legacy. As said, we have the
> chance to introduce a new API and drop all the legacy. I think it is
> worth a shot. And we also notice quite fast which user-space programs
> need some rework.
Well, if by "all the legacy", you mean the authentication-related
functions then yes.
How do you plan on handling the case where the ddx has been updated and
passes
the render node to a not-yet-updated mesa? Mesa will try to authenticate
and it will fail.
Keeping the authentication IOCTLs seem to me like a lesser evil,
especially since they
would basically do nothing.
>
>>> Maybe we can get this into 3.11?
>>
>> As long as we don't have to keep the interface stable (I don't want to
>> expose flink
>> on render nodes), I'm all for pushing the code now. Otherwise, a kernel
>> branch
>> somewhere is sufficient.
>>
>> Do you plan on checking my userspace patches too? Those are enough to make
>> use
>> of the render nodes on X, but I haven't tested that all the combinations of
>> version
>> would still work. The libdrm work should be quite solid though (there are
>> even libdrm
>> tests for the added functionalities :)).
> I plan on having a working user-space for XDC. Most of your patches
> can be copied unchanged indeed. But servers other than Xorg don't use
> that, so they need separate fixes.
Brilliant :) Looking forward to it!
Martin
next prev parent reply other threads:[~2013-08-25 18:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 11:13 [PATCH v2 0/6] DRM: VMA Access Management and Render Nodes David Herrmann
2013-08-23 11:13 ` [PATCH v2 1/6] drm/vma: add access management helpers David Herrmann
2013-08-23 11:13 ` [PATCH v2 2/6] drm/gem: implement vma access management David Herrmann
2013-08-23 11:13 ` [PATCH v2 3/6] drm: verify vma access in TTM+GEM drivers David Herrmann
2013-08-23 11:13 ` [PATCH v2 4/6] drm: implement experimental render nodes David Herrmann
2013-08-23 11:13 ` [PATCH v2 5/6] drm/i915: Support " David Herrmann
2013-08-23 11:29 ` Chris Wilson
2013-08-23 21:13 ` Kristian Høgsberg
2013-08-23 22:51 ` Daniel Vetter
2013-08-23 11:13 ` [PATCH v2 6/6] drm/nouveau: " David Herrmann
2013-08-23 11:28 ` [PATCH v2 0/6] DRM: VMA Access Management and Render Nodes Christian König
2013-08-23 12:31 ` David Herrmann
2013-08-23 12:34 ` Christian König
2013-08-23 12:47 ` David Herrmann
2013-08-23 13:34 ` Alex Deucher
2013-08-23 12:00 ` Martin Peres
2013-08-25 15:09 ` David Herrmann
2013-08-25 18:22 ` Martin Peres [this message]
2013-08-25 16:28 ` [PATCH 1/7] drm/vma: add access management helpers David Herrmann
2013-08-25 16:28 ` [PATCH 2/7] drm/gem: implement vma access management David Herrmann
2013-08-25 16:28 ` [PATCH 3/7] drm: verify vma access in TTM+GEM drivers David Herrmann
2013-08-25 16:29 ` [PATCH 4/7] drm: implement experimental render nodes David Herrmann
2013-08-25 16:29 ` [PATCH 5/7] drm/i915: Support " David Herrmann
2013-08-25 16:29 ` [PATCH 6/7] drm/nouveau: " David Herrmann
2013-08-25 16:29 ` [PATCH 7/7] drm/radeon: support " David Herrmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=521A4B7F.5010201@free.fr \
--to=martin.peres@free.fr \
--cc=dh.herrmann@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.