HardenedBSD/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
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
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
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
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
libkern
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
netgraph
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
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
opencrypto
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
security
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
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
xdr
xen
Makefile