Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 450364 - x11-base/xorg-server[-suid] useful configurations need to be documented
Summary: x11-base/xorg-server[-suid] useful configurations need to be documented
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement with 1 vote (vote)
Assignee: Gentoo X packagers
URL: https://wiki.gentoo.org/wiki/Non_root...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-05 11:30 UTC by Michael Weber (RETIRED)
Modified: 2019-06-20 21:03 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Xorg.0.log on nvidia (file_450364.txt,6.19 KB, text/plain)
2013-01-05 11:34 UTC, Michael Weber (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weber (RETIRED) gentoo-dev 2013-01-05 11:30:54 UTC
Hi,

I just foold around with xorg-server[-suid] to solve an xpra issue (bug 448588) unable to `cp /usr/bin/Xorg` as non-root w/o user intervention (see elog).

But I was unable to start the server as non-root, first with an old Xorg.0.log with

> Fatal server error:
> Cannot move old log file "/var/log/Xorg.0.log" to "/var/log/Xorg.0.log.old"

followed by an 

> Fatal server error:
> Cannot open log file "/var/log/Xorg.0.log"

I see the point that most xorg-server instances might be started by gdm/whatevder* as root, providing the login manager and then exec(3)'ing into the actual user session.

But I thought the fuzz about USE -suid was to take atvantage from KVM kernel stuff and be able to run Xorg as non-root process.

What's your opinion about that?

p.s. I've no idea what upstreams proposed solution for the privilege mess might be, but something like an per-user directory of logs inside an sticky, world-writeable /var/log/Xorg might suffice /(/var/log/Xorg/$user/Xorg.0.log).
Comment 1 Michael Weber (RETIRED) gentoo-dev 2013-01-05 11:34:26 UTC
Created attachment 334504 [details]
Xorg.0.log on nvidia

error on an nvidia system after setting `chmod a+w /var/log` (for testing only).
Comment 2 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-01-05 13:45:39 UTC
As you correctly say, xorg-server[-suid] is perfectly usable if you start X through /etc/init.d/xdm or as root. Also as non-root it can be started if you use xf86-video-dummy and no input devices (which is the plan for bug 409925).

What is currently not documented is how to start X with access to input and display hardware as non-root. The suid flag will remain enabled by default until it is.

We are currently lacking a volunteer who enumerates all the possible cases and collects the available information which is scattered around wikis, bugzillas (e.g. bug 419485 comment 6), forums and mailing lists.
Comment 3 Matt Turner gentoo-dev 2017-10-21 01:22:20 UTC
I pushed 1.19.5-r1 which now has a suid-wrapper USE flag. I think the suid USE flag is pretty useless now, and should likely be removed. It would be great to get some confirmation.
Comment 4 Holger Hoffstätte 2017-10-22 13:28:57 UTC
(In reply to Matt Turner from comment #3)
> I pushed 1.19.5-r1 which now has a suid-wrapper USE flag.

Nope, no such USE flag. The ebuild does specify --enable-suid-wrapper
unconditionally, but it doesn't work: startx as regular user no longer
works. There doesn't seem to be any "suid wrapper" installed either;
at least I couldn't find any.
I had to revert to 1.19.5+suid to get a working desktop.
Comment 5 Floyd Anderson 2017-10-22 19:14:15 UTC
(In reply to Holger Hoffstätte from comment #4)
> (In reply to Matt Turner from comment #3)
> > I pushed 1.19.5-r1 which now has a suid-wrapper USE flag.
> 
> There doesn't seem to be any "suid wrapper" installed either;
> at least I couldn't find any.

The wrapper is in ‘/usr/libexec/Xorg.wrap’, manuals are Xorg.wrap(1) and Xwrapper.config(5).


> I had to revert to 1.19.5+suid to get a working desktop.
Same here, so I can confirm with +suid-wrapper, startx doesn‘t work.
I set:
    allowed_users = anybody
    needs_root_rights = yes

in ‘/etc/X11/Xwrapper.config’ without luck.

While testing I always ended up with some kind of “Permission denied”:

  - “Unable to retrieve master”
    ...
    “(EE) AddScreen/ScreenInit failed for driver 0” or with
  - “xf86OpenConsole: Cannot open virtual console 7 (Permission denied)”

A `strace -e trace=open,ioctl Xorg 2>&1 | view -` discover a Permission
denied for ‘DRM_IOCTL_SET_MASTER’.

I gave up for now and revert also to 1.19.5+suid.
Comment 6 Matt Turner gentoo-dev 2017-10-22 19:17:18 UTC
Right. We dropped suid and suid-wrapper shortly after adding suid-wrapper, since I cannot see a compelling reason to offer such flexibility.

You should have

% ls -lh /usr/libexec/Xorg*
-rwxr-xr-x 1 root root 2.2M Oct 20 20:27 /usr/libexec/Xorg
-rws--x--x 1 root root  11K Oct 20 20:27 /usr/libexec/Xorg.wrap

where Xorg.wrap is the suid wrapper. /usr/bin/Xorg is now a shell script that chooses which to execute.

I'm not sure what problem you're having. Please open a new bug.

This one should be resolved, since there is no configuration to document :)
Comment 7 Larry the Git Cow gentoo-dev 2017-10-23 19:40:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e9f7ca88eeeb4be5c5bfaa4f73cc3ba5c211947

commit 7e9f7ca88eeeb4be5c5bfaa4f73cc3ba5c211947
Author:     Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
AuthorDate: 2017-10-23 19:40:12 +0000
Commit:     Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
CommitDate: 2017-10-23 19:40:12 +0000

    profiles/package.mask: mask >=x11-base/xorg-server-1.19.5-r1
    
    Dropping suid breaks some use cases.
    
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=450364
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=635102

 profiles/package.mask | 5 +++++
 1 file changed, 5 insertions(+)}
Comment 8 zless 2017-10-31 05:16:21 UTC
I'm not sure what's the consensus here but I wanted to point out that Arch builds xorg-server with

    --enable-suid-wrapper
    --disable-install-setuid

and this seems to be fine for them in both cases:

* running as $USER with startx
* running as root from a login manager.
Comment 9 Piotr Karbowski (RETIRED) gentoo-dev 2019-06-20 16:59:17 UTC
Since the -suid is fully working now even without systemd due to elogind integration, do we still need to do anything here?
Comment 10 Piotr Karbowski (RETIRED) gentoo-dev 2019-06-20 21:03:56 UTC
There's no much to be done here really.

To run -suid you need to either:

- use xdm that runs /usr/bin/Xorg as root anyway.
- have *logind interface, like elogind or systemd, that grants you control master over DRM (for the KMS enabled drivers) -- meaning USE=elogind or USE=systemd on xorg-server.
- Use driver that is not KMS (is there anything like that still in the tree?) so it does not require SETMASTER ioctl (CAP_SYS_ADMIN permissions required, so basically root) AND have access to input devices, like input system group membership (*logind grants input access, unless you run udev-less).

Closing it, if you feel like it should be reopened -- feel free to do so.