Merge lp:~mterry/lightdm/initialize-more into lp:lightdm

Proposed by Michael Terry
Status: Merged
Merged at revision: 2322
Proposed branch: lp:~mterry/lightdm/initialize-more
Merge into: lp:lightdm
Diff against target: 50 lines (+6/-8)
2 files modified
src/greeter-session.c (+0/-6)
src/unity-system-compositor.c (+6/-2)
To merge this branch: bzr merge lp:~mterry/lightdm/initialize-more
Reviewer Review Type Date Requested Status
Robert Ancell Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+296836@code.launchpad.net

Commit message

Be more careful about closing uninitialized memory.

Description of the change

Be more careful about closing uninitialized memory.

It caused problems for Josh and me:
- lightdm calls close(0) because of unintialized/zero-initialized memory used as an argument to close()
- pipe() and similar methods are happy to give back fd=0 now
- lightdm may provide USC with --from-dm-fd=0 because it got back 0 from pipe
- USC can't actually write to fd=0 because that's its stdin and isn't inherited like other fds
- USC aborts because it can't open from-dm-fd for writing

Thanks to Josh for finding this fix with me.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Thanks guys!

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I've merged the second half of this patch into the 1.18, 1.16 and 1.10 branches.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/greeter-session.c'
2--- src/greeter-session.c 2016-05-19 02:01:57 +0000
3+++ src/greeter-session.c 2016-06-08 18:12:45 +0000
4@@ -20,10 +20,6 @@
5 {
6 /* Greeter running inside this session */
7 Greeter *greeter;
8-
9- /* Communication channels to communicate with */
10- int to_greeter_input;
11- int from_greeter_output;
12 };
13
14 G_DEFINE_TYPE (GreeterSession, greeter_session, SESSION_TYPE);
15@@ -88,8 +84,6 @@
16 GreeterSession *self = GREETER_SESSION (object);
17
18 g_clear_object (&self->priv->greeter);
19- close (self->priv->to_greeter_input);
20- close (self->priv->from_greeter_output);
21
22 G_OBJECT_CLASS (greeter_session_parent_class)->finalize (object);
23 }
24
25=== modified file 'src/unity-system-compositor.c'
26--- src/unity-system-compositor.c 2016-05-26 00:36:33 +0000
27+++ src/unity-system-compositor.c 2016-06-08 18:12:45 +0000
28@@ -435,9 +435,9 @@
29
30 /* Close compostor ends of the pipes */
31 close (compositor->priv->to_compositor_pipe[0]);
32- compositor->priv->to_compositor_pipe[0] = 0;
33+ compositor->priv->to_compositor_pipe[0] = -1;
34 close (compositor->priv->from_compositor_pipe[1]);
35- compositor->priv->from_compositor_pipe[1] = 0;
36+ compositor->priv->from_compositor_pipe[1] = -1;
37
38 if (!result)
39 return FALSE;
40@@ -466,6 +466,10 @@
41 compositor->priv->command = g_strdup ("unity-system-compositor");
42 compositor->priv->socket = g_strdup ("/run/mir_socket");
43 compositor->priv->timeout = -1;
44+ compositor->priv->to_compositor_pipe[0] = -1;
45+ compositor->priv->to_compositor_pipe[1] = -1;
46+ compositor->priv->from_compositor_pipe[0] = -1;
47+ compositor->priv->from_compositor_pipe[1] = -1;
48 }
49
50 static void

Subscribers

People subscribed via source and target branches