diff options
author | Kevin Hao <kexin.hao@windriver.com> | 2020-02-08 20:36:42 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-02-13 12:19:14 +0000 |
commit | ba279900933d2399eb722bd01f140f7fb4d79c07 (patch) | |
tree | 7efd2763f1f05d57eab1e4f7a324191dd9f1005f /meta/recipes-graphics/x11-common/xserver-nodm-init | |
parent | a3416a5933892df940514842a34120658096ca07 (diff) | |
download | poky-ba279900933d2399eb722bd01f140f7fb4d79c07.tar.gz |
xserver-nodm-init: Fix the start failure for non-root user
In order to start the xserver, a non-root user should have the
cap_sys_admin capability to set the drm master. We try to get
the cap_sys_admin capability by setting it in both the thread
and file inheritable set. The side effect of this is that we
would have to add the "pam" to the distro features if we want
use the xserver-nodm-init for a non-root user.
[Yocto #11526]
(From OE-Core rev: cfd71a68a4931c8bda15357ebb1e9ebcf0e302dc)
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/x11-common/xserver-nodm-init')
-rw-r--r-- | meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf | 2 | ||||
-rwxr-xr-x | meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf b/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf new file mode 100644 index 0000000000..7ab7460816 --- /dev/null +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf | |||
@@ -0,0 +1,2 @@ | |||
1 | cap_sys_admin @USER@ | ||
2 | none * | ||
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm index 6c548551b8..116bb278bc 100755 --- a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm | |||
@@ -38,6 +38,14 @@ case "$1" in | |||
38 | if [ -e /dev/hidraw0 ]; then | 38 | if [ -e /dev/hidraw0 ]; then |
39 | chmod o+rw /dev/hidraw* | 39 | chmod o+rw /dev/hidraw* |
40 | fi | 40 | fi |
41 | # Make sure that the Xorg has the cap_sys_admin capability which is | ||
42 | # needed for setting the drm master | ||
43 | if ! grep -q "^auth.*pam_cap\.so" /etc/pam.d/su; then | ||
44 | echo "auth optional pam_cap.so" >>/etc/pam.d/su | ||
45 | fi | ||
46 | if ! /usr/sbin/getcap $XSERVER | grep -q cap_sys_admin; then | ||
47 | /usr/sbin/setcap cap_sys_admin+eip $XSERVER | ||
48 | fi | ||
41 | fi | 49 | fi |
42 | 50 | ||
43 | # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211] | 51 | # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211] |