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)
This commit is contained in:
Olivier Houchard 2004-01-09 23:42:36 +00:00
parent 63bfa8ba2c
commit 5cded90454
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124319

View File

@ -591,6 +591,7 @@ fork1(td, flags, pages, procp)
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);