Ian Jackson writes ("Re: [Pkg-xfce-devel] Bug#823460: lightdm: SIGPIPE ignored in session"): > I have a plan for how to track this down further. I will get back to > you.
I applied the attached patch below to my libc, and created the logfile /var/log/exec-sigignblock.log world-writeable, and rebooted. An extract from the logfile is also attached. The first line which mentions lightdm is this one: 2016-04-08 12:15:12 UTC:/bin/sh[3344] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN Note that that shell process almost immmediately spawns Xorg. This allows us to conclude: 1. When lightdm is first execd by whatever spawns it, it does NOT inherit SIGPIPE set to SIG_IGN. If this weren't the case there would be a message about lightdm being execd oddly, before lightdm itself execs anything else. 2. lightdm is definitely executing Xorg with SIGPIPE set to SIG_IGN. This is IMO a bug. It is a less serious bug than running the user's session this way because the X server probablhy doesn't spawn that many other processes (so that the bug can only influence a limited set of processes), and the X server probably runs with SIGPIPE ignored anyway (so that while this is wrong, there is no actual adverse consequence). Further on, we see; 2016-04-08 12:15:22 UTC:/bin/bash[4164] execd oddly (parent Permission denied[4155]): Broken pipe: SIG_IGN and then 4164 execs a lot of things which are part of my .xsession. The prior report about pid 4155 is 2016-04-08 12:15:20 UTC:lightdm[4155] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN Ie, 4164 was spawned by lightdm, and is running as a different user (so the readlink of /proc/4155/exe failed). lightdm is of course entitled to exec itself with SIGPIPE ignored if it so chooses, but that (almost conclusively) proves that it is the lightdm process which is at fault. The only way in which it could be someone else's fault is if lightdm forked 4155, and execed some other program with PIPE=DFL (which wouldn't show up in my log), and that other program set PIPE=IGN and in turn execed lightdm. Then the bug would be in that other program. I don't think this is at all likely. 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. Incidentally, the log contains a lot of messages like this: 2016-04-08 12:15:12 UTC:/sbin/wpa_supplicant[3350] execd oddly (parent /usr/bin/dbus-daemon[3349]): Broken pipe: SIG_IGN I think this is a separate bug. Unless lightdm is spawned from dbus somehow, I don't think this can be responsible for my session having PIPE=IGN. Furthermore, if this was the root cause of the bug I would expect to see a complaint about the initial parent lightdm itself being execed oddly. Watch this space for more information. Ian.
diff --git a/csu/init-first.c b/csu/init-first.c index b3bacdd..751fc5a 100644 --- a/csu/init-first.c +++ b/csu/init-first.c @@ -39,6 +39,92 @@ int __libc_argc attribute_hidden; char **__libc_argv attribute_hidden; +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <time.h> + +static void +__libc_check_sigpipe (const char *argv0) +{ + static const int sigs[] = { SIGPIPE, SIGTERM, SIGALRM, 9 }; + const int *sigp; + int sig; + struct sigaction sa; + sigset_t mask; + int r; + const char *oddity; + + sig = 0; + r = sigprocmask(SIG_UNBLOCK, 0, &mask); + if (r) { oddity = strerror(errno); goto bad; } + + for (sigp = sigs; (sig = *sigp); sigp++) { + r = sigaction(SIGPIPE, 0, &sa); + if (r) { oddity = strerror(errno); goto bad; } + if (sa.sa_handler == SIG_IGN) { oddity = "SIG_IGN"; goto bad; } + if (sigismember(&mask, sig)) { oddity = "blocked"; goto bad; } + } + return; + + bad:; + int logfd = -1; + FILE *logf = 0; + + logfd = open("/var/log/exec-sigignblock.log", O_APPEND|O_WRONLY); + if (logfd < 0) + if (errno == ENOENT || errno == EACCES || errno == EPERM) + return; + + logf = fdopen(logfd, "a"); + if (!logf) goto fail; + logfd = -1; /* eaten by fdopen */ + + unsigned long ourpid = getpid(); + unsigned long ppid = getppid(); + char parentbuf[100]; + + snprintf(parentbuf, sizeof(parentbuf), "/proc/%lu/exe", ppid); + r = readlink(parentbuf, parentbuf, sizeof(parentbuf)-1); + if (r < 0) { + const char *m = strerror(errno); + strncpy(parentbuf, m, sizeof(parentbuf)-1); + parentbuf[sizeof(parentbuf)-1] = 0; + } else if (r == 0) { + strcpy(parentbuf, "\"\""); + } else { + parentbuf[r] = 0; + } + + time_t now; + now = time(NULL); + if (now == (time_t)-1) { errno = EIO; goto fail; } + + struct tm *gmt = gmtime(&now); + if (!gmt) goto fail; + + r = fprintf(logf, "%04d-%02d-%02d %02d:%02d:%02d UTC:" + "%s[%lu] execd oddly (parent %s[%lu]): %s: %s\n", + gmt->tm_year+1900, gmt->tm_mon, gmt->tm_mday, + gmt->tm_hour, gmt->tm_min, gmt->tm_sec, + argv0, ourpid, + parentbuf, ppid, + sig ? strsignal(sig) : "sigprocmask", oddity); + if (r < 0) goto fail; + + r = fclose(logf); + logf = 0; + if (r) goto fail; + + return; + + fail: + perror("__libc_check_sigpipe report oddity"); + if (logf) fclose(logf); + if (logfd>=0) close(logfd); + return; +} + void __libc_init_first (int argc, char **argv, char **envp) { @@ -96,6 +182,8 @@ _init (int argc, char **argv, char **envp) #if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS __libc_global_ctors (); #endif + + __libc_check_sigpipe (argv[0]); } /* This function is defined here so that if this file ever gets into diff --git a/debian/changelog b/debian/changelog index f552f26..33a6254 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +glibc (2.22-7+iwj) UNRELEASED; urgency=medium + + * SIGPIPE tracking + + -- Ian Jackson <ijack...@chiark.greenend.org.uk> Sun, 08 May 2016 12:43:46 +0100 + glibc (2.22-7) unstable; urgency=medium [ Samuel Thibault ] diff --git a/debian/shlibs-add-udebs b/debian/shlibs-add-udebs old mode 100644 new mode 100755
2016-04-08 12:13:21 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[12813] execd oddly (parent /usr/bin/dbus-daemon[12790]): Broken pipe: SIG_IGN 2016-04-08 12:13:21 UTC:/usr/lib/x86_64-linux-gnu/systemd-shim[12813] execd oddly (parent /usr/bin/dbus-daemon[12790]): Broken pipe: SIG_IGN 2016-04-08 12:13:21 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[12911] execd oddly (parent /usr/bin/dbus-daemon[12905]): Broken pipe: SIG_IGN 2016-04-08 12:13:21 UTC:/usr/lib/NetworkManager/nm-dispatcher[12911] execd oddly (parent /usr/bin/dbus-daemon[12905]): Broken pipe: SIG_IGN 2016-04-08 12:13:24 UTC:/run/cgmanager/agents/cgm-release-agent.systemd[13682] execd oddly (parent No such file or directory[2]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[2826] execd oddly (parent /usr/bin/dbus-daemon[2824]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/lib/systemd/systemd-hostnamed[2826] execd oddly (parent /usr/bin/dbus-daemon[2824]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[2915] execd oddly (parent /usr/bin/dbus-daemon[2913]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/NetworkManager/nm-dispatcher[2915] execd oddly (parent /usr/bin/dbus-daemon[2913]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:(pinger)[3213] execd oddly (parent /usr/sbin/squid[3079]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/sbin/exim4[3250] execd oddly (parent /usr/sbin/exim4[3248]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[3312] execd oddly (parent /usr/bin/dbus-daemon[3311]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/bin/sh[3312] execd oddly (parent /usr/bin/dbus-daemon[3311]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:mkdir[3317] execd oddly (parent /bin/dash[3312]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/lib/systemd/systemd-logind[3312] execd oddly (parent /usr/bin/dbus-daemon[3311]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[3327] execd oddly (parent /usr/bin/dbus-daemon[3326]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/x86_64-linux-gnu/systemd-shim[3327] execd oddly (parent /usr/bin/dbus-daemon[3326]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/bin/sh[3344] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/xorg/Xorg[3344] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[3348] execd oddly (parent /usr/bin/dbus-daemon[3347]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/dbus-1.0/dbus-daemon-launch-helper[3350] execd oddly (parent /usr/bin/dbus-daemon[3349]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/lib/policykit-1/polkitd[3348] execd oddly (parent /usr/bin/dbus-daemon[3347]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/sbin/wpa_supplicant[3350] execd oddly (parent /usr/bin/dbus-daemon[3349]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:sh[3471] execd oddly (parent /usr/lib/xorg/Xorg[3344]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/bin/xkbcomp[3473] execd oddly (parent /bin/dash[3471]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:sh[3530] execd oddly (parent /usr/lib/xorg/Xorg[3344]): Broken pipe: SIG_IGN 2016-04-08 12:15:12 UTC:/usr/bin/xkbcomp[3531] execd oddly (parent /bin/dash[3530]): Broken pipe: SIG_IGN 2016-04-08 12:15:13 UTC:lightdm[3713] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN 2016-04-08 12:15:15 UTC:/usr/lib/NetworkManager/nm-dhcp-helper[3976] execd oddly (parent /sbin/dhclient[3952]): Broken pipe: SIG_IGN 2016-04-08 12:15:15 UTC:/usr/lib/NetworkManager/nm-dhcp-helper[4026] execd oddly (parent /sbin/dhclient[3952]): Broken pipe: SIG_IGN 2016-04-08 12:15:16 UTC:lightdm[4148] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN 2016-04-08 12:15:20 UTC:lightdm[4155] execd oddly (parent /usr/sbin/lightdm[3294]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/gnome-keyring-daemon[4160] execd oddly (parent Permission denied[4155]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/bin/sh[4164] execd oddly (parent Permission denied[4155]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:touch[4165] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:chmod[4166] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:date[4167] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:tempfile[4168] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:rm[4169] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:run-parts[4170] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:cat[4171] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:run-parts[4172] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:xrdb[4173] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:sh[4174] execd oddly (parent /usr/bin/xrdb[4173]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/cpp[4175] execd oddly (parent /bin/dash[4174]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/lib/gcc/x86_64-linux-gnu/5/cc1[4176] execd oddly (parent /usr/bin/cpp-5[4175]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:id[4177] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:xhost[4178] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:basename[4180] execd oddly (parent /bin/dash[4179]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:cut[4181] execd oddly (parent /bin/dash[4179]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/xdg-user-dirs-update[4183] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/dbus-launch[4184] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/xbrlapi[4182] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/dbus-daemon[4186] execd oddly (parent /usr/bin/dbus-launch[4185]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/unclutter[4189] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:dbus-update-activation-environment[4190] execd oddly (parent /bin/dash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/ssh-agent[4164] execd oddly (parent Permission denied[4155]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/bin/bash[4164] execd oddly (parent Permission denied[4155]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:hostname[4193] execd oddly (parent /bin/bash[4192]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:rm[4194] execd oddly (parent /bin/bash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/bin/sh[4195] execd oddly (parent /bin/bash[4164]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:hostname[4196] execd oddly (parent /bin/dash[4195]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:cat[4197] execd oddly (parent /bin/dash[4195]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:/usr/bin/perl[4198] execd oddly (parent /bin/dash[4195]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:tee[4199] execd oddly (parent /bin/dash[4195]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:xauth[4200] execd oddly (parent /usr/bin/perl[4198]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:xdpyinfo[4201] execd oddly (parent /usr/bin/perl[4198]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:uname[4202] execd oddly (parent /usr/bin/perl[4198]): Broken pipe: SIG_IGN 2016-04-08 12:15:22 UTC:rm[4203] execd oddly (parent /bin/dash[4195]): Broken pipe: SIG_IGN
_______________________________________________ Pkg-xfce-devel mailing list Pkg-xfce-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-xfce-devel