summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2004-01-09 23:42:36 +0000
committercognet <cognet@FreeBSD.org>2004-01-09 23:42:36 +0000
commitced43cb5e7d590052db072cdd9bebbaf40619298 (patch)
tree418892cb2fb8a59040e9fe6ce387235fc96d64d0 /sys/kern/kern_fork.c
parent9478f5db75514aaf5076d354ab7c0efdfbc11f4f (diff)
downloadFreeBSD-src-ced43cb5e7d590052db072cdd9bebbaf40619298.zip
FreeBSD-src-ced43cb5e7d590052db072cdd9bebbaf40619298.tar.gz
Prevent a race condition between fork1() and whatever changes the pgrp by
setting the new process' p_pgrp again before inserting it in the p_pglist. Without it we can get the new process to be inserted in a different p_pglist than the one p2->p_pgrp points to, and this is not something we want to happen. This is not a fix, merely a bandaid, but it will work until someone finds a better way to do it. Discussed with: jhb (a long time ago)
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index ed1b4c6..ced9b28 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -591,6 +591,7 @@ again:
if (flags & RFPPWAIT)
p2->p_flag |= P_PPWAIT;
+ p2->p_pgrp = p1->p_pgrp;
LIST_INSERT_AFTER(p1, p2, p_pglist);
PGRP_UNLOCK(p1->p_pgrp);
LIST_INIT(&p2->p_children);
OpenPOWER on IntegriCloud