freebsd-nq/sys
Hans Petter Selasky 59854ecf55 Convert all IPv4 and IPv6 multicast memberships into using a STAILQ
instead of a linear array.

The multicast memberships for the inpcb structure are protected by a
non-sleepable lock, INP_WLOCK(), which needs to be dropped when
calling the underlying possibly sleeping if_ioctl() method. When using
a linear array to keep track of multicast memberships, the computed
memory location of the multicast filter may suddenly change, due to
concurrent insertion or removal of elements in the linear array. This
in turn leads to various invalid memory access issues and kernel
panics.

To avoid this problem, put all multicast memberships on a STAILQ based
list. Then the memory location of the IPv4 and IPv6 multicast filters
become fixed during their lifetime and use after free and memory leak
issues are easier to track, for example by: vmstat -m | grep multi

All list manipulation has been factored into inline functions
including some macros, to easily allow for a future hash-list
implementation, if needed.

This patch has been tested by pho@ .

Differential Revision: https://reviews.freebsd.org/D20080
Reviewed by:	markj @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-06-25 11:54:41 +00:00
..
amd64 amd64 pmap: block on turnstile for lock-less DI. 2019-06-23 21:21:11 +00:00
arm Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
arm64 arm64 acpi_iort: add some error handling 2019-06-24 21:24:55 +00:00
bsm
cam Replay r349342 by imp accidentally reverted by r349352 2019-06-25 06:14:31 +00:00
cddl Minimize aggsum_compare(&arc_size, arc_c) calls. 2019-06-14 20:04:28 +00:00
compat LinuxKPI: Additions to rcu list. 2019-06-21 18:48:07 +00:00
conf Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
contrib The definition of icmptypes in ip_compt.h is dead code as it already 2019-06-25 07:04:47 +00:00
crypto aesni(4): Fix trivial type typo 2019-05-27 00:47:51 +00:00
ddb ddb show proc typo 2019-06-22 05:35:23 +00:00
dev Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
dts arm64: Add support for NanoPI NEO2 2019-05-02 12:56:13 +00:00
fs Free all allocated unit IDs in cuse(3) after the client character 2019-06-25 11:46:01 +00:00
gdb
geom Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
gnu dts: Import files from Linux 5.1 2019-05-08 19:27:30 +00:00
i386 sys: Remove DEV_RANDOM device option 2019-06-21 00:16:30 +00:00
isa
kern Add missing include of sys/boot.h 2019-06-24 20:52:21 +00:00
kgssapi Make the warning intervals for deprecated crypto algorithms tunable. 2019-06-11 23:00:55 +00:00
libkern Separate kernel crc32() implementation to its own header (gsb_crc32.h) and 2019-06-17 19:49:08 +00:00
mips sys: Remove DEV_RANDOM device option 2019-06-21 00:16:30 +00:00
modules Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
net Convert all IPv4 and IPv6 multicast memberships into using a STAILQ 2019-06-25 11:54:41 +00:00
net80211 Enhance the comment ieee80211_add_channel() to avoid a 2019-06-10 14:31:18 +00:00
netgraph Remove 'dir' argument in ng_ipfw_input, since ip_fw_args now has this info. 2019-03-14 22:30:05 +00:00
netinet Convert all IPv4 and IPv6 multicast memberships into using a STAILQ 2019-06-25 11:54:41 +00:00
netinet6 Convert all IPv4 and IPv6 multicast memberships into using a STAILQ 2019-06-25 11:54:41 +00:00
netipsec Make the warning intervals for deprecated crypto algorithms tunable. 2019-06-11 23:00:55 +00:00
netpfil Convert all IPv4 and IPv6 multicast memberships into using a STAILQ 2019-06-25 11:54:41 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Fix prio vs. nonprio tagged traffic in RDMACM 2019-06-04 06:21:31 +00:00
opencrypto Move declaration of warninterval out from under COMPAT_FREEBSD32. 2019-06-11 23:28:07 +00:00
powerpc powerpc: Transition to Secure-PLT, like most other OSs 2019-06-25 00:40:44 +00:00
riscv sys: Remove DEV_RANDOM device option 2019-06-21 00:16:30 +00:00
rpc Fix malloc stats for the RPCSEC_GSS server code when DEBUG is enabled. 2019-04-04 01:23:06 +00:00
security Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
sparc64 sys: Remove DEV_RANDOM device option 2019-06-21 00:16:30 +00:00
sys Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
teken
tests
tools Add SDIO support. 2019-06-08 16:26:56 +00:00
ufs Add FIOBMAP2 ioctl 2019-06-20 14:13:10 +00:00
vm vm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE 2019-06-25 07:44:37 +00:00
x86 Currently, MCA entries remain on an every-growing linked list. This means 2019-06-08 18:26:48 +00:00
xdr
xen
Makefile