Bug 65933 - weston-launch -u doesn't work
Summary: weston-launch -u doesn't work
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-19 12:45 UTC by Ross Burton
Modified: 2013-07-08 16:56 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch to set groups for users (1.29 KB, patch)
2013-06-19 14:18 UTC, Quentin "Sardem FF7" Glidic
Details | Splinter Review

Description Ross Burton 2013-06-19 12:45:34 UTC
When weston-launch is used as root with the -u option to switch to a non-root user, the supplementary group list isn't set so this user is a member of root's group and the primary group of the user (in my situation, the group list is "root xuser").

This doesn't work too well when permissions on /dev/dri/card0 are root:video 660, because this user isn't currently a member of video (despite /etc/group saying otherwise).  Permission denied, weston fails.

It looks like the solution on Linux would be to use getgrouplist()/setgroups() before setgid()/setuid().
Comment 1 Quentin "Sardem FF7" Glidic 2013-06-19 14:18:48 UTC
Created attachment 81073 [details] [review]
Patch to set groups for users

This patch calls initgroups() if available. Built but not tested.
Comment 2 Ross Burton 2013-06-19 14:48:49 UTC
Patch works a treat.
Comment 3 Rob Bradford 2013-07-08 10:55:45 UTC
This patch looks good - could you mail it to the list please?
Comment 4 Kristian Høgsberg 2013-07-08 16:56:59 UTC
(In reply to comment #3)
> This patch looks good - could you mail it to the list please?

commit 735302ea2d6a281bb326e440c091e95c403f7b7f
Author: Quentin Glidic <sardemff7+git@sardemff7.net>
Date:   Wed Jun 19 15:27:11 2013 +0200

    weston-launch: Set all groups for user
    
    Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
    
    https://bugs.freedesktop.org/show_bug.cgi?id=65933


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.