Don't try to kill embryonic processes in killpg1(). This prevents

a race condition between fork() and kill(pid,sig) with pid < 0 that
can cause a kernel panic.

Submitted by:	up
MFC after:	3 weeks
This commit is contained in:
Paul Saab 2006-04-21 19:26:21 +00:00
parent 2237f11344
commit 95f16c1e2c

View File

@ -1674,7 +1674,7 @@ killpg1(td, sig, pgid, all)
LIST_FOREACH(p, &allproc, p_list) {
PROC_LOCK(p);
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
p == td->td_proc) {
p == td->td_proc || p->p_state == PRS_NEW) {
PROC_UNLOCK(p);
continue;
}
@ -1704,7 +1704,8 @@ killpg1(td, sig, pgid, all)
sx_sunlock(&proctree_lock);
LIST_FOREACH(p, &pgrp->pg_members, p_pglist) {
PROC_LOCK(p);
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM) {
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
p->p_state == PRS_NEW ) {
PROC_UNLOCK(p);
continue;
}