Merge ~dgadomski/ubuntu/+source/gdm3/+git/lp1782152:unblock-sigusr1 into ~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/bionic

Proposed by Dariusz Gadomski on 2018-08-14
Status: Merged
Merge reported by: Iain Lane
Merged at revision: ce4a95af00d3f2174bf10827e75b54bf5fde2154
Proposed branch: ~dgadomski/ubuntu/+source/gdm3/+git/lp1782152:unblock-sigusr1
Merge into: ~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/bionic
Diff against target: 240 lines (+115/-40)
3 files modified
debian/patches/series (+1/-0)
debian/patches/ubuntu_nvidia_prime.patch (+46/-40)
debian/patches/unblock-sigusr1.patch (+68/-0)
Reviewer Review Type Date Requested Status
Iain Lane 2018-08-14 Needs Fixing on 2018-08-14
Review via email: mp+353089@code.launchpad.net

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)

Description of the change

Rebased on top of 3.28.3.

To post a comment you must log in.
Iain Lane (laney) wrote :

You don't need unblock-sigusr1.patch any more. It's in this release:

Applying patch unblock-sigusr1.patch
patching file daemon/gdm-session-worker-job.c
Hunk #1 FAILED at 117.
1 out of 1 hunk FAILED -- rejects in file daemon/gdm-session-worker-job.c
patching file daemon/gdm-session-worker.c
Hunk #1 FAILED at 2025.
Hunk #2 FAILED at 2147.
2 out of 2 hunks FAILED -- rejects in file daemon/gdm-session-worker.c
Patch unblock-sigusr1.patch can be reverse-applied

Have you tested this update?

review: Needs Fixing
Iain Lane (laney) wrote :

Please make sure to update the changelog too

Iain Lane (laney) wrote :

I just pushed this branch without ce4a95af00d3f2174bf10827e75b54bf5fde2154 and added a changelog entry for that change on top. Thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/patches/series b/debian/patches/series
2index 8a5cba3..ed7aa6c 100644
3--- a/debian/patches/series
4+++ b/debian/patches/series
5@@ -11,3 +11,4 @@ revert_override_LANG_with_accountservices.patch
6 ubuntu_config_error_dialog.patch
7 ubuntu_dont_set_language_env.patch
8 ubuntu_prefer_ubuntu_session_fallback.patch
9+unblock-sigusr1.patch
10diff --git a/debian/patches/ubuntu_nvidia_prime.patch b/debian/patches/ubuntu_nvidia_prime.patch
11index d2588b1..bf60c76 100644
12--- a/debian/patches/ubuntu_nvidia_prime.patch
13+++ b/debian/patches/ubuntu_nvidia_prime.patch
14@@ -1,24 +1,25 @@
15 From: Tim Lunn <tim@feathertop.org>
16 Date: Sat, 22 Mar 2014 10:23:12 +1100
17-Subject: Add hook to run prime-offload (as root) move Prime helpers into the
18- gdm-x-session wrapper
19-
20++Subject: Add hooks to run prime scripts (as root) before and after a
21++ gdm-session
22+
23++This allows enabling and disabling the dGPU on log out.
24 ---
25- common/gdm-common.c | 2 +-
26- daemon/gdm-display.c | 1 +
27- daemon/gdm-x-session.c | 10 ++++++++++
28- data/Makefile.am | 24 ++++++++++++++++++++++++
29- data/Prime | 6 ++++++
30- data/PrimeOff | 6 ++++++
31+ common/gdm-common.c | 2 +-
32+ daemon/gdm-session.c | 6 ++++++
33+ daemon/gdm-x-session.c | 5 +++++
34+ data/Makefile.am | 24 ++++++++++++++++++++++++
35+ data/Prime | 6 ++++++
36+ data/PrimeOff | 6 ++++++
37 6 files changed, 48 insertions(+), 1 deletion(-)
38 create mode 100644 data/Prime
39 create mode 100644 data/PrimeOff
40
41-Index: gdm3-3.26.0/common/gdm-common.c
42+Index: gdm3-3.28.2/common/gdm-common.c
43 ===================================================================
44---- gdm3-3.26.0.orig/common/gdm-common.c 2017-09-14 08:24:10.584748891 -0400
45-+++ gdm3-3.26.0/common/gdm-common.c 2017-09-14 08:24:10.580748834 -0400
46-@@ -677,7 +677,7 @@ gdm_run_script (const char *dir,
47+--- gdm3-3.28.2.orig/common/gdm-common.c
48++++ gdm3-3.28.2/common/gdm-common.c
49+@@ -706,7 +706,7 @@
50 goto out;
51 }
52
53@@ -27,23 +28,28 @@ Index: gdm3-3.26.0/common/gdm-common.c
54 display_name,
55 display_hostname,
56 display_x11_authority_file);
57-Index: gdm3-3.26.0/daemon/gdm-x-session.c
58+Index: gdm3-3.28.2/daemon/gdm-session.c
59 ===================================================================
60---- gdm3-3.26.0.orig/daemon/gdm-x-session.c 2017-09-14 08:24:10.584748891 -0400
61-+++ gdm3-3.26.0/daemon/gdm-x-session.c 2017-09-14 08:24:10.580748834 -0400
62-@@ -172,6 +172,11 @@ on_x_server_finished (GSubprocess *subp
63- if (cancelled) {
64- goto out;
65- }
66-+ gdm_run_script (GDMCONFDIR "/PrimeOff", "root",
67-+ state->display_name,
68-+ NULL, /* hostname */
69-+ state->auth_file);
70+--- gdm3-3.28.2.orig/daemon/gdm-session.c
71++++ gdm3-3.28.2/daemon/gdm-session.c
72+@@ -2865,6 +2865,12 @@
73+
74+ g_list_free_full (self->priv->outside_connections, g_object_unref);
75+ self->priv->outside_connections = NULL;
76 +
77++ /* Run PrimeOff after the session is closed */
78++ gdm_run_script (GDMCONFDIR "/PrimeOff", "root",
79++ NULL,
80++ NULL,
81++ NULL);
82+ }
83
84- if (g_subprocess_get_if_exited (subprocess)) {
85- int exit_status;
86-@@ -614,6 +619,11 @@ spawn_session (State *state,
87+ void
88+Index: gdm3-3.28.2/daemon/gdm-x-session.c
89+===================================================================
90+--- gdm3-3.28.2.orig/daemon/gdm-x-session.c
91++++ gdm3-3.28.2/daemon/gdm-x-session.c
92+@@ -614,6 +614,11 @@
93
94 g_debug ("Running X session");
95
96@@ -55,11 +61,11 @@ Index: gdm3-3.26.0/daemon/gdm-x-session.c
97 launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
98
99 if (state->environment != NULL) {
100-Index: gdm3-3.26.0/data/Makefile.am
101+Index: gdm3-3.28.2/data/Makefile.am
102 ===================================================================
103---- gdm3-3.26.0.orig/data/Makefile.am 2017-09-14 08:24:10.584748891 -0400
104-+++ gdm3-3.26.0/data/Makefile.am 2017-09-14 08:24:10.584748891 -0400
105-@@ -10,6 +10,8 @@ SUBDIRS = \
106+--- gdm3-3.28.2.orig/data/Makefile.am
107++++ gdm3-3.28.2/data/Makefile.am
108+@@ -10,6 +10,8 @@
109 initdir = $(gdmconfdir)/Init
110 postdir = $(gdmconfdir)/PostSession
111 predir = $(gdmconfdir)/PreSession
112@@ -68,7 +74,7 @@ Index: gdm3-3.26.0/data/Makefile.am
113 postlogindir = $(gdmconfdir)/PostLogin
114 workingdir = $(GDM_WORKING_DIR)
115 xauthdir = $(GDM_XAUTH_DIR)
116-@@ -172,6 +174,8 @@ EXTRA_DIST += \
117+@@ -173,6 +175,8 @@
118 Xsession.in \
119 Init.in \
120 PreSession.in \
121@@ -77,7 +83,7 @@ Index: gdm3-3.26.0/data/Makefile.am
122 PostSession.in \
123 PostLogin \
124 org.gnome.login-screen.gschema.xml.in \
125-@@ -236,6 +240,8 @@ uninstall-hook:
126+@@ -237,6 +241,8 @@
127 $(DESTDIR)$(initdir)/Default \
128 $(DESTDIR)$(postlogindir)/Default.sample \
129 $(DESTDIR)$(predir)/Default \
130@@ -86,7 +92,7 @@ Index: gdm3-3.26.0/data/Makefile.am
131 $(DESTDIR)$(postdir)/Default \
132 $(DESTDIR)$(sysconfdir)/dconf/db/gdm \
133 $(DESTDIR)$(sysconfdir)/dconf/profile/gdm \
134-@@ -282,6 +288,24 @@ endif
135+@@ -283,6 +289,24 @@
136 fi
137 $(INSTALL_SCRIPT) PreSession $(DESTDIR)$(predir)/Default
138
139@@ -111,10 +117,10 @@ Index: gdm3-3.26.0/data/Makefile.am
140 if test '!' -d $(DESTDIR)$(postdir); then \
141 $(mkinstalldirs) $(DESTDIR)$(postdir); \
142 chmod 755 $(DESTDIR)$(postdir); \
143-Index: gdm3-3.26.0/data/Prime
144+Index: gdm3-3.28.2/data/Prime
145 ===================================================================
146---- /dev/null 1970-01-01 00:00:00.000000000 +0000
147-+++ gdm3-3.26.0/data/Prime 2017-09-14 08:24:10.584748891 -0400
148+--- /dev/null
149++++ gdm3-3.28.2/data/Prime
150 @@ -0,0 +1,6 @@
151 +#!/bin/sh
152 +
153@@ -122,10 +128,10 @@ Index: gdm3-3.26.0/data/Prime
154 +if [ -f "$primeoffload" ]; then
155 + $primeoffload
156 +fi
157-Index: gdm3-3.26.0/data/PrimeOff
158+Index: gdm3-3.28.2/data/PrimeOff
159 ===================================================================
160---- /dev/null 1970-01-01 00:00:00.000000000 +0000
161-+++ gdm3-3.26.0/data/PrimeOff 2017-09-14 08:24:10.584748891 -0400
162+--- /dev/null
163++++ gdm3-3.28.2/data/PrimeOff
164 @@ -0,0 +1,6 @@
165 +#!/bin/sh
166 +
167diff --git a/debian/patches/unblock-sigusr1.patch b/debian/patches/unblock-sigusr1.patch
168new file mode 100644
169index 0000000..3a4104c
170--- /dev/null
171+++ b/debian/patches/unblock-sigusr1.patch
172@@ -0,0 +1,68 @@
173+Description: session-worker: unblock SIGUSR1 before PAM
174+ Right now we unblock SIGUSR1 just before starting
175+ the session, but we should really do it before
176+ starting the worker/PAM.
177+
178+ This commit fixes that and removes a useless call
179+ to set SIGUSR1 back to the default disposition,
180+ right before exec (which does the same thing anyway)
181+ .
182+
183+Origin: upstream, https://gitlab.gnome.org/GNOME/gdm/commit/b0d1ca9ebf605abb63b95ef73d56d56a1109002e
184+Bug: https://gitlab.gnome.org/GNOME/gdm/issues/399
185+Bug-Debian: https://bugs.debian.org/905277
186+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1782152
187+Last-Update: 2018-07-23
188+--- a/daemon/gdm-session-worker-job.c
189++++ b/daemon/gdm-session-worker-job.c
190+@@ -117,12 +117,19 @@
191+ static void
192+ session_worker_job_child_setup (GdmSessionWorkerJob *session_worker_job)
193+ {
194++ sigset_t mask;
195+ session_worker_job_setup_journal_fds ();
196+
197+ /* Terminate the process when the parent dies */
198+ #ifdef HAVE_SYS_PRCTL_H
199+ prctl (PR_SET_PDEATHSIG, SIGTERM);
200+ #endif
201++ /*
202++ * Reset signal mask to default since it was altered by the
203++ * manager process
204++ */
205++ sigemptyset (&mask);
206++ sigprocmask (SIG_SETMASK, &mask, NULL);
207+ }
208+
209+ static void
210+--- a/daemon/gdm-session-worker.c
211++++ b/daemon/gdm-session-worker.c
212+@@ -2025,8 +2025,6 @@
213+ char *home_dir;
214+ int stdin_fd = -1, stdout_fd = -1, stderr_fd = -1;
215+ gboolean has_journald = FALSE, needs_controlling_terminal = FALSE;
216+- sigset_t mask;
217+-
218+ /* Leak the TTY into the session as stdin so that it stays open
219+ * without any races. */
220+ if (worker->priv->session_tty_fd > 0) {
221+@@ -2147,19 +2145,6 @@
222+ */
223+ signal (SIGPIPE, SIG_DFL);
224+
225+- /*
226+- * Reset SIGUSR1 to default since it was blocked by the manager
227+- * process for the X server startup handshake
228+- */
229+- signal (SIGUSR1, SIG_DFL);
230+-
231+- /*
232+- * Reset signal mask to default since it was altered by the
233+- * manager process
234+- */
235+- sigemptyset (&mask);
236+- sigprocmask (SIG_SETMASK, &mask, NULL);
237+-
238+ gdm_session_execute (worker->priv->arguments[0],
239+ worker->priv->arguments,
240+ (char **)

Subscribers

People subscribed via source and target branches