freebsd-skq/sys/sys
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
..
_iovec.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
_label.h
_lock.h Trim another pointer from struct lock_object (and thus from struct mtx and 2006-01-06 18:07:32 +00:00
_mutex.h
_null.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
_pthreadtypes.h According to: 2005-05-31 15:18:17 +00:00
_rwlock.h Fix a typo and match the copyright on rwlock.h. 2006-01-31 18:08:39 +00:00
_semaphore.h Const-qualify ksem_timedwait's parameter abstime as it's only passed in. 2005-10-18 11:46:24 +00:00
_sigset.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
_task.h o eliminate modification of task structures after their run to avoid 2005-04-24 16:52:45 +00:00
_timespec.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
_timeval.h Make tv_sec a time_t on all platforms but alpha. Brings us more in line with 2005-12-24 22:22:17 +00:00
_types.h Bring in experimental kernel support for POSIX message queue. 2005-11-26 12:42:35 +00:00
aac_ioctl.h
acct.h
acl.h Convert the primary ACL allocator from malloc(9) to using a UMA zone instead. 2005-09-06 00:06:30 +00:00
agpio.h
aio.h Fix sigevent's POSIX incompatible problem by adding member fields 2005-10-30 02:12:49 +00:00
alq.h Modify the alq(9) alq_open() API to accept a file creation mode, rather 2005-04-16 12:12:27 +00:00
assym.h
ata.h Update copyright header to match rest of ATA. 2006-01-23 08:49:50 +00:00
bio.h Correct division by zero error in comment. 2005-11-24 00:53:14 +00:00
bitstring.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
blist.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
buf.h Changes imported from XFS for FreeBSD project: 2005-12-07 03:39:08 +00:00
bufobj.h Fix a serious deadlock with the NFS client. Given a large enough 2005-06-10 23:50:41 +00:00
bus_dma.h fix arm wrt to busdma... 2005-03-15 14:57:30 +00:00
bus.h Add convenience macros for bus_space usage that doesn't require specification 2005-09-24 20:11:07 +00:00
callout.h Make callout_reset() return a non-zero value if a pending callout 2005-09-08 14:20:39 +00:00
cdefs.h Analogous to __printflike and __scanflike, add the macro __format_arg which 2006-01-26 20:53:40 +00:00
cdio.h Boot away another stackgap (one of the lest ones in linuxlator/i386) by 2005-01-30 08:12:37 +00:00
cdrio.h
chio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
clist.h
clock.h
condvar.h Contributions from XFS for FreeBSD project: 2005-12-12 00:02:22 +00:00
conf.h Rewamp DEVFS internals pretty severely [1]. 2005-09-19 19:56:48 +00:00
cons.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
consio.h Remove the ADJUST_CLOCK ioctl on pc98. It's not used at all. 2005-05-15 07:35:49 +00:00
copyright.h Remove K&R vestige. It is no longer necessary to concatenate strings 2005-12-31 20:00:12 +00:00
cpu.h Add a new field to struct cf_setting for special values. These are driver- 2005-02-19 06:13:26 +00:00
ctype.h
dataacq.h
device_port.h Remove code for pre-4.0 versions of FreeBSD. It is there in prior 2005-01-19 01:31:33 +00:00
devicestat.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
digiio.h
dir.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
dirent.h
disk.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
disklabel.h Treat arm as i386. 2005-04-07 22:09:02 +00:00
diskmbr.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
diskpc98.h Change DOSPTYP_386BSD to 0xc494. 2005-05-08 11:30:26 +00:00
dkstat.h
domain.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
dvdio.h
elf32.h Implement ELF symbol versioning using GNU semantics. This code aims 2005-12-18 19:43:33 +00:00
elf64.h Implement ELF symbol versioning using GNU semantics. This code aims 2005-12-18 19:43:33 +00:00
elf_common.h o Add the GNU symbol versioning section constants (SHT_GNU_verdef, 2005-12-19 20:20:36 +00:00
elf_generic.h Implement ELF symbol versioning using GNU semantics. This code aims 2005-12-18 19:43:33 +00:00
endian.h
errno.h Add some missing errnos from POSIX. Nothing in FreeBSD generates 2005-04-02 12:33:28 +00:00
eui64.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
event.h Fix prototype to match the code and documentation. 2005-11-24 09:51:59 +00:00
eventhandler.h Use 'const char *' for a few prototypes. 2004-12-06 10:53:40 +00:00
eventvar.h Add locking to the kqueue subsystem. This also makes the kqueue subsystem 2004-08-15 06:24:42 +00:00
exec.h Make ps_nargvstr and ps_nenvstr unsigned. This fixes an input 2005-03-23 08:27:59 +00:00
extattr.h
fbio.h Grab FBTYPE_NOTSUN3 and use it for FBTYPE_PCIMISC. The value matches 2005-05-21 20:40:51 +00:00
fcntl.h
fdcio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
file.h Bring in experimental kernel support for POSIX message queue. 2005-11-26 12:42:35 +00:00
filedesc.h Remove bogous semicolons at the end of the definitions of 2005-09-14 14:57:04 +00:00
filio.h Add ioctl to ask DEVFS about the name of device. 2005-03-08 21:32:19 +00:00
firmware.h firmware(9) is a subsystem to load binary data into the kernel via a 2006-01-29 02:52:42 +00:00
fnv_hash.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
gmon.h
gpt.h o Change the type of the ent_name field from short to uint16_t. 2005-09-17 06:34:18 +00:00
iconv.h Fix panic when loading libiconv.ko on sparc64. 2005-09-05 17:03:40 +00:00
imgact_aout.h Capitalize at the start of sentence. 2005-05-08 02:20:10 +00:00
imgact_elf.h Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structure 2005-12-26 21:23:57 +00:00
imgact.h - Always call exec_free_args() in kern_execve() instead of doing it in all 2006-02-06 22:06:54 +00:00
inflate.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
interrupt.h Add a swi_remove() function to teardown software interrupt handlers. For 2005-10-26 15:51:05 +00:00
ioccom.h
ioctl_compat.h Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
ioctl.h Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
ipc.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
ipmi.h Add an OpenIPMI mostly compatible driver. This driver was developed 2006-02-10 20:51:35 +00:00
jail.h Rename sysctl security.jail.getfsstatroot_only to security.jail.enforce_statfs 2005-06-09 18:49:19 +00:00
joystick.h Comment typo. 2005-01-07 19:31:43 +00:00
kbio.h Fix -Wundef. 2005-12-04 02:12:43 +00:00
kdb.h Don't enter the debugger if KDB_UNATTENDED is set or if 2005-04-20 20:52:46 +00:00
kenv.h
kernel.h Convert the primary ACL allocator from malloc(9) to using a UMA zone instead. 2005-09-06 00:06:30 +00:00
kerneldump.h Define KERNELDUMP_ARM_VERSION. 2005-10-03 14:06:00 +00:00
kobj.h Export a routine, kobj_machdep_init(), that allows platforms 2005-08-07 02:20:35 +00:00
kse.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
ksem.h Introduce MAC Framework and MAC Policy entry points to label and control 2005-05-04 10:39:15 +00:00
kthread.h
ktr.h Axe KTR_ALQ_MASK now that KTR_WITNESS is off unless you hack an #ifdef 2006-01-25 14:57:23 +00:00
ktrace.h Fix typo in comment. 2005-12-26 22:09:09 +00:00
libkern.h Backout strtok() addition to libkern, strsep() is enough and strtok() 2005-10-06 19:06:07 +00:00
limits.h Define MQ_PRIO_MAX, it seems it is the only place 2005-12-02 07:45:28 +00:00
linedisc.h
link_aout.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
link_elf.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
linker_set.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
linker.h Make our ELF64 type definitions match standards. In particular this 2005-12-18 04:52:37 +00:00
lock.h Add a basic reader/writer lock implementation to the kernel. This 2006-01-27 23:13:26 +00:00
lockf.h - Fix leak of struct nlminfo on process exit. 2005-10-26 07:18:37 +00:00
lockmgr.h - Fix a problem that slipped through review; the stack member of the lockmgr 2005-08-03 04:59:07 +00:00
mac_policy.h Complete removal of mac_create_root_mount/mpo_create_root_mount MAC 2005-10-02 09:53:00 +00:00
mac.h Complete removal of mac_create_root_mount/mpo_create_root_mount MAC 2005-10-02 09:53:00 +00:00
malloc.h Improve memguard a bit: 2005-12-30 11:45:07 +00:00
mbpool.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
mbuf.h Replace the 4k fixed sized jumbo mbuf clusters with PAGE_SIZE sized 2006-02-17 14:14:15 +00:00
mchain.h Remove macros 2005-09-19 08:07:18 +00:00
md4.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
md5.h Fix an 11 year old mistake: Let the hash functions take a void* instead 2006-01-17 15:35:57 +00:00
mdioctl.h Rename GEOM class kernel module g_md.ko to geom_md.ko for consistency 2005-11-11 11:31:23 +00:00
memrange.h Fix module builds for i386 and amd64. 2004-08-04 18:30:31 +00:00
mman.h Namespace issues. 2005-04-02 12:33:31 +00:00
module.h Give kldunload a -f(orce) argument. 2004-07-13 19:36:59 +00:00
mount.h - Add a ref count to the mount structure. Sleep for up to 3 seconds in 2006-02-06 10:19:50 +00:00
mouse.h Fix -Wundef. 2005-12-04 02:12:43 +00:00
mqueue.h Last step to make mq_notify conform to POSIX standard, If the process 2005-11-30 05:12:03 +00:00
msg.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
msgbuf.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
mtio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
mutex.h Add a new file (kern/subr_lock.c) for holding code related to struct 2006-01-17 16:55:17 +00:00
namei.h Add AUDITVNODE[12] flags to namei(), which cause namei() to audit path 2006-02-05 15:42:01 +00:00
nlist_aout.h
param.h Replace the 4k fixed sized jumbo mbuf clusters with PAGE_SIZE sized 2006-02-17 14:14:15 +00:00
pciio.h
pcpu.h Modify the way we account for CPU time spent (step 1) 2006-02-07 21:22:02 +00:00
pioctl.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
pipe.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
pmc.h Fix -Wundef. 2005-12-04 02:12:43 +00:00
pmckern.h Fail the module loading process if the currently executing kernel 2005-07-30 09:02:42 +00:00
pmclog.h MFP4: 2005-06-30 19:01:26 +00:00
poll.h
posix4.h
power.h
priority.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
proc.h Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
procfs.h type prgregset_t really should be an array. this is odd, however, other 2004-07-15 03:52:17 +00:00
protosw.h Push the assignment of a new or updated so_qlimit from solisten() 2005-10-30 19:44:40 +00:00
ptio.h
ptrace.h Add members pl_sigmask and pl_siglist into ptrace_lwpinfo to get lwp's 2006-02-06 09:41:56 +00:00
queue.h Userland applications may include queue.h and define INVARIANTS 2005-11-23 04:02:27 +00:00
random.h Add a note ahea of the esource enum that if new entropy source 2004-10-12 14:55:59 +00:00
reboot.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
refcount.h Add a simple reference count API that is simply a thin wrapper API around 2005-09-27 18:01:33 +00:00
regression.h
resource.h Correct description of RLIMIT_CPU. 2005-11-16 18:18:52 +00:00
resourcevar.h Change the addupc_*() functions to use the uintfptr_t type for pc rather 2005-12-16 22:08:32 +00:00
rman.h Eliminate __RMAN_RESOURCE_VISIBLE hack entirely by moving the struct 2005-10-06 21:49:31 +00:00
rtprio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
runq.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
rwlock.h Fix typo. 2006-01-30 11:43:53 +00:00
sbuf.h
sched.h Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities 2005-04-19 04:01:25 +00:00
select.h Fix FD_ISSET() on LP64 platforms. The FD_ISSET() function/macro is 2006-01-06 22:12:46 +00:00
selinfo.h Add locking to the kqueue subsystem. This also makes the kqueue subsystem 2004-08-15 06:24:42 +00:00
sem.h In the kernel-only portionss of System V IPC objects (messages, 2004-11-17 13:12:06 +00:00
sema.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
semaphore.h
serial.h
sf_buf.h Introduce two new options, "CPU private" and "no wait", to sf_buf_alloc(). 2004-11-08 00:43:46 +00:00
shm.h Change the data type of the upper shared memory limits from a signed 2005-08-06 07:20:18 +00:00
sigio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
signal.h o Remove SI_KERNEL until I really implemented it. 2005-12-08 09:00:54 +00:00
signalvar.h Sync with signal.h. 2005-12-06 07:54:10 +00:00
sleepqueue.h Fix a long standing race between sleep queue and thread 2006-02-15 23:52:01 +00:00
smp.h Rename the KDB_STOP_NMI kernel option to STOP_NMI and make it apply to all 2005-10-24 21:04:19 +00:00
snoop.h Slightly change the API for the SNPSTTY ioctl so that the userland now 2005-09-18 19:23:35 +00:00
socket.h Add three new read-only socket options, which allow regression tests 2005-09-18 21:08:03 +00:00
socketvar.h Add sosend_dgram(), a greatly reduced and simplified version of sosend() 2006-01-13 10:22:01 +00:00
sockio.h Implement SIOCGIFCONF for 32bit binaries. 2006-02-02 19:58:37 +00:00
soundcard.h OSS defines AFMT_x32_xE as: 2005-07-31 16:08:03 +00:00
stack.h Add 'depth' argument to CTRSTACK() macro, which allows to reduce number 2005-08-29 11:34:08 +00:00
stat.h - Declare mknod in stat.h (in addition to unistd.h), as per XSI. 2005-03-22 01:19:18 +00:00
statvfs.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
stddef.h
stdint.h
sun_disklabel.h Support VTOC volume names. This can be useful to distinguish multiple 2005-03-30 09:33:10 +00:00
sx.h Add a SYSUNINIT() to SX_SYSINIT() to call sx_destroy() to destroy the sx 2005-09-02 20:41:03 +00:00
syscall.h Regenerate. 2006-02-06 02:00:32 +00:00
syscall.mk Regenerate. 2006-02-06 02:00:32 +00:00
syscallsubr.h Add a kern_eaccess() function and use it to implement xenix_eaccess() 2006-02-06 22:00:53 +00:00
sysctl.h Make sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS) generally available instead 2006-02-16 15:40:36 +00:00
sysent.h Calling setrlimit from 32bit apps could potentially increase certain 2005-11-02 21:18:07 +00:00
syslimits.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
syslog.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
sysproto.h Regenerate. 2006-02-06 02:00:32 +00:00
systm.h CPU time accounting speedup (step 2) 2006-02-11 09:33:07 +00:00
taskqueue.h Add the following to the taskqueue api: 2006-01-14 01:55:24 +00:00
termios.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
thr.h Implement thr_set_name to set a name for thread. 2006-02-05 02:18:46 +00:00
tiio.h
time.h Add several aliases for existing clockid_t names to indicate that the 2005-11-27 00:55:18 +00:00
timeb.h
timepps.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
timers.h Remove itimers_event_hook, now it is a private function in kern_time.c. 2005-12-09 08:19:31 +00:00
times.h
timespec.h Implement POSIX timers. Current only CLOCK_REALTIME and CLOCK_MONOTONIC 2005-10-23 04:22:56 +00:00
timetc.h
timex.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
tree.h Add the RB_PROTOTYPE_STATIC and RB_GENERATE_STATIC macros. 2006-01-19 07:20:20 +00:00
tty.h Deorbit ttymalloc() in preference for ttyalloc() 2006-01-04 09:59:07 +00:00
ttychars.h Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
ttycom.h Bring in a sysv-style pts implementation, as found in the rwatson_pts perforce branch. It works the same as its SysV/linux counterpart : You obtain a fd to the master pseudo terminal by opening /dev/ptmx, which craetes a node for the master as /dev/pty[num] and a node for the slave as /dev/pts/[num]. 2006-01-26 01:30:34 +00:00
ttydefaults.h Restore TTYDEF_LFLAG to set echo bits. 2004-11-03 19:16:55 +00:00
ttydev.h Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
turnstile.h - Add support for having both a shared and exclusive queue of threads in 2006-01-27 22:42:12 +00:00
types.h Bring in experimental kernel support for POSIX message queue. 2005-11-26 12:42:35 +00:00
ucontext.h
ucred.h Use the refcount API to manage the reference count for user credentials 2005-09-27 18:09:42 +00:00
uio.h - Add two new system calls: preadv() and pwritev() which are like readv() 2005-07-07 18:17:55 +00:00
umtx.h do umtx_wake at userland thread exit address, so that others userland 2005-10-26 06:55:46 +00:00
un.h Implement unix(4) socket options LOCAL_CREDS and LOCAL_CONNWAIT. 2005-04-13 00:01:46 +00:00
unistd.h messqge queue has been implemented, set _POSIX_MESSAGE_PASSING to 200112L. 2005-12-02 02:52:17 +00:00
unpcb.h Implement unix(4) socket options LOCAL_CREDS and LOCAL_CONNWAIT. 2005-04-13 00:01:46 +00:00
user.h Return the thread name in the kinfo_proc structure. 2006-01-18 20:27:43 +00:00
utsname.h
uuid.h Add parse_uuid() that creates a binary representation of an UUID from 2005-10-07 13:37:10 +00:00
vmmeter.h
vnode.h Use off_t for file size passed to vnode_create_vobject(). 2006-02-01 12:43:13 +00:00
wait.h Since union wait was removed in revision 1.17 (3 years, 5 months ago), 2005-11-10 05:00:20 +00:00
watchdog.h
xrpuio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00