SIGCHLD in pam_unix.so

Solar Designer solar at openwall.com
Tue May 4 17:29:10 UTC 2004


On Tue, May 04, 2004 at 06:35:17PM +0200, Johannes Wei??l wrote:
> It seems that passing SIG_IGN to SIGCHLD in
> modules/pam_unix/support.c line 456 prevents invoking the
> helper binary from working - strace cut-out:
[...]
> rt_sigaction(SIGCHLD, {SIG_IGN}, {SIG_DFL}, 8) = 0

FWIW, in pam_tcb, we're setting SIGCHLD to SIG_DFL and not to SIG_IGN
for the execution of the helper binary and it works OK.

Setting SIGCHLD to SIG_IGN should be avoided because AFAIR it's
invalid per POSIX and might enable the following different behavior
for waitpid() per SUSv3:

| If the calling process has SA_NOCLDWAIT set or has
| SIGCHLD set to SIG_IGN, and the process has no unwaited-for children
| that were transformed into zombie processes, the calling thread shall
| block until all of the children of the process containing the calling
| thread terminate, and wait() and waitpid() shall fail and set errno to
| ECHILD.

As the default for SIGCHLD is to ignore the signal, SIG_DFL should be
used instead of SIG_IGN to avoid any surprises.

-- 
/sd





More information about the Pam-list mailing list