Assert that the corresponding socket is locked when manipulating socket
authormpi <mpi@openbsd.org>
Mon, 26 Jun 2017 09:32:31 +0000 (09:32 +0000)
committermpi <mpi@openbsd.org>
Mon, 26 Jun 2017 09:32:31 +0000 (09:32 +0000)
commit0623538713195a655a6f9d2c9b2e142d4e999c2f
treeaa1152fde2e63c9f9a6f8ce7b63307b81223d922
parentbfc1a4d793981af1bb5de9c61ec0a62874899ede
Assert that the corresponding socket is locked when manipulating socket
buffers.

This is one step towards unlocking TCP input path.  Note that all the
functions asserting for the socket lock are not necessarilly MP-safe.
All the fields of 'struct socket' aren't protected.

Introduce a new kernel-only kqueue hint, NOTE_SUBMIT, to be able to
tell when a filter needs to lock the underlying data structures.  Logic
and name taken from NetBSD.

Tested by Hrvoje Popovski.

ok claudio@, bluhm@, mikeb@
21 files changed:
sys/kern/sys_generic.c
sys/kern/uipc_socket.c
sys/kern/uipc_socket2.c
sys/kern/uipc_usrreq.c
sys/miscfs/fifofs/fifo_vnops.c
sys/net/pfkeyv2.c
sys/net/rtsock.c
sys/netinet/ip_divert.c
sys/netinet/ip_mroute.c
sys/netinet/raw_ip.c
sys/netinet/tcp_input.c
sys/netinet/tcp_output.c
sys/netinet/tcp_subr.c
sys/netinet/tcp_usrreq.c
sys/netinet/udp_usrreq.c
sys/netinet6/ip6_divert.c
sys/netinet6/ip6_mroute.c
sys/netinet6/raw_ip6.c
sys/nfs/nfs_socket.c
sys/sys/event.h
sys/sys/socketvar.h