Dariusz Gadomski has proposed merging 
~dgadomski/ubuntu/+source/gdm3/+git/lp1782152:unblock-sigusr1 into 
~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/bionic.

Commit message:
[ Alberto Milone ]
  * ubuntu_nvidia_prime.patch:
    - Run scripts for Prime before and after Gdm sessions (LP: #1778011).
[ Dariusz Gadomski ]
  * debian/patches/unblock-sigusr1.patch:
    - Unblock SIGUSR1 before PAM. (LP: #1782152)


Requested reviews:
  Ubuntu Desktop (ubuntu-desktop)
Related bugs:
  Bug #1778011 in nvidia-prime (Ubuntu): "SRU: PRIME Power Saving mode draws 
too much power"
  https://bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1778011
  Bug #1782152 in gdm3 (Ubuntu): "GDM blocks SIGUSR1 used in PAM scripts"
  https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1782152

For more details, see:
https://code.launchpad.net/~dgadomski/ubuntu/+source/gdm3/+git/lp1782152/+merge/353089

Rebased on top of 3.28.3.
-- 
Your team Ubuntu Desktop is requested to review the proposed merge of 
~dgadomski/ubuntu/+source/gdm3/+git/lp1782152:unblock-sigusr1 into 
~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/bionic.
diff --git a/debian/patches/series b/debian/patches/series
index 8a5cba3..ed7aa6c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ revert_override_LANG_with_accountservices.patch
 ubuntu_config_error_dialog.patch
 ubuntu_dont_set_language_env.patch
 ubuntu_prefer_ubuntu_session_fallback.patch
+unblock-sigusr1.patch
diff --git a/debian/patches/ubuntu_nvidia_prime.patch b/debian/patches/ubuntu_nvidia_prime.patch
index d2588b1..bf60c76 100644
--- a/debian/patches/ubuntu_nvidia_prime.patch
+++ b/debian/patches/ubuntu_nvidia_prime.patch
@@ -1,24 +1,25 @@
 From: Tim Lunn <t...@feathertop.org>
 Date: Sat, 22 Mar 2014 10:23:12 +1100
-Subject: Add hook to run prime-offload (as root) move Prime helpers into the
- gdm-x-session wrapper
-
++Subject: Add hooks to run prime scripts (as root) before and after a
++ gdm-session
+ 
++This allows enabling and disabling the dGPU on log out.
 ---
- common/gdm-common.c    |  2 +-
- daemon/gdm-display.c   |  1 +
- daemon/gdm-x-session.c | 10 ++++++++++
- data/Makefile.am       | 24 ++++++++++++++++++++++++
- data/Prime             |  6 ++++++
- data/PrimeOff          |  6 ++++++
+ common/gdm-common.c    |    2 +-
+ daemon/gdm-session.c   |    6 ++++++
+ daemon/gdm-x-session.c |    5 +++++
+ data/Makefile.am       |   24 ++++++++++++++++++++++++
+ data/Prime             |    6 ++++++
+ data/PrimeOff          |    6 ++++++
  6 files changed, 48 insertions(+), 1 deletion(-)
  create mode 100644 data/Prime
  create mode 100644 data/PrimeOff
 
-Index: gdm3-3.26.0/common/gdm-common.c
+Index: gdm3-3.28.2/common/gdm-common.c
 ===================================================================
---- gdm3-3.26.0.orig/common/gdm-common.c	2017-09-14 08:24:10.584748891 -0400
-+++ gdm3-3.26.0/common/gdm-common.c	2017-09-14 08:24:10.580748834 -0400
-@@ -677,7 +677,7 @@ gdm_run_script (const char *dir,
+--- gdm3-3.28.2.orig/common/gdm-common.c
++++ gdm3-3.28.2/common/gdm-common.c
+@@ -706,7 +706,7 @@
                  goto out;
          }
  
@@ -27,23 +28,28 @@ Index: gdm3-3.26.0/common/gdm-common.c
                                            display_name,
                                            display_hostname,
                                            display_x11_authority_file);
-Index: gdm3-3.26.0/daemon/gdm-x-session.c
+Index: gdm3-3.28.2/daemon/gdm-session.c
 ===================================================================
---- gdm3-3.26.0.orig/daemon/gdm-x-session.c	2017-09-14 08:24:10.584748891 -0400
-+++ gdm3-3.26.0/daemon/gdm-x-session.c	2017-09-14 08:24:10.580748834 -0400
-@@ -172,6 +172,11 @@ on_x_server_finished (GSubprocess  *subp
-         if (cancelled) {
-                 goto out;
-         }
-+        gdm_run_script (GDMCONFDIR "/PrimeOff", "root",
-+                       state->display_name,
-+                       NULL, /* hostname */
-+                       state->auth_file);
+--- gdm3-3.28.2.orig/daemon/gdm-session.c
++++ gdm3-3.28.2/daemon/gdm-session.c
+@@ -2865,6 +2865,12 @@
+ 
+         g_list_free_full (self->priv->outside_connections, g_object_unref);
+         self->priv->outside_connections = NULL;
 +
++        /* Run PrimeOff after the session is closed */
++        gdm_run_script (GDMCONFDIR "/PrimeOff", "root",
++                        NULL,
++                        NULL,
++                        NULL);
+ }
  
-         if (g_subprocess_get_if_exited (subprocess)) {
-                 int exit_status;
-@@ -614,6 +619,11 @@ spawn_session (State        *state,
+ void
+Index: gdm3-3.28.2/daemon/gdm-x-session.c
+===================================================================
+--- gdm3-3.28.2.orig/daemon/gdm-x-session.c
++++ gdm3-3.28.2/daemon/gdm-x-session.c
+@@ -614,6 +614,11 @@
  
          g_debug ("Running X session");
  
@@ -55,11 +61,11 @@ Index: gdm3-3.26.0/daemon/gdm-x-session.c
          launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
  
          if (state->environment != NULL) {
-Index: gdm3-3.26.0/data/Makefile.am
+Index: gdm3-3.28.2/data/Makefile.am
 ===================================================================
---- gdm3-3.26.0.orig/data/Makefile.am	2017-09-14 08:24:10.584748891 -0400
-+++ gdm3-3.26.0/data/Makefile.am	2017-09-14 08:24:10.584748891 -0400
-@@ -10,6 +10,8 @@ SUBDIRS =			\
+--- gdm3-3.28.2.orig/data/Makefile.am
++++ gdm3-3.28.2/data/Makefile.am
+@@ -10,6 +10,8 @@
  initdir = $(gdmconfdir)/Init
  postdir = $(gdmconfdir)/PostSession
  predir = $(gdmconfdir)/PreSession
@@ -68,7 +74,7 @@ Index: gdm3-3.26.0/data/Makefile.am
  postlogindir = $(gdmconfdir)/PostLogin
  workingdir = $(GDM_WORKING_DIR)
  xauthdir = $(GDM_XAUTH_DIR)
-@@ -172,6 +174,8 @@ EXTRA_DIST +=			\
+@@ -173,6 +175,8 @@
  	Xsession.in 		\
  	Init.in 		\
  	PreSession.in 		\
@@ -77,7 +83,7 @@ Index: gdm3-3.26.0/data/Makefile.am
  	PostSession.in 		\
  	PostLogin 		\
  	org.gnome.login-screen.gschema.xml.in \
-@@ -236,6 +240,8 @@ uninstall-hook:
+@@ -237,6 +241,8 @@
  	$(DESTDIR)$(initdir)/Default \
  	$(DESTDIR)$(postlogindir)/Default.sample \
  	$(DESTDIR)$(predir)/Default \
@@ -86,7 +92,7 @@ Index: gdm3-3.26.0/data/Makefile.am
  	$(DESTDIR)$(postdir)/Default \
  	$(DESTDIR)$(sysconfdir)/dconf/db/gdm \
  	$(DESTDIR)$(sysconfdir)/dconf/profile/gdm \
-@@ -282,6 +288,24 @@ endif
+@@ -283,6 +289,24 @@
  	fi
  	$(INSTALL_SCRIPT) PreSession $(DESTDIR)$(predir)/Default
  
@@ -111,10 +117,10 @@ Index: gdm3-3.26.0/data/Makefile.am
  	if test '!' -d $(DESTDIR)$(postdir); then \
  		$(mkinstalldirs) $(DESTDIR)$(postdir); \
  		chmod 755 $(DESTDIR)$(postdir); \
-Index: gdm3-3.26.0/data/Prime
+Index: gdm3-3.28.2/data/Prime
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdm3-3.26.0/data/Prime	2017-09-14 08:24:10.584748891 -0400
+--- /dev/null
++++ gdm3-3.28.2/data/Prime
 @@ -0,0 +1,6 @@
 +#!/bin/sh
 +
@@ -122,10 +128,10 @@ Index: gdm3-3.26.0/data/Prime
 +if [ -f "$primeoffload" ]; then
 +    $primeoffload
 +fi
-Index: gdm3-3.26.0/data/PrimeOff
+Index: gdm3-3.28.2/data/PrimeOff
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdm3-3.26.0/data/PrimeOff	2017-09-14 08:24:10.584748891 -0400
+--- /dev/null
++++ gdm3-3.28.2/data/PrimeOff
 @@ -0,0 +1,6 @@
 +#!/bin/sh
 +
diff --git a/debian/patches/unblock-sigusr1.patch b/debian/patches/unblock-sigusr1.patch
new file mode 100644
index 0000000..3a4104c
--- /dev/null
+++ b/debian/patches/unblock-sigusr1.patch
@@ -0,0 +1,68 @@
+Description: session-worker: unblock SIGUSR1 before PAM
+ Right now we unblock SIGUSR1 just before starting
+ the session, but we should really do it before
+ starting the worker/PAM.
+
+ This commit fixes that and removes a useless call
+ to set SIGUSR1 back to the default disposition,
+ right before exec (which does the same thing anyway)
+ .
+
+Origin: upstream, https://gitlab.gnome.org/GNOME/gdm/commit/b0d1ca9ebf605abb63b95ef73d56d56a1109002e
+Bug: https://gitlab.gnome.org/GNOME/gdm/issues/399
+Bug-Debian: https://bugs.debian.org/905277
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1782152
+Last-Update: 2018-07-23
+--- a/daemon/gdm-session-worker-job.c
++++ b/daemon/gdm-session-worker-job.c
+@@ -117,12 +117,19 @@
+ static void
+ session_worker_job_child_setup (GdmSessionWorkerJob *session_worker_job)
+ {
++        sigset_t mask;
+         session_worker_job_setup_journal_fds ();
+ 
+         /* Terminate the process when the parent dies */
+ #ifdef HAVE_SYS_PRCTL_H
+         prctl (PR_SET_PDEATHSIG, SIGTERM);
+ #endif
++        /*
++         * Reset signal mask to default since it was altered by the
++         * manager process
++         */
++        sigemptyset (&mask);
++        sigprocmask (SIG_SETMASK, &mask, NULL);
+ }
+ 
+ static void
+--- a/daemon/gdm-session-worker.c
++++ b/daemon/gdm-session-worker.c
+@@ -2025,8 +2025,6 @@
+                 char  *home_dir;
+                 int    stdin_fd = -1, stdout_fd = -1, stderr_fd = -1;
+                 gboolean has_journald = FALSE, needs_controlling_terminal = FALSE;
+-                sigset_t mask;
+-
+                 /* Leak the TTY into the session as stdin so that it stays open
+                  * without any races. */
+                 if (worker->priv->session_tty_fd > 0) {
+@@ -2147,19 +2145,6 @@
+                  */
+                 signal (SIGPIPE, SIG_DFL);
+ 
+-                /*
+-                 * Reset SIGUSR1 to default since it was blocked by the manager
+-                 * process for the X server startup handshake
+-                 */
+-                signal (SIGUSR1, SIG_DFL);
+-
+-                /*
+-                 * Reset signal mask to default since it was altered by the
+-                 * manager process
+-                 */
+-                sigemptyset (&mask);
+-                sigprocmask (SIG_SETMASK, &mask, NULL);
+-
+                 gdm_session_execute (worker->priv->arguments[0],
+                                      worker->priv->arguments,
+                                      (char **)
-- 
ubuntu-desktop mailing list
ubuntu-desktop@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to