[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#748341: SIGPIPE handling in atfork()



Package: libnss-ldap
Version: 264-2.5

If a process calls fork() and SIGPIPE was blocked, the atfork()
handler in the child process failed to catch the SIGPIPE during the
call to  do_close_no_unbind(). So that, the SIGPIPE will be eventually
delivered when the child unblocks signals (and usually this makes
child process die).

I found someone fixed it patching to unblock the signal before calling
do_close_no_unbind() and restore the original sigmask afterwards:

diff -up nss_ldap/ldap-nss.c nss_ldap/ldap-nss.c
--- nss_ldap/ldap-nss.c 2009-12-07 20:57:33.000000000 -0500
+++ nss_ldap/ldap-nss.c 2009-12-07 20:58:56.000000000 -0500
@@ -532,8 +532,13 @@
 static void
 do_atfork_child (void)
 {
+  sigset_t unblock, mask;
   debug ("==> do_atfork_child");
+  sigemptyset(&unblock);
+  sigaddset(&unblock, SIGPIPE);
+  sigprocmask(SIG_UNBLOCK, &unblock, &mask);
   do_close_no_unbind ();
+  sigprocmask(SIG_SETMASK, &mask, NULL);
   _nss_ldap_leave ();
   debug ("<== do_atfork_child");
 }

Is it possible to apply that patch to the package?

__
Marcello Blancasio


Reply to: