[PATCH RFC] Xorg: Add a suid root wrapper
Hans de Goede
hdegoede at redhat.com
Mon Mar 10 01:50:55 PDT 2014
Hi,
On 03/09/2014 11:39 PM, Mark Kettenis wrote:
>> Date: Thu, 06 Mar 2014 13:57:32 +0100
>> From: Hans de Goede <hdegoede at redhat.com>
>
>>>> + for (i = 0; i < 16; i++) {
>>>> + snprintf(buf, PATH_MAX, "/dev/dri/card%d", i);
>>>
>>> Hardcoding paths like this is a bad idea. We use "/dev/drm%d" on
>>> OpenBSD for example. Other systems might use different names yet
>>> again.
>>
>> We may end up putting a define in some config.h for this, but ...
>>
>>> Probably better to use libdrm.
>>
>> Ugh no, this is a suid-root wrapper, less code is more here. Yes
>> I know libdrm is designed to be safe to run as root, but it is still
>> better to not run it as root at all.
>
> Well, there's always a tradeoff between running external code and the
> risk of making mistakes reimplementing such functionality.
>
> Anyway, what you could do here is include xf86drm.h but not link
> against libdrm.h. Then you could use DRM_DEV_NAME instead of
> hardcoding /dev/dri/card%d.
Good idea, I've done this for v2 of the wrapper.
Thanks & Regards,
Hans
More information about the xorg-devel
mailing list