1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00
freebsd/sys
Robert Watson 31f555a1c5 Assert socket buffer lock in sb_lock() to protect socket buffer sleep
lock state.  Convert tsleep() into msleep() with socket buffer mutex
as argument.  Hold socket buffer lock over sbunlock() to protect sleep
lock state.

Assert socket buffer lock in sbwait() to protect the socket buffer
wait state.  Convert tsleep() into msleep() with socket buffer mutex
as argument.

Modify sofree(), sosend(), and soreceive() to acquire SOCKBUF_LOCK()
in order to call into these functions with the lock, as well as to
start protecting other socket buffer use in their implementation.  Drop
the socket buffer mutexes around calls into the protocol layer, around
potentially blocking operations, for copying to/from user space, and
VM operations relating to zero-copy.  Assert the socket buffer mutex
strategically after code sections or at the beginning of loops.  In
some cases, modify return code to ensure locks are properly dropped.

Convert the potentially blocking allocation of storage for the remote
address in soreceive() into a non-blocking allocation; we may wish to
move the allocation earlier so that it can block prior to acquisition
of the socket buffer lock.

Drop some spl use.

NOTE: Some races exist in the current structuring of sosend() and
soreceive().  This commit only merges basic socket locking in this
code; follow-up commits will close additional races.  As merged,
these changes are not sufficient to run without Giant safely.

Reviewed by:	juli, tjr
2004-06-19 03:23:14 +00:00
..
alpha Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
amd64 Try harder to give new processes a clean initial fpu state. fpu_cleanstate 2004-06-18 04:01:54 +00:00
arm Nuke dead code. 2004-06-17 17:52:12 +00:00
boot Save a couple of bytes for the SIO case. 2004-06-17 12:02:25 +00:00
cam Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
coda Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
compat Add stub for Linux SOUND_MIXER_READ_RECMASK, required by some Linux sound 2004-06-18 14:36:24 +00:00
conf Commit pf version 3.5 and link additional files to the kernel build. 2004-06-16 23:24:02 +00:00
contrib Add missing <sys/module.h> include. 2004-06-18 08:53:55 +00:00
crypto Use __FBSDID(). 2004-06-14 00:38:54 +00:00
ddb Fixed DDB_NOKLDSYM on amd64's: 2004-05-18 05:30:06 +00:00
dev Add more precision to the cx_usage sysctl output and special-case 0%. 2004-06-19 02:27:23 +00:00
fs Reduce a fair bit of the atomics because we are now called with a 2004-06-18 08:08:47 +00:00
geom Clean up allocated ressources when destroying the main vinum geom. 2004-06-18 19:53:33 +00:00
gnu Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
i4b Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
i386 Fixed a panic caused by over-optimizing npxdrop() in the non-FXSR case. 2004-06-18 02:10:55 +00:00
ia64 Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
isa Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
isofs/cd9660 Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
kern Assert socket buffer lock in sb_lock() to protect socket buffer sleep 2004-06-19 03:23:14 +00:00
libkern Import libkern arm specific bits. 2004-05-14 12:28:31 +00:00
modules Commit pf version 3.5 and link additional files to the kernel build. 2004-06-16 23:24:02 +00:00
net Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
net80211 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile 2004-06-13 17:29:10 +00:00
netatalk Socket MAC labels so_label and so_peerlabel are now protected by 2004-06-13 02:50:07 +00:00
netatm The socket field so_state is used to hold a variety of socket related 2004-06-14 18:16:22 +00:00
netgraph Correct merge-o: make sure to unlock symmetrically socket buffer 2004-06-18 05:09:42 +00:00
netinet In tcp_ctloutput(), don't hold the inpcb lock over a call to 2004-06-18 20:22:21 +00:00
netinet6 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile 2004-06-13 17:29:10 +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 Grab the socket buffer send or receive mutex when performing a 2004-06-15 03:51:44 +00:00
netkey
netnatm Extend coverage of SOCK_LOCK(so) to include so_count, the socket 2004-06-12 20:47:32 +00:00
netncp Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
netsmb Merge additional socket buffer locking from rwatson_netperf: 2004-06-17 22:48:11 +00:00
nfs Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
nfs4client Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
nfsclient Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
nfsserver Merge additional socket buffer locking from rwatson_netperf: 2004-06-17 22:48:11 +00:00
opencrypto Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pc98 MFi386: revision 1.1161 2004-06-16 14:21:52 +00:00
pccard Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pci Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
posix4
powerpc Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
rpc Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
security Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
sparc64 Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
sys Remove nested include of <sys/module.h> 2004-06-18 08:54:49 +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 deadlock which is caused by locking VDIR of parent and VREG of 2004-06-18 14:35:17 +00:00
vm Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
Makefile Try harder not to compile anything in sys/boot for arm. 2004-05-16 00:19:12 +00:00