freebsd-dev/sys/i386/linux
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
..
imgact_linux.c - Change the vm_mmap() function to accept an objtype_t parameter specifying 2005-04-01 20:00:11 +00:00
linux_dummy.c Use the BSD madvise() syscall implementation for Linux binary emulation, 2004-03-28 21:43:27 +00:00
linux_genassym.c Use __FBSDID(). 2003-06-02 16:56:40 +00:00
linux_ipc64.h - Add support for IPC_64 extensions into shmctl(2), semctl(2) and msgctl(2); 2002-10-11 11:43:09 +00:00
linux_locore.s Remove the leading underscore from all symbols defined in x86 asm 2001-02-25 06:29:04 +00:00
linux_machdep.c - Always call exec_free_args() in kern_execve() instead of doing it in all 2006-02-06 22:06:54 +00:00
linux_proto.h Regenerate. 2006-02-06 01:40:48 +00:00
linux_ptrace.c Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
linux_syscall.h Regenerate. 2006-02-06 01:40:48 +00:00
linux_sysent.c Regenerate. 2006-02-06 01:40:48 +00:00
linux_sysvec.c Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structure 2005-12-26 21:23:57 +00:00
linux.h Add support for O_NOFOLLOW and O_DIRECT to Linux fcntl() F_GETFL/F_SETFL. 2005-04-13 04:31:43 +00:00
Makefile Make the target a little bit more generic. 2000-11-01 08:47:34 +00:00
syscalls.conf GC unused 'syshide' override to /dev/null. This was here to disable 2003-12-24 00:32:07 +00:00
syscalls.master Assign audit event identifiers to Linux i386 system calls. 2006-02-06 01:40:30 +00:00