freebsd-nq/sys/kern
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
..
bus_if.m
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh
imgact_aout.c Maintain the lock on the vnode for most of exec_elfN_imgact(). 2005-12-24 04:57:50 +00:00
imgact_elf32.c
imgact_elf64.c
imgact_elf.c Avoid a vm object reference leak in a rarely used code path. 2006-01-21 20:11:49 +00:00
imgact_gzip.c Maintain the lock on the vnode for most of exec_elfN_imgact(). 2005-12-24 04:57:50 +00:00
imgact_shell.c Fix a panic which could occur parsing #!-lines in a shell-script. If the 2005-06-19 02:21:03 +00:00
inflate.c Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
init_main.c Modify the way we account for CPU time spent (step 1) 2006-02-07 21:22:02 +00:00
init_sysent.c Regenerate. 2006-02-06 02:00:32 +00:00
kern_acct.c Provide some anti-footshooting. Don't allow the user to set the interval 2006-02-07 18:59:47 +00:00
kern_acl.c Implement new world order in VFS locking for ACLs. This will remove the 2005-09-17 22:01:14 +00:00
kern_alq.c Grr. Backout previous change. vn_open_cred() will call NDFREE() on failure. 2006-01-27 11:25:06 +00:00
kern_clock.c CPU time accounting speedup (step 2) 2006-02-11 09:33:07 +00:00
kern_condvar.c Fix a long standing race between sleep queue and thread 2006-02-15 23:52:01 +00:00
kern_conf.c Novel idea, don't print a string if it is NULL! 2006-01-12 19:15:14 +00:00
kern_context.c
kern_cpu.c make saved cpu level stackable. 2005-10-03 06:57:29 +00:00
kern_descrip.c Add auditing of arguments to the close() and fstat() system calls. Much more 2006-02-05 23:57:32 +00:00
kern_environment.c Reorder statements to avoid accessing unknown memory. 2005-09-26 14:14:55 +00:00
kern_event.c Add in kqueue support to LIO event notification and fix how it handled 2005-10-12 17:51:31 +00:00
kern_exec.c - Always call exec_free_args() in kern_execve() instead of doing it in all 2006-02-06 22:06:54 +00:00
kern_exit.c Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
kern_fork.c Simplify system time accounting for profiling. 2006-02-08 08:09:17 +00:00
kern_idle.c Divorce critical sections from spinlocks. Critical sections as denoted by 2005-04-04 21:53:56 +00:00
kern_intr.c Add a swi_remove() function to teardown software interrupt handlers. For 2005-10-26 15:51:05 +00:00
kern_jail.c Push Giant down in jails. Pass the MPSAFE flag to NDINIT, and keep track 2005-09-28 00:30:56 +00:00
kern_kse.c Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
kern_kthread.c Don't do a PHOLD() in kthread_create() w/o a matching PRELE() in 2006-02-22 17:21:45 +00:00
kern_ktr.c Whitespace. 2006-01-27 23:06:08 +00:00
kern_ktrace.c - Lock access to vrele() with VFS_LOCK_GIANT() rather than mtx_lock(&Giant). 2006-01-30 08:19:01 +00:00
kern_linker.c Fix a bug in the kernel module runtime linker that made it impossible 2005-10-19 20:40:30 +00:00
kern_lock.c - Remove and unused include. 2005-12-23 21:32:40 +00:00
kern_lockf.c
kern_mac.c Standard Giant push down operations for the Mandatory Access Control (MAC) 2005-10-04 14:32:58 +00:00
kern_malloc.c Add buffer corruption protection (RedZone) for kernel's malloc(9). 2006-01-31 11:09:21 +00:00
kern_mbuf.c Replace the 4k fixed sized jumbo mbuf clusters with PAGE_SIZE sized 2006-02-17 14:14:15 +00:00
kern_mib.c mp_ncpus is always (properly) initialized, even on UP kernels, so just use it. 2005-08-21 18:03:31 +00:00
kern_module.c
kern_mtxpool.c
kern_mutex.c - Add support for having both a shared and exclusive queue of threads in 2006-01-27 22:42:12 +00:00
kern_ntptime.c Explicitly acquire Giant around the ntp_gettime() and assert it in the 2005-05-28 14:34:41 +00:00
kern_physio.c
kern_pmc.c Fix -Wundef. 2005-12-04 02:12:43 +00:00
kern_poll.c - Don't pollute opt_global.h with DEVICE_POLLING and introduce 2005-10-05 10:09:17 +00:00
kern_proc.c CPU time accounting speedup (step 2) 2006-02-11 09:33:07 +00:00
kern_prot.c Audit the arguments (user/group IDs) for the system calls that set these IDs. 2006-02-06 00:32:33 +00:00
kern_resource.c Various style and comment fixes. 2006-02-22 16:58:48 +00:00
kern_rwlock.c Fix another compile problem. If I find any more, this file is going in the 2006-02-01 04:18:07 +00:00
kern_sema.c
kern_shutdown.c - Add the global 'rebooting' variable that is used to detect when 2006-02-06 10:12:00 +00:00
kern_sig.c Fix a long standing race between sleep queue and thread 2006-02-15 23:52:01 +00:00
kern_subr.c
kern_switch.c Trim trailing whitespace. 2005-12-28 17:13:31 +00:00
kern_sx.c Add a new file (kern/subr_lock.c) for holding code related to struct 2006-01-17 16:55:17 +00:00
kern_synch.c Fix a long standing race between sleep queue and thread 2006-02-15 23:52:01 +00:00
kern_syscalls.c
kern_sysctl.c Make sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS) generally available instead 2006-02-16 15:40:36 +00:00
kern_tc.c CPU time accounting speedup (step 2) 2006-02-11 09:33:07 +00:00
kern_thr.c Call thread_stopped in thr_exit to notify parent that the child process 2006-02-10 03:34:29 +00:00
kern_thread.c Fix a long standing race between sleep queue and thread 2006-02-15 23:52:01 +00:00
kern_time.c Fix compiling warning on 64 bits system. 2005-12-09 13:16:48 +00:00
kern_timeout.c Oops, missed adding the required include. 2005-09-15 20:20:36 +00:00
kern_umtx.c Axe unused code. 2006-02-04 06:36:39 +00:00
kern_uuid.c Add parse_uuid() that creates a binary representation of an UUID from 2005-10-07 13:37:10 +00:00
kern_xxx.c
ksched.c
link_elf_obj.c Make our ELF64 type definitions match standards. In particular this 2005-12-18 04:52:37 +00:00
link_elf.c Make our ELF64 type definitions match standards. In particular this 2005-12-18 04:52:37 +00:00
linker_if.m
Make.tags.inc
Makefile Add a 'sysent' target that depends on the various files built from 2005-07-13 20:50:17 +00:00
makesyscalls.sh Introduce a new field in the syscalls.master file format to hold the 2005-05-30 15:09:18 +00:00
md4c.c
md5c.c Fix an 11 year old mistake: Let the hash functions take a void* instead 2006-01-17 15:35:57 +00:00
p1003_1b.c
posix4_mib.c
sched_4bsd.c Move HWPMC_HOOKS into its own opt_hwpmc_hooks.h file. It doesn't merit 2005-06-24 00:16:57 +00:00
sched_ule.c Use variable i instead of variable cpus as an index to get correct kseq. 2005-12-27 12:02:03 +00:00
subr_acl_posix1e.c Implement new world order in VFS locking for ACLs. This will remove the 2005-09-17 22:01:14 +00:00
subr_autoconf.c
subr_blist.c
subr_bus.c Add a devd(8) event that is sent after the system resumes. This can be 2006-01-22 01:06:25 +00:00
subr_clist.c
subr_clock.c
subr_devstat.c - Remove two mtx_asserts that can incorrectly trigger if 2005-05-03 10:58:05 +00:00
subr_disk.c When calling bioq_first() to see if a queue is empty in bioq_disksort(), 2006-01-13 23:27:12 +00:00
subr_eventhandler.c
subr_firmware.c firmware(9) is a subsystem to load binary data into the kernel via a 2006-01-29 02:52:42 +00:00
subr_hints.c The resource_xxx routines in subr_hints.c are called before and after the 2005-07-31 10:46:55 +00:00
subr_kdb.c Add stoppcbs[] arrays on Alpha and sparc64 and have each CPU save its 2005-11-03 21:08:20 +00:00
subr_kobj.c Increment kobj_lookup_misses on a miss rather than decrementing it. 2005-12-29 18:00:42 +00:00
subr_lock.c Add a basic reader/writer lock implementation to the kernel. This 2006-01-27 23:13:26 +00:00
subr_log.c
subr_mbpool.c
subr_mchain.c Change API of mb_copy_t in libmchain so that netsmb can handle 2005-07-29 13:22:37 +00:00
subr_module.c
subr_msgbuf.c
subr_param.c Partially revert revision 1.66, which contained a change that did not 2005-10-14 19:15:10 +00:00
subr_pcpu.c Fix 'show allpcpu' ddb command on non-x86. CPU IDs are in the range 0 .. 2005-11-03 21:06:29 +00:00
subr_power.c General consensus is that it would be even better to run this in a 2005-11-09 16:22:56 +00:00
subr_prf.c Acquire Giant in uprintf() and tprintf() rather than asserting it. In 2005-09-26 08:02:24 +00:00
subr_prof.c Change the addupc_*() functions to use the uintfptr_t type for pc rather 2005-12-16 22:08:32 +00:00
subr_rman.c Prefer NULL to 0. 2005-11-17 08:56:21 +00:00
subr_rtc.c
subr_sbuf.c Make sbuf_copyin() return the number of bytes copied on success. 2005-12-23 11:49:53 +00:00
subr_scanf.c
subr_sleepqueue.c Fix a long standing race between sleep queue and thread 2006-02-15 23:52:01 +00:00
subr_smp.c Rename the KDB_STOP_NMI kernel option to STOP_NMI and make it apply to all 2005-10-24 21:04:19 +00:00
subr_stack.c Add 'depth' argument to CTRSTACK() macro, which allows to reduce number 2005-08-29 11:34:08 +00:00
subr_taskqueue.c Add the following to the taskqueue api: 2006-01-14 01:55:24 +00:00
subr_trap.c Test before modifying p_sflag to avoid unconditionally cache line 2006-02-10 14:59:16 +00:00
subr_turnstile.c - Add support for having both a shared and exclusive queue of threads in 2006-01-27 22:42:12 +00:00
subr_unit.c
subr_witness.c Axe KTR_ALQ_MASK now that KTR_WITNESS is off unless you hack an #ifdef 2006-01-25 14:57:23 +00:00
sys_generic.c Return error from fget_write() rather than hardcoding EBADF now that 2006-01-06 16:34:22 +00:00
sys_pipe.c - In pipe() return the error returned by pipe_create(), rather then 2006-01-30 08:25:04 +00:00
sys_process.c Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
sys_socket.c Introduce three additional MAC Framework and MAC Policy entry points to 2005-04-16 18:46:29 +00:00
syscalls.c Regenerate. 2006-02-06 02:00:32 +00:00
syscalls.master Prefer AUE_FOO audit identifiers to AUE_O_FOO, which are largely left 2006-02-06 02:00:06 +00:00
sysv_ipc.c
sysv_msg.c
sysv_sem.c Gratuitous renaming of four System V Semaphore MAC Framework entry 2005-06-07 05:03:28 +00:00
sysv_shm.c Re-order MAC and DAC checks in shmget() in order to give precedence to 2005-10-04 16:40:20 +00:00
tty_compat.c Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
tty_conf.c
tty_cons.c
tty_pts.c Allow root to open prison pts devices too. 2006-01-31 22:19:37 +00:00
tty_pty.c Don't destroy the slave /dev entry until someone figures out why devfs seems 2006-02-02 20:35:45 +00:00
tty_subr.c
tty_tty.c Merge the dev_clone and dev_clone_cred event handlers into a single 2005-08-08 19:55:32 +00:00
tty.c Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
uipc_accf.c o setsockopt(2) cannot remove accept filter. [1] 2005-06-11 11:59:48 +00:00
uipc_cow.c Previously, nothing prevented the page that was returned by pmap_extract() 2005-10-23 07:41:56 +00:00
uipc_domain.c The sysctls kern.ipc.[max_linkhdr|max_protohdr|max_hdr|max_datalen] 2006-02-18 17:16:18 +00:00
uipc_mbuf2.c Define four constants, MBUF_{,MEM,CLUSTER,PACKET,TAG}_MEM_NAME, which 2005-07-17 14:04:03 +00:00
uipc_mbuf.c The sysctls kern.ipc.[max_linkhdr|max_protohdr|max_hdr|max_datalen] 2006-02-18 17:16:18 +00:00
uipc_mqueue.c Abstract function mqfs_create_node() to create a mqueue node. 2006-02-22 02:38:25 +00:00
uipc_proto.c Use sparse initializers for "struct domain" and "struct protosw", 2005-11-09 13:29:16 +00:00
uipc_sem.c Convert remaining functions to ANSI C function declarations. 2006-01-22 00:30:46 +00:00
uipc_sockbuf.c Fix a bug in the loop in sonewconn that makes room on the incomplete 2005-11-22 01:55:29 +00:00
uipc_socket2.c Fix a bug in the loop in sonewconn that makes room on the incomplete 2005-11-22 01:55:29 +00:00
uipc_socket.c Improve consistency of return() style. 2006-02-12 15:00:27 +00:00
uipc_syscalls.c Reformat socket control messages on input/output for 32bit compatibility 2005-10-31 21:09:56 +00:00
uipc_usrreq.c - Lock access to vrele() with VFS_LOCK_GIANT() rather than mtx_lock(&Giant). 2006-01-30 08:19:01 +00:00
vfs_acl.c Implement new world order in VFS locking for ACLs. This will remove the 2005-09-17 22:01:14 +00:00
vfs_aio.c If block size is zero, use normal file operations to do I/O, 2006-02-22 00:05:12 +00:00
vfs_bio.c For low memory situations, non-VMIO buffers didnt't release pages back to 2006-02-02 21:37:39 +00:00
vfs_cache.c - Don't check v_mount for NULL to determine if a vnode has been recycled. 2006-02-06 10:15:27 +00:00
vfs_cluster.c Changes imported from XFS for FreeBSD project: 2005-12-07 03:39:08 +00:00
vfs_default.c - Add a comment warning about an anomalous condition where we VOP_UNLOCK 2006-01-30 08:21:23 +00:00
vfs_export.c Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
vfs_extattr.c Add pathname and/or vnode argument auditing for the following system calls: 2006-02-22 16:04:20 +00:00
vfs_hash.c Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
vfs_init.c
vfs_lookup.c - Don't check v_mount for NULL to determine if a vnode has been recycled. 2006-02-06 10:15:27 +00:00
vfs_mount.c - We can not hold a vnode lock while we do a lookup. Search for and load 2006-02-22 06:29:55 +00:00
vfs_subr.c - Grab a mnt ref in vfs_busy() before dropping the interlock. This will 2006-02-22 06:20:12 +00:00
vfs_syscalls.c Add pathname and/or vnode argument auditing for the following system calls: 2006-02-22 16:04:20 +00:00
vfs_vnops.c Eradicate caddr_t from the VFS API. 2005-12-14 00:49:52 +00:00
vnode_if.src Eradicate caddr_t from the VFS API. 2005-12-14 00:49:52 +00:00