[xorg-x11-server] Modify the server wrapper to not always start the server as root.

Hans de Goede jwrdegoede at fedoraproject.org
Wed Mar 18 11:03:13 UTC 2015


commit aaf1923ce2b624361761b382e6424bc77549ee60
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Mar 18 12:03:10 2015 +0100

    Modify the server wrapper to not always start the server as root.
    
      Callers of the server which start it in a way which is compatible with the
      server running without root rights can now set a XORG_RUN_AS_USER_OK env
      variable and then the wrapper will behave as if needs_root_rights = auto
      is specified, unless overriden from Xwrapper.config

 ...-Make-the-suid-root-wrapper-always-start-.patch | 27 +++++++++++-----------
 xorg-x11-server.spec                               |  9 +++++++-
 2 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch b/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
index 831652f..1084342 100644
--- a/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
+++ b/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
@@ -1,8 +1,8 @@
 From 17830918f1bebf3696c6660f602de84d3efeb1ac Mon Sep 17 00:00:00 2001
 From: Hans de Goede <hdegoede at redhat.com>
 Date: Thu, 17 Apr 2014 15:50:44 +0200
-Subject: [PATCH] Fedora hack: Make the suid-root wrapper always start the
- server with root rights
+Subject: [PATCH] Fedora hack: Make the suid-root wrapper start the server
+ with root rights
 
 Do NOT upstream.
 
@@ -10,14 +10,12 @@ Since most display managers are not ready yet to start Xorg in way which will
 keep it working without root-rights, see:
 https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights
 
-Just keep starting X as root for now, but do it through the wrapper. This
-allows people who want to test Xorg without root rights to create a
-/etc/X11/Xwrapper.config file with:
+Just keep starting X as root for now, but do it through the wrapper, by
+overriding the needs_root_rights = -1 (auto) default and setting it to 1.
 
-needs_root_rights = auto
-
-In there to test XorgWithoutRootRights without breaking people's setups due
-to non ready display-managers.
+We set a special environment variable when starting X in a way where root
+rights are not needed (from gdm and startx) and keep the upstream
+needs_root_rights = -1 (auto) default in that case.
 
 Signed-off-by: Hans de Goede <hdegoede at redhat.com>
 ---
@@ -28,15 +26,16 @@ diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
 index 90c8c11..539bfe4 100644
 --- a/hw/xfree86/xorg-wrapper.c
 +++ b/hw/xfree86/xorg-wrapper.c
-@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
-     int kms_cards = 0;
-     int total_cards = 0;
+@@ -191,6 +191,9 @@ int main(int argc, char *argv[])
      int allowed = CONSOLE_ONLY;
--    int needs_root_rights = -1;
-+    int needs_root_rights = 1;
+     int needs_root_rights = -1;
  
++    if (getenv("XORG_RUN_AS_USER_OK") == NULL)
++        needs_root_rights = 1;
++
      progname = argv[0];
  
+     parse_config(&allowed, &needs_root_rights);
 -- 
 1.9.0
 
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index e7ca396..adca228 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -45,7 +45,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.17.1
-Release:   6%{?gitdate:.%{gitdate}}%{dist}
+Release:   7%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -640,6 +640,13 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
 
 
 %changelog
+* Wed Mar 18 2015 Hans de Goede <hdegoede at redhat.com> - 1.17.1-7
+- Modify the server wrapper to not always start the server as root.
+  Callers of the server which start it in a way which is compatible with the
+  server running without root rights can now set a XORG_RUN_AS_USER_OK env
+  variable and then the wrapper will behave as if needs_root_rights = auto
+  is specified, unless overriden from Xwrapper.config
+
 * Wed Mar 04 2015 Adam Jackson <ajax at redhat.com> 1.17.1-6
 - Fix int10 interrupt vector setup
 


More information about the scm-commits mailing list