kernel - Fix a few MP races against process status
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 6 Mar 2011 00:05:20 +0000 (16:05 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 6 Mar 2011 00:05:20 +0000 (16:05 -0800)
commit0d78b86e0a2315042ff35cf013868289cb1c7acf
treec62ff6d047199bace980c37e9b416ce59ef06f25
parent7c75e4b97eedf419709b08e4d037ee1526bffe45
kernel - Fix a few MP races against process status

* proc->p_token is required when traversing p->p_lwp_tree.

* Reorder lwp insertion on lwp_fork() so scan races see a whole lwp
  instead of a partially initialized one.

* Check for NULL p->p_pgrp and friends when only using proc_token to
  scan the process list to deal with new processes that are still in the
  middle of being fork()'d.

Reported-by: Peter Avalos <peter@theshell.com>,
     Antonio Huete Jimenez <tuxillo@crater.dragonflybsd.org>
sys/kern/kern_fork.c
sys/kern/kern_proc.c
sys/kern/kern_synch.c