1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/sys
Attilio Rao 6aba400a70 Fix a deficiency in the selinfo interface:
If a selinfo object is recorded (via selrecord()) and then it is
quickly destroyed, with the waiters missing the opportunity to awake,
at the next iteration they will find the selinfo object destroyed,
causing a PF#.

That happens because the selinfo interface has no way to drain the
waiters before to destroy the registered selinfo object. Also this
race is quite rare to get in practice, because it would require a
selrecord(), a poll request by another thread and a quick destruction
of the selrecord()'ed selinfo object.

Fix this by adding the seldrain() routine which should be called
before to destroy the selinfo objects (in order to avoid such case),
and fix the present cases where it might have already been called.
Sometimes, the context is safe enough to prevent this type of race,
like it happens in device drivers which installs selinfo objects on
poll callbacks. There, the destruction of the selinfo object happens
at driver detach time, when all the filedescriptors should be already
closed, thus there cannot be a race.
For this case, mfi(4) device driver can be set as an example, as it
implements a full correct logic for preventing this from happening.

Sponsored by:	Sandvine Incorporated
Reported by:	rstone
Tested by:	pluknet
Reviewed by:	jhb, kib
Approved by:	re (bz)
MFC after:	3 weeks
2011-08-25 15:51:54 +00:00
..
amd64 In HEAD when doing no further checkes there is no reason use the 2011-08-20 19:21:46 +00:00
arm - Move the PG_UNMANAGED flag from m->flags to m->oflags, renaming the flag 2011-08-09 21:01:36 +00:00
boot Add kern.cam.boot_delay description (with reasonable default) to 2011-08-23 20:25:11 +00:00
bsm
cam Fixes for sure bus reference miscounting and potential device and 2011-08-12 20:09:38 +00:00
cddl Generalize ffs_pages_remove() into vn_pages_remove(). 2011-08-25 08:17:39 +00:00
compat Add experimental support for process descriptors 2011-08-18 22:51:30 +00:00
conf Add experimental support for process descriptors 2011-08-18 22:51:30 +00:00
contrib Use the correct byte order for the ip_divert(4) mbuf tag port meta 2011-08-25 09:38:33 +00:00
crypto
ddb
dev Fix a missing initialisation of bt_flags when setting up the TDMA beacon. 2011-08-24 14:11:00 +00:00
fs Fix the NFSv4 server so that it returns NFSERR_SYMLINK when 2011-08-20 21:26:35 +00:00
gdb
geom
gnu Second-to-last commit implementing Capsicum capabilities in the FreeBSD 2011-08-11 12:30:23 +00:00
i386 In HEAD when doing no further checkes there is no reason use the 2011-08-20 19:21:46 +00:00
ia64 - Move the PG_UNMANAGED flag from m->flags to m->oflags, renaming the flag 2011-08-09 21:01:36 +00:00
isa
kern Fix a deficiency in the selinfo interface: 2011-08-25 15:51:54 +00:00
kgssapi
libkern
mips Fix a typo in cb_dumpdata() about wrongly calling wdog_kern_pat(). 2011-08-13 17:17:04 +00:00
modules Fix two cases involving opt_capsicum.h and module builds: 2011-08-15 07:32:44 +00:00
net Fix a deficiency in the selinfo interface: 2011-08-25 15:51:54 +00:00
net80211 This patch fixes beacon frame sequence number generation. The code 2011-08-24 08:53:33 +00:00
netatalk
netgraph Second-to-last commit implementing Capsicum capabilities in the FreeBSD 2011-08-11 12:30:23 +00:00
netinet Increase the defaults for the maximum socket buffer limit, 2011-08-25 09:20:13 +00:00
netinet6 Fix if_addr_mtx recursion in mld6. 2011-08-22 23:39:40 +00:00
netipsec
netipx
netnatm
netncp
netsmb
nfs
nfsclient Merge 220876, 220877, and 221537 from the new NFS client to the old: 2011-08-09 15:29:58 +00:00
nfsserver Second-to-last commit implementing Capsicum capabilities in the FreeBSD 2011-08-11 12:30:23 +00:00
nlm
ofed Add the fo_chown and fo_chmod methods to struct fileops and use them 2011-08-16 20:07:47 +00:00
opencrypto Add the fo_chown and fo_chmod methods to struct fileops and use them 2011-08-16 20:07:47 +00:00
pc98 In HEAD when doing no further checkes there is no reason use the 2011-08-20 19:21:46 +00:00
pci
powerpc Add support for the Blu-Ray drive found in the Sony Playstation 3 and fix 2011-08-14 00:20:37 +00:00
rpc
security Fix a deficiency in the selinfo interface: 2011-08-25 15:51:54 +00:00
sparc64 - Move the PG_UNMANAGED flag from m->flags to m->oflags, renaming the flag 2011-08-09 21:01:36 +00:00
sys Fix a deficiency in the selinfo interface: 2011-08-25 15:51:54 +00:00
teken
tools
ufs Generalize ffs_pages_remove() into vn_pages_remove(). 2011-08-25 08:17:39 +00:00
vm Update some comments in swap_pager.c. 2011-08-22 20:44:18 +00:00
x86 Fix a deficiency in the selinfo interface: 2011-08-25 15:51:54 +00:00
xdr
xen
Makefile