kernel - Fix improper vgone() in procfs and races in truss
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 29 Dec 2009 23:50:39 +0000 (15:50 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 29 Dec 2009 23:50:39 +0000 (15:50 -0800)
commite193508c7255b6262b69e52689a301312ad53178
tree87f53ba946160485874acc0c814245e15398ec0a
parent7a5447efdc27c4f13647d347270714ea6c0acce9
kernel - Fix improper vgone() in procfs and races in truss

* procfs was trying to destroy the vnodes associated with exiting pids,
  ripping them out from under active users.  This is no longer legal.

  Instead flag it for the exiting pid so further operations fail.

* procfs's stopevents handling for process tracing was not MPSAFE
  and raced against MPSAFE system call entry points.  This led to
  numerous situations where gdb or truss would get stuck, or where
  the process getting traced would get stuck.

  Make the whole mess MPSAFE by protecting the tests against proc->p_spin.

* Note that the platform trap case is optimized to only acquire p_spin
  once it has been determined that a stopevent might be pending.

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
sys/kern/sys_process.c
sys/vfs/procfs/procfs.h
sys/vfs/procfs/procfs_subr.c
sys/vfs/procfs/procfs_vnops.c