[Bug 1397250] Re: SIGPIPE not caught in do_atfork_child()

Marcello Blancasio marcello.blancasio at gmail.com
Fri Aug 28 16:07:22 UTC 2015


@jon.grimm

I can reproduce after I set up LDAP server and client to use StartTLS.
In plain setup, no write to non-connected socket is issued in the
atfork handlers of child process, so no SIGPIPE is raised.

On Wed, Aug 26, 2015 at 7:45 PM, Jon Grimm <jon.grimm at canonical.com> wrote:
> @brianquigley, Thanks for responding. Indeed, may have to wait unless I
> can find someone that can reproduce and/or speak to impacting them
> rather than theoretical.
>
> FWIW, debian sid has 265.. and does not have a patch with the fix yet
> either.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1397250
>
> Title:
>   SIGPIPE not caught in do_atfork_child()
>
> Status in nss_ldap:
>   Fix Released
> Status in libnss-ldap package in Ubuntu:
>   Triaged
>
> Bug description:
>   Ubuntu version: Ubuntu 14.04.1 LTS
>   Package version: libnss-ldap_264-2.2ubuntu4
>
>   If a process using libnss-ldap calls fork() and SIGPIPE was blocked, the atfork() handler in the child process failed to catch the SIGPIPE as it was supposed to do, that is in the call to  do_close_no_unbind().  So that, the uncaught SIGPIPE will be eventually
>   delivered when the child unblocks signals. This usually make the child process die unexpectedly.
>
>   I found a well-known Linux vendor fixed this issue with the following
>   patch. This unblocks the SIGPIPE before calling do_close_no_unbind()
>   and restores 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");
>    }
>
>   I'd like to see this patch applied.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nss-ldap/+bug/1397250/+subscriptions

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to libnss-ldap in Ubuntu.
https://bugs.launchpad.net/bugs/1397250

Title:
  SIGPIPE not caught in do_atfork_child()

Status in nss_ldap:
  Fix Released
Status in libnss-ldap package in Ubuntu:
  Triaged

Bug description:
  Ubuntu version: Ubuntu 14.04.1 LTS
  Package version: libnss-ldap_264-2.2ubuntu4

  If a process using libnss-ldap calls fork() and SIGPIPE was blocked, the atfork() handler in the child process failed to catch the SIGPIPE as it was supposed to do, that is in the call to  do_close_no_unbind().  So that, the uncaught SIGPIPE will be eventually
  delivered when the child unblocks signals. This usually make the child process die unexpectedly.

  I found a well-known Linux vendor fixed this issue with the following
  patch. This unblocks the SIGPIPE before calling do_close_no_unbind()
  and restores 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");
   }

  I'd like to see this patch applied.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nss-ldap/+bug/1397250/+subscriptions



More information about the foundations-bugs mailing list