When delivering a signal, it's possible that the process's state in

p_stat is SACTIVE yet p_sflag is PS_STOPPING (while waiting for other
lwp's to stop).  In that case, we don't want to adjust the parent's
p_nstopchild count.

Found by Robert Elz.

XXX Pullups to: NetBSD-7, -6{,-0,-1}, and -5{,-0,-1,-2}
This commit is contained in:
pgoyette 2015-10-13 07:00:59 +00:00
parent d3abaa577e
commit 764be6be1d
1 changed files with 6 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sig.c,v 1.320 2015/10/02 16:54:15 christos Exp $ */
/* $NetBSD: kern_sig.c,v 1.321 2015/10/13 07:00:59 pgoyette Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.320 2015/10/02 16:54:15 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.321 2015/10/13 07:00:59 pgoyette Exp $");
#include "opt_ptrace.h"
#include "opt_dtrace.h"
@ -1359,14 +1359,13 @@ kpsignal2(struct proc *p, ksiginfo_t *ksi)
}
if ((prop & SA_CONT) != 0 || signo == SIGKILL) {
/*
* Re-adjust p_nstopchild if the process wasn't
* collected by its parent.
* Re-adjust p_nstopchild if the process was
* stopped but not yet collected by its parent.
*/
if (p->p_stat == SSTOP && !p->p_waited)
p->p_pptr->p_nstopchild--;
p->p_stat = SACTIVE;
p->p_sflag &= ~PS_STOPPING;
if (!p->p_waited) {
p->p_pptr->p_nstopchild--;
}
if (p->p_slflag & PSL_TRACED) {
KASSERT(signo == SIGKILL);
goto deliver;