[Pkg-xfce-devel] Bug#823460: Bug#823460: lightdm: SIGPIPE ignored in session

Ian Jackson ijackson at chiark.greenend.org.uk
Sun May 8 15:34:35 UTC 2016


Ian Jackson writes ("Re: [Pkg-xfce-devel] Bug#823460: lightdm: SIGPIPE ignored in session"):
> As previously discussed here, the ignoring of SIGPIPE doesn't seem to
> be done explicitly in the lightdm source code.  Having established
> that it is (almost certainly) the lightdm process which is responsible
> I will now attempt to find that out.

It seems to be done by glib.  I found this in the glib2.0 source code:

 * Note that creating a #GSocket causes the signal %SIGPIPE to be
 * ignored for the remainder of the program. If you are writing a
 * command-line utility that uses #GSocket, you may need to take into
 * account the fact that your program will not automatically be killed
 * if it tries to write to %stdout after it has been closed.

(gio/gsocket.c from 2.48.0-1).  This seems also to be documented in
docs/reference/gio/html/GSocket.html.

glib2.0 provides g_spawn* functions which unconditionally put SIGPIPE
back.  (glib/gspawn.c)

I think glib does this because it's difficult to portably avoid
SIGPIPE from sockets as a library which might be running in a
multithreaded program.  I have some sympathy with this view.  I don't
want to call this a bug in glib.

The upshot is that programs which:
  1. use glib;
  2. spawn other programs other than by using glib_spawn
need to reset SIGPIPE themselves.  (The same might be true of other
libraries besides glib).

So I think this is indeed a bug in lightdm.

Do you want me to send you a patch ?

Thanks,
Ian.

PS here is an example backtrace from lightdm.  AFAICT that SIGPIPE is
set to IGN several times, in various different processes in lightdm's
process farm.  All the backtraces I obtained (by playing about with
`set follow-fork-mode') seemed to implicate gio.

(gdb) bt
#0  __bsd_signal (sig=13, handler=0x1) at ../sysdeps/posix/signal.c:36
#1  0x00007ffff7aca42b in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#2  0x00007ffff783022d in g_type_class_ref () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3  0x00007ffff78173a4 in g_object_new_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4  0x00007ffff7ab19fe in g_initable_new_valist () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#5  0x00007ffff7ab1ac6 in g_initable_new () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#6  0x00007ffff7acb138 in g_socket_new () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#7  0x00007ffff7ad10a8 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#8  0x00007ffff7ad22b3 in g_socket_client_connect () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#9  0x00007ffff7b1b05d in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#10 0x00007ffff7b1b5f8 in g_dbus_address_get_stream_sync () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#11 0x00007ffff7b2c057 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#12 0x00007ffff7a89f9e in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#13 0x00007ffff7adb2fd in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#14 0x00007ffff756050e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff755fb75 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff676d454 in start_thread (arg=0x7ffff48ce700) at pthread_create.c:334
#17 0x00007ffff64aaeed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb)



More information about the Pkg-xfce-devel mailing list