1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-11 14:10:34 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157948

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;
}