[PATCH libdrm] xf86drm: Add drmIsMaster()

Daniel Vetter daniel at ffwll.ch
Mon Dec 17 17:59:28 UTC 2018


On Mon, Dec 17, 2018 at 6:38 PM Emil Velikov <emil.l.velikov at gmail.com> wrote:
>
> Hi Christopher,
>
> On Tue, 20 Nov 2018 at 03:37, Christopher James Halse Rogers
> <christopher.halse.rogers at canonical.com> wrote:
> >
> > We can't use drmSetMaster to query whether or not a drm fd is master
> > because it requires CAP_SYS_ADMIN, even if the fd *is* a master fd.
> >
> Can you please mention the exact use case here? You mentioned it over
> IRC although it'll be nice to have it here for posterity.
>
> > Pick DRM_IOCTL_MODE_ATTACHMODE as a long-deprecated ioctl that is
> > DRM_MASTER but not DRM_ROOT_ONLY as the probe by which we can detect
> > whether or not the fd is master.
> >
> I'm wondering if we cannot extent DRM_IOCTL_GET_CLIENT or another IOCTL.
> What do you think? May I interest you in writing an RFC for the kernel-side?
>
> IMHO checking with the kernel devs for a cleaner solution is a worthy
> goal. If they're unhappy we can use this workaround.

I think an invalid request through authmagic would be cleaner. That
should give you EINVAL (you're master) or EACCESS (you're not master).
It's also directly related to the master status, so less of a
mindbinder. Note that we allocate magic numbers through the idr
starting at 1, 0 is considered an invalid magic number and rejected.
-Daniel

>
> Thanks
> Emil
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list