Announcement

Collapse
No announcement yet.

So when did Xorg actually start working without SUID?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • So when did Xorg actually start working without SUID?

    When testing out a patchset on 2.6.38, I noticed that neither the xorg server nor the intel drivers seemed to be using the ioctls which (IIRC) were one of the main stumbling blocks to running X without root permissions, so I actually tried it for the first time in well over a year, and lo and behold, it works! (albiet after some permissions wrangling...)

    This is something I've been waiting on since KMS went mainline (as have others here I think), but pretty much gave up on seeing it 'cause non of the devs seemed to consider it a priority, just searched now and the last post to a major thread about it here was just about 11 months ago.

    Anyways, onto specifics, for those interested; while it "worked", there are permissions changes needed to get everything working as good as with SUID Xorg:

    Without root perms, the Xorg server needs write access to /var/log
    There is a -logfile option for Xorg specify an alternate log file in a user-writable location, but it needs to be run with uid 0 (ie as root) to use it... ( )
    A very simple patch to xorg-server removed this uid 0 check for -logfile, so that's that one out of the way.

    The server also needs root access to the tty node for the virtual console X will be running on, I use my own script to start X at boot without a display manager, so an easy fix for me with a chgrp and chmod, not a perfect solution though and I have no idea how to deal with it with xdm/gdm/kdm or similar...

    Input devices of course, xorg needs read (and write?) perms for this, simple fix with some udev rules for the event/mouse class devices, may be trickier if not using the evdev input driver though.

    Needs access to the acpid socket, another simple fix, acpid itself has --socketgroup and --socketmode options.

    The only thing left to deal with is no write permissions on/sys/class/backlight/acpi_video0/brightness, needed for backlight adjusting via xbacklight and similar, a minor kernel patch will solve that, although again not the perfect solution...

    Only two things left in the logs then;
    "LoadKernelModule: Setting of real/effective user Id to 0/0 failed", which AFAICT is meaningless, any kernel modules needed are compiled in, may be related to a "fbcon module not found" or similar warning I used to see...
    And finally, "(WW) intel(0): drmSetMaster failed: Permission denied" & "(WW) intel(0): drmDropMaster failed: Permission denied", near as I can tell it has something to do with vt switching, but I've observed no negative affects from this, so /me shrugs...

    As to the permissions changes (before you all start yelling at me) on the tty, input dev nodes and acpid socket, what I actually did was create a dedicated "xserver" group, made those dev nodes and socket owned and readable/writable by that group, then made the Xorg binary owned by that group too and made it 'SGID';
    Code:
    sadako@arisu ~ $ ls -l /usr/local/bin/Xorg-uid 
    -rwx--s--x 1 root xserver 2149744 Apr 18 17:45 /usr/local/bin/Xorg-uid
    and ps -AF output;
    Code:
    sadako    1332     1  0  3952   956   0 13:22 ?        00:00:00 xinit /home/sadako/.xinitrc -- /usr/local/bin/Xorg-uid vt5 -deferglyphs 16 -logfile /tmp/sadako/Xorg:0.log
    sadako    1335  1332  2 28786 17812   0 13:22 tty5     00:01:16 /usr/local/bin/Xorg-uid :0 vt5 -deferglyphs 16 -logfile /tmp/sadako/.Xorg:0.log
    Everything is working perfectly so far, glxgears and xv video apps too.
    I know the meego devs were working on this, but I had the impression the work wasn't going upstream...

    I can post the udev rules and xorg-server patch if anyone wants, and I'm gonna try it on my radeon desktop in a bit too (see if it's intel specific or not), so there you go... finally.


    tldr; anyone know when the hell Xorg started working without root permissions and why the hell didn't anybody tell me? :P

  • #2
    I thought that is not done yet in distros because then all users on the comp can snoop on each other.

    Comment


    • #3
      Originally posted by Sadako View Post
      There is a -logfile option for Xorg specify an alternate log file in a user-writable location, but it needs to be run with uid 0 (ie as root) to use it... ( )
      Suppose the X server is suid root. Now suppose a user comes along and does:

      Code:
      $X -logfile /sbin/init
      Hilarity ensues?

      Comment


      • #4
        Originally posted by Ex-Cyber View Post
        Suppose the X server is suid root. Now suppose a user comes along and does:

        Code:
        $X -logfile /sbin/init
        Hilarity ensues?
        Goddamit, while trying to remove SUID, I totally forgot why it can be so damn dangerous in the first place...

        I changed the patch to write the log to a file in /var/log/xorg rather than /var/log itself, safer workaround.
        Although I think I'd rather disable the log and just redirect stdout/stderr to a file altogether...

        Anyways, tried this on a radeon r600 card and it failed, still needed to call ioperm, so it does appear to be work done specifically in the intel driver.

        Whatever, I've been happily running my crappy little intel netbook with Xorg running under a restricted account for about 3 weeks now... (and sorry for not replying sooner).

        Comment


        • #5
          Originally posted by curaga View Post
          I thought that is not done yet in distros because then all users on the comp can snoop on each other.
          I don't see how, I mean with the method I outlined above ordinary users still don't have read access to the input dev nodes, and the vc is only read/writable by the user running X...

          Comment


          • #6
            "Switch user", or log out and in as another. Or perhaps it's a multiseat machine, or runs several X servers for other reasons etc.

            Comment

            Working...
            X