diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-04-27 22:41:41 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-04-27 22:41:41 +0000 |
commit | 08fc3f3e820a5a51df7f3278a29c62bb1dc43501 (patch) | |
tree | ab3f8fe2b905f86c563bfbca269c90f5c83f3a4f /sys/kern/kern_sig.c | |
parent | cc7a68c868d5e86840533d81c70944fd3896aaea (diff) | |
download | FreeBSD-src-08fc3f3e820a5a51df7f3278a29c62bb1dc43501.zip FreeBSD-src-08fc3f3e820a5a51df7f3278a29c62bb1dc43501.tar.gz |
Avoid the user-visible effect of setting SA_NOCLDWAIT when the
SIGCHLD handler is SIG_IGN. This is a reimplementation of the
problematic revision 1.131 of kern_exit.c. To avoid accessing process
UPAGES, we set a new procsig flag when the SIGCHLD handler is SIG_IGN
and use that instead.
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 0011039..16c6fed 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -304,8 +304,7 @@ do_sigaction(p, sig, act, oact, old) p->p_procsig->ps_flag |= PS_NOCLDSTOP; else p->p_procsig->ps_flag &= ~PS_NOCLDSTOP; - if ((act->sa_flags & SA_NOCLDWAIT) || - ps->ps_sigact[_SIG_IDX(SIGCHLD)] == SIG_IGN) { + if (act->sa_flags & SA_NOCLDWAIT) { /* * Paranoia: since SA_NOCLDWAIT is implemented * by reparenting the dying child to PID 1 (and @@ -318,6 +317,10 @@ do_sigaction(p, sig, act, oact, old) p->p_procsig->ps_flag |= PS_NOCLDWAIT; } else p->p_procsig->ps_flag &= ~PS_NOCLDWAIT; + if (ps->ps_sigact[_SIG_IDX(SIGCHLD)] == SIG_IGN) + p->p_procsig->ps_flag |= PS_CLDSIGIGN; + else + p->p_procsig->ps_flag &= ~PS_CLDSIGIGN; } /* * Set bit in p_sigignore for signals that are set to SIG_IGN, @@ -499,7 +502,7 @@ execsigs(p) /* * Reset no zombies if child dies flag as Solaris does. */ - p->p_procsig->ps_flag &= ~PS_NOCLDWAIT; + p->p_procsig->ps_flag &= ~(PS_NOCLDWAIT | PS_CLDSIGIGN); if (ps->ps_sigact[_SIG_IDX(SIGCHLD)] == SIG_IGN) ps->ps_sigact[_SIG_IDX(SIGCHLD)] = SIG_DFL; PROC_UNLOCK(p); |