freebsd-nq/sys
Gleb Smirnoff df4e91d386 There is a complex race in in_pcblookup_hash() and in_pcblookup_group().
Both functions need to obtain lock on the found PCB, and they can't do
classic inter-lock with the PCB hash lock, due to lock order reversal.
To keep the PCB stable, these functions put a reference on it and after PCB
lock is acquired drop it. If the reference was the last one, this means
we've raced with in_pcbfree() and the PCB is no longer valid.

  This approach works okay only if we are acquiring writer-lock on the PCB.
In case of reader-lock, the following scenario can happen:

  - 2 threads locate pcb, and do in_pcbref() on it.
  - These 2 threads drop the inp hash lock.
  - Another thread comes to delete pcb via in_pcbfree(), it obtains hash lock,
    does in_pcbremlists(), drops hash lock, and runs in_pcbrele_wlocked(), which
    doesn't free the pcb due to two references on it. Then it unlocks the pcb.
  - 2 aforementioned threads acquire reader lock on the pcb and run
    in_pcbrele_rlocked(). One gets 1 from in_pcbrele_rlocked() and continues,
    second gets 0 and considers pcb freed, returns.
  - The thread that got 1 continutes working with detached pcb, which later
    leads to panic in the underlying protocol level.

  To plumb that problem an additional INPCB flag introduced - INP_FREED. We
check for that flag in the in_pcbrele_rlocked() and if it is set, we pretend
that that was the last reference.

Discussed with:		rwatson, jhb
Reported by:		Vladimir Medvedkin <medved rambler-co.ru>
2012-10-02 12:03:02 +00:00
..
amd64 - Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific 2012-09-28 11:59:32 +00:00
arm Support kernel options from ubldr. 2012-10-01 14:56:48 +00:00
boot Fix the style. 2012-09-30 13:17:33 +00:00
bsm
cam Change queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make 2012-09-28 12:13:34 +00:00
cddl Merge recent vendor changes in ZFS. 2012-09-26 09:37:58 +00:00
compat Fix the mis-handling of the VV_TEXT on the nullfs vnodes. 2012-09-28 11:25:02 +00:00
conf Improve the check for p4 opened files. 2012-09-22 07:44:36 +00:00
contrib Fix pseudo checksum calculation. 2012-09-27 18:15:01 +00:00
crypto
ddb Update the ddb and gdb backends for the new 'trace_thread' hook. 2012-04-12 21:34:58 +00:00
dev Style. 2012-10-02 10:09:23 +00:00
fs Fix the mis-handling of the VV_TEXT on the nullfs vnodes. 2012-09-28 11:25:02 +00:00
gdb Update the ddb and gdb backends for the new 'trace_thread' hook. 2012-04-12 21:34:58 +00:00
geom Remove the topology lock from disk_gone(), it might be called with regular 2012-09-28 08:22:51 +00:00
gnu/fs Add VFCF_READONLY flag that indicates ntfs and xfs file systems are 2012-09-12 03:42:52 +00:00
i386 Add the mps(4) driver to the i386 GENERIC config file. LSI has tested it 2012-10-01 21:42:32 +00:00
ia64 Eliminate a stale comment. It describes another use case for the pmap in 2012-09-28 05:30:59 +00:00
isa
kern Provide a generic way to disable devices at boot time 2012-10-02 03:33:41 +00:00
kgssapi
libkern s/ is is / is /g 2012-09-14 22:00:03 +00:00
mips Introduce a new TLB invalidation function for efficiently invalidating 2012-10-02 07:14:22 +00:00
modules Add TRIM support. 2012-09-23 19:40:58 +00:00
net The drbr(9) API appeared to be so unclear, that most drivers in 2012-09-28 18:28:27 +00:00
net80211 Fix a crash bug introduced in the iterate node work recently done. 2012-09-16 22:45:00 +00:00
netatalk
netgraph The USB Bluetooth driver should only grab its own interfaces. This allows the 2012-09-30 19:31:20 +00:00
netinet There is a complex race in in_pcblookup_hash() and in_pcblookup_group(). 2012-10-02 12:03:02 +00:00
netinet6 Merge the projects/pf/head branch, that was worked on for last six months, 2012-09-08 06:41:54 +00:00
netipsec Add missing break 2012-09-18 08:00:43 +00:00
netipx
netnatm
netncp Add characters mapping for codepages used in Germany. 2012-06-01 03:59:08 +00:00
netpfil Clear and re-setup all function pointers that glue pf(4) and pfsync(4) 2012-09-29 20:11:00 +00:00
netsmb Change a duplicated check to clarify that we really want to set a 2012-07-10 21:02:59 +00:00
nfs - Typo fix 2012-08-16 19:22:34 +00:00
nfsclient Do not leave invalid pages in the object after the short read for a 2012-08-14 11:45:47 +00:00
nfsserver Fix the mis-handling of the VV_TEXT on the nullfs vnodes. 2012-09-28 11:25:02 +00:00
nlm Fix grammar. 2012-08-16 13:01:56 +00:00
ofed The drbr(9) API appeared to be so unclear, that most drivers in 2012-09-28 18:28:27 +00:00
opencrypto
pc98 MFi386: revision 237445 2012-09-23 09:13:57 +00:00
pci intpm: add ATI IXP400 pci id 2012-04-16 10:33:46 +00:00
powerpc Eliminate a stale comment. It describes another use case for the pmap in 2012-09-28 05:30:59 +00:00
rpc Attila Bogar and Herbert Poeckl both reported similar problems 2012-10-01 12:28:58 +00:00
security Check vplabel for NULL before dereferencing it. Fixes a panic 2012-05-03 15:51:34 +00:00
sparc64 Eliminate a stale comment. It describes another use case for the pmap in 2012-09-28 05:30:59 +00:00
sys - Enforce CAP_MKFIFO on mkfifoat(2), not on mknodat(2). Without this change 2012-10-01 05:43:24 +00:00
teken
tools
ufs Fix up kernel sources to be ready for a 64-bit ino_t. 2012-09-27 23:30:49 +00:00
vm Fix the mis-handling of the VV_TEXT on the nullfs vnodes. 2012-09-28 11:25:02 +00:00
x86 Add missing header needed by free(9). 2012-09-30 15:42:20 +00:00
xdr
xen
Makefile