1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00
freebsd/sys/fs
John Baldwin 06ad42b2f7 Close some races between procfs/ptrace and exit(2):
- Reorder the events in exit(2) slightly so that we trigger the S_EXIT
  stop event earlier.  After we have signalled that, we set P_WEXIT and
  then wait for any processes with a hold on the vmspace via PHOLD to
  release it.  PHOLD now KASSERT()'s that P_WEXIT is clear when it is
  invoked, and PRELE now does a wakeup if P_WEXIT is set and p_lock drops
  to zero.
- Change proc_rwmem() to require that the processing read from has its
  vmspace held via PHOLD by the caller and get rid of all the junk to
  screw around with the vmspace reference count as we no longer need it.
- In ptrace() and pseudofs(), treat a process with P_WEXIT set as if it
  doesn't exist.
- Only do one PHOLD in kern_ptrace() now, and do it earlier so it covers
  FIX_SSTEP() (since on alpha at least this can end up calling proc_rwmem()
  to clear an earlier single-step simualted via a breakpoint).  We only
  do one to avoid races.  Also, by making the EINVAL error for unknown
  requests be part of the default: case in the switch, the various
  switch cases can now just break out to return which removes a _lot_ of
  duplicated PRELE and proc unlocks, etc.  Also, it fixes at least one bug
  where a LWP ptrace command could return EINVAL with the proc lock still
  held.
- Changed the locking for ptrace_single_step(), ptrace_set_pc(), and
  ptrace_clear_single_step() to always be called with the proc lock
  held (it was a mixed bag previously).  Alpha and arm have to drop
  the lock while the mess around with breakpoints, but other archs
  avoid extra lock release/acquires in ptrace().  I did have to fix a
  couple of other consumers in kern_kse and a few other places to
  hold the proc lock and PHOLD.

Tested by:	ps (1 mostly, but some bits of 2-4 as well)
MFC after:	1 week
2006-02-22 18:57:50 +00:00
..
cd9660 I ran into an nfs client panic a couple of times in a row over the 2006-01-17 17:29:03 +00:00
coda - Reorder calls to vrele() after calls to vput() when the vrele is a 2006-02-01 00:25:26 +00:00
deadfs - Deadfs should not use the std GETWRITEMOUNT routine. Add one that always 2006-02-22 06:11:59 +00:00
devfs - We must hold a reference to a vnode before calling vgone() otherwise 2006-02-22 09:05:40 +00:00
fdescfs Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
fifofs Second attempt at a work-around for fifo-related socket panics during 2005-10-01 20:15:41 +00:00
hpfs I ran into an nfs client panic a couple of times in a row over the 2006-01-17 17:29:03 +00:00
msdosfs - Reorder calls to vrele() after calls to vput() when the vrele is a 2006-02-01 00:25:26 +00:00
ntfs I ran into an nfs client panic a couple of times in a row over the 2006-01-17 17:29:03 +00:00
nullfs - spell VOP_LOCK(vp, LK_RELEASE... VOP_UNLOCK(vp,... so that asserts in 2006-02-22 06:17:31 +00:00
nwfs I ran into an nfs client panic a couple of times in a row over the 2006-01-17 17:29:03 +00:00
portalfs Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
procfs Hold the proc lock while calling proc_sstep() since the function asserts 2006-02-22 17:20:37 +00:00
pseudofs Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
smbfs I ran into an nfs client panic a couple of times in a row over the 2006-01-17 17:29:03 +00:00
udf Make UDF endian-safe. 2006-02-03 15:25:52 +00:00
umapfs Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
unionfs Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00