freebsd-skq/sys
rwatson fcbd16cf61 Introduce a subsystem lock around UNIX domain sockets in order to protect
global and allocated variables.  This strategy is derived from work
originally developed by BSDi for BSD/OS, and applied to FreeBSD by Sam
Leffler:

- Add unp_mtx, a global mutex which will protect all UNIX domain socket
  related variables, structures, etc.

- Add UNP_LOCK(), UNP_UNLOCK(), UNP_LOCK_ASSERT() macros.

- Acquire unp_mtx on entering most UNIX domain socket code,
  drop/re-acquire around calls into VFS, and release it on return.

- Avoid performing sodupsockaddr() while holding the mutex, so in general
  move to allocating storage before acquiring the mutex to copy the data.

- Make a stack copy of the xucred rather than copying out while holding
  unp_mtx.  Copy the peer credential out after releasing the mutex.

- Add additional assertions of vnode locks following VOP_CREATE().

A few notes:

- Use of an sx lock for the file list mutex may cause problems with regard
  to unp_mtx when garbage collection passed file descriptors.

- The locking in unp_pcblist() for sysctl monitoring is correct subject to
  the unpcb zone not returning memory for reuse by other subsystems
  (consistent with similar existing concerns).

- Sam's version of this change, as with the BSD/OS version, made use of
  both a global lock and per-unpcb locks.  However, in practice, the
  global lock covered all accesses, so I have simplified out the unpcb
  locks in the interest of getting this merged faster (reducing the
  overhead but not sacrificing granularity in most cases).  We will want
  to explore possibilities for improving lock granularity in this code in
  the future.

Submitted by:	sam
Sponsored by:	FreeBSD Foundatiuon
Obtained from:	BSD/OS 5 snapshot provided by BSDi
2004-06-10 21:34:38 +00:00
..
alpha Remove atdevbase and replace it's remaining uses with direct references to 2004-06-10 20:31:00 +00:00
amd64 Insta-MFi386: ignore disabled cpu apic id's entirely 2004-06-10 21:30:08 +00:00
arm Remove filename+line number from panic messages. 2004-06-06 21:26:49 +00:00
boot Some embedded platforms have no keyboard controller. Give up waiting 2004-06-02 09:38:32 +00:00
cam Reformat the comments for cam_hdr so that they can be read. 2004-06-07 19:12:44 +00:00
coda add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
compat Add another 5.2.1 source compatibility tweak: acquire Giant before calling 2004-06-07 01:22:48 +00:00
conf Add esp(4) to NOTES. 2004-06-10 05:43:36 +00:00
contrib Recognise NOINET6 as an indication to not build IPv6 enabled source even 2004-06-08 23:52:22 +00:00
crypto Fix a reentrancy issue in md5_calc(). 2004-01-27 18:57:21 +00:00
ddb Fixed DDB_NOKLDSYM on amd64's: 2004-05-18 05:30:06 +00:00
dev Remove atdevbase and replace it's remaining uses with direct references to 2004-06-10 20:31:00 +00:00
fs Add MSG_NBIO flag option to soreceive() and sosend() that causes 2004-06-01 01:18:51 +00:00
geom Make the sysctl kern.geom.collectstats more granular. 2004-06-09 19:44:44 +00:00
gnu Remove advertising clause from University of California Regent's 2004-04-07 20:46:16 +00:00
i4b add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
i386 - Use the correct devclass name ("acpi" vs "ACPI") to detect if acpi0 is 2004-06-10 20:43:04 +00:00
ia64 Machine generated patch which changes linedisc calls from accessing 2004-06-04 16:02:56 +00:00
isa Remove atdevbase and replace it's remaining uses with direct references to 2004-06-10 20:31:00 +00:00
isofs/cd9660 Remove advertising clause from University of California Regent's 2004-04-07 20:46:16 +00:00
kern Introduce a subsystem lock around UNIX domain sockets in order to protect 2004-06-10 21:34:38 +00:00
libkern Import libkern arm specific bits. 2004-05-14 12:28:31 +00:00
modules Fix typo that prevents esp_sbus.c and lsi64854.c from being built on sparc64. 2004-06-10 13:02:29 +00:00
net Introduce a netisr to deliver kernel-generated routing, avoiding 2004-06-09 02:48:23 +00:00
net80211 Add some missing <sys/module.h> includes which are masked by the 2004-05-30 17:57:46 +00:00
netatalk Remove redundant call to soisdisconnected() from ddp_abort(), as it 2004-05-05 03:34:37 +00:00
netatm Remove an #if section originally written for Sun compilers. 2004-06-08 13:46:31 +00:00
netgraph Now that mbufs are allocated using uma, 2004-06-07 22:11:12 +00:00
netinet init_tables() must be run after sys/net/route.c:route_init(). 2004-06-10 20:20:37 +00:00
netinet6 do not check super user privilege in ip6_savecontrol. It is 2004-06-02 15:41:18 +00:00
netipsec use correct address for SADB_EXT_ADDRESS_DST in key_do_allocsa_policy 2004-05-03 05:15:53 +00:00
netipx Rename dup_sockaddr() to sodupsockaddr() for consistency with other 2004-03-01 03:14:23 +00:00
netkey avoid duplicate free. 2004-01-25 17:18:12 +00:00
netnatm Rename dup_sockaddr() to sodupsockaddr() for consistency with other 2004-03-01 03:14:23 +00:00
netncp add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
netsmb add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
nfs Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
nfs4client Remove advertising clause from University of California Regent's 2004-04-07 20:46:16 +00:00
nfsclient Make vm_page's PG_ZERO flag immutable between the time of the page's 2004-05-06 05:03:23 +00:00
nfsserver Giant wasn't dropped here if we have to return EBUSY. This is bad. 2004-05-31 20:21:06 +00:00
opencrypto add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
pc98 Remove atdevbase and replace it's remaining uses with direct references to 2004-06-10 20:31:00 +00:00
pccard Convert callers to the new bus_alloc_resource_any(9) API. 2004-03-17 17:50:55 +00:00
pci Replace handrolled CRC calculation with ether_crc32_[lb]e(). 2004-06-09 14:34:04 +00:00
posix4 The sem_timedwait() and ksem_timedwait() functions both 2004-02-03 22:27:03 +00:00
powerpc Remove checks for curthread == NULL - it can't happen. 2004-06-03 10:22:47 +00:00
rpc Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
security add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
sparc64 Add esp to the sparc64 GENERIC 2004-06-10 05:24:34 +00:00
sys Reference count struct tty. 2004-06-09 09:41:30 +00:00
tools devlist2h.awk is too generic a name for what it does. It really 2004-05-26 00:19:39 +00:00
ufs Avoid assignments to cast expressions. 2004-06-08 13:08:19 +00:00
vm Backout previous change, I think Julian has a better solution which 2004-06-09 20:50:08 +00:00
Makefile Try harder not to compile anything in sys/boot for arm. 2004-05-16 00:19:12 +00:00