git: kernel - Add requires p->p_token locking and holds around fork()'s child proc
Matthew Dillon
dillon at crater.dragonflybsd.org
Wed Nov 30 17:35:19 PST 2011
commit de7ac1d675b7dd4a7e0108b0482570e5ec02afc1
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Wed Nov 30 17:24:11 2011 -0800
kernel - Add requires p->p_token locking and holds around fork()'s child proc
* fork() and vfork() allocate a new process, p2, initialize, and add it to
the allproc list as well as other lists.
* These functions failed to acquire p2's token, p2 becomes visible to the
rest of the system when it's added to the allproc list. Even though p2's
state is set to SIDL, this is insufficient protection.
Acquire the token prior to adding p2 to allproc and keep holding the token
until after we have finished initializing p2.
* We must also PHOLD()/PRELE() p2 around the start_forked_proc() call
to prevent it from getting ripped out from under us (if it exits
quickly and/or detaches itself from its parent).
* Possibly fixes the random seg-faulting issue we've seen under very heavy
fork/exec (parallel compile) loads on the 48-core monster.
Summary of changes:
sys/kern/kern_fork.c | 88 ++++++++++++++++++++++++++++++++-----------------
1 files changed, 57 insertions(+), 31 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/de7ac1d675b7dd4a7e0108b0482570e5ec02afc1
--
DragonFly BSD source repository
More information about the Commits
mailing list