freebsd-skq/sys
kib fcf2de304b Make knote KN_INFLUX state counted. This is final fix for the issue
closed by r310302 for knote().

If KN_INFLUX | KN_SCAN flags are set for the note passed to knote() or
knote_fork(), i.e. the knote is scanned, we might erronously clear
INFLUX when finishing notification.  For normal knote() it was fixed
in r310302 simply by remembering the fact that we do not own
KN_INFLUX, since there we own knlist lock and scan thread cannot clear
KN_INFLUX until we drop the lock.  For knote_fork(), the situation is
more complicated, e must drop knlist lock AKA the process lock, since
we need to register new knotes.

Change KN_INFLUX into counter and allow shared ownership of the
in-flux state between scan and knote_fork() or knote().  Both in-flux
setters need to ensure that knote is not dropped in parallel.  Added
assert about kn_influx == 1 in knote_drop() verifies that in-flux state
is not shared when knote is destroyed.

Since KBI of the struct knote is changed by addition of the int
kn_influx field, reorder kn_hook and kn_hookid to fill pad on LP64
arches [1].  This keeps sizeof(struct knote) to same 128 bytes as it
was before addition of kn_influx, on amd64.

Reviewed by:	markj
Suggested by:	markj [1]
Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D8898
2016-12-26 19:33:40 +00:00
..
amd64 Fix typo. Remove spurious blank line. 2016-12-18 09:32:23 +00:00
arm Implement drivers for NVIDIA tegra124 display controller, HDMI source 2016-12-26 14:36:05 +00:00
arm64 Add virtio_pci to GENERIC arm64 conf 2016-12-18 11:15:31 +00:00
boot Add a dumpdev example to /boot/defaults/loader.conf 2016-12-22 15:48:54 +00:00
bsm
cam Fix improperly used nexus.targ_lun. 2016-12-26 08:47:35 +00:00
cddl Remove extra DOF_SEC_XLIMPORT from the DOF_SEC_ISLOADABLE macro 2016-12-16 20:44:14 +00:00
compat Implement more list header file functions. 2016-12-26 10:41:51 +00:00
conf Import drm_patform.c, an implementation of non-PCI based attachment 2016-12-26 14:28:23 +00:00
contrib [vchi] replace non-reproducible __DATE__/__TIME__ with hardcoded string 2016-12-26 02:51:03 +00:00
crypto Add accelerated AES with using the ARMv8 crypto instructions. This is based 2016-11-21 11:18:00 +00:00
ddb Use casts to force an unsigned comparison in db_search_symbol(). 2016-12-14 00:18:12 +00:00
dev [evdev] Fix build for older versions of clang 2016-12-26 17:48:13 +00:00
fs Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors. 2016-12-23 23:14:53 +00:00
gdb
geom build: Unbreak LINT 2016-12-21 01:39:11 +00:00
gnu Add Ingenic X1000 DTS files (unofficial). 2016-11-19 15:03:49 +00:00
i386 Move the objects used to create temporary mappings for i386 pmap zero and copy 2016-12-23 15:14:56 +00:00
isa
kern Make knote KN_INFLUX state counted. This is final fix for the issue 2016-12-26 19:33:40 +00:00
kgssapi
libkern Update r309143 to prevent false sharing. 2016-11-25 17:20:23 +00:00
mips Add driver for JZ4780 RTC device. 2016-12-24 02:31:26 +00:00
modules hyperv/ic: Rename cleaned up files. 2016-12-20 09:46:14 +00:00
net Remove stray debugging code from r310180 2016-12-20 15:45:53 +00:00
net80211 net80211: fix 'pending CAC -> RUN transition lost' bug. 2016-12-24 23:43:14 +00:00
netgraph Changes to allow the patching of packets with an offset (and other changes.. see man page) 2016-12-02 10:47:10 +00:00
netinet Whitespace changes. 2016-12-26 11:06:41 +00:00
netinet6 Whitespace changes. 2016-12-26 11:06:41 +00:00
netipsec Add a missing header 2016-11-26 23:15:11 +00:00
netnatm
netpfil Improve upon r309394 2016-12-10 03:31:38 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4 2016-09-30 08:23:06 +00:00
opencrypto Add support for the fpu_kern(9) KPI on arm64. It hooks into the existing 2016-10-20 09:22:10 +00:00
pc98 Add a COMPAT_FREEBSD11 kernel option. 2016-12-09 18:54:12 +00:00
powerpc Use the correct format specifier for physmem chunk sizes. 2016-12-25 20:19:32 +00:00
riscv Disable superpages reservations as we don't have implemented them yet. 2016-11-21 12:00:31 +00:00
rpc
security Audit 'fd' and 'cmd' arguments to fcntl(2), and when generating BSM, 2016-11-22 00:41:24 +00:00
sparc64 Add support for encrypted kernel crash dumps. 2016-12-10 16:20:39 +00:00
sys Make knote KN_INFLUX state counted. This is final fix for the issue 2016-12-26 19:33:40 +00:00
teken
tests
tools
ufs Release laundered vnode pages to the head of the inactive queue. 2016-11-23 17:53:07 +00:00
vm Remove redundancy in vmtotal(). 2016-12-26 19:29:04 +00:00
x86 xen: fix IPI setup with EARLY_AP_STARTUP 2016-12-22 16:09:44 +00:00
xdr
xen xen: fix IPI setup with EARLY_AP_STARTUP 2016-12-22 16:09:44 +00:00
Makefile