linux/net/sctp
Eric Dumazet ceb5d58b21 net: fix sock_wake_async() rcu protection
Dmitry provided a syzkaller (http://github.com/google/syzkaller)
triggering a fault in sock_wake_async() when async IO is requested.

Said program stressed af_unix sockets, but the issue is generic
and should be addressed in core networking stack.

The problem is that by the time sock_wake_async() is called,
we should not access the @flags field of 'struct socket',
as the inode containing this socket might be freed without
further notice, and without RCU grace period.

We already maintain an RCU protected structure, "struct socket_wq"
so moving SOCKWQ_ASYNC_NOSPACE & SOCKWQ_ASYNC_WAITDATA into it
is the safe route.

It also reduces number of cache lines needing dirtying, so might
provide a performance improvement anyway.

In followup patches, we might move remaining flags (SOCK_NOSPACE,
SOCK_PASSCRED, SOCK_PASSSEC) to save 8 bytes and let 'struct socket'
being mostly read and let it being shared between cpus.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-01 15:45:05 -05:00
..
Kconfig
Makefile
associola.c mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
auth.c sctp: translate host order to network order when setting a hmacid 2015-11-15 18:27:27 -05:00
bind_addr.c
chunk.c switch sctp_user_addto_chunk() and sctp_datamsg_from_user() to passing iov_iter 2014-11-24 05:16:40 -05:00
debug.c
endpointola.c
input.c
inqueue.c
ipv6.c ipv6: Add rt6_get_cookie() function 2015-05-25 13:25:34 -04:00
objcnt.c
output.c sctp: Fix race between OOTB responce and route removal 2015-06-29 09:28:42 -07:00
outqueue.c
primitive.c
probe.c
proc.c sctp: replace seq_printf with seq_puts 2014-10-30 19:40:16 -04:00
protocol.c sctp: fix race on protocol/netns initialization 2015-09-11 15:00:02 -07:00
sm_make_chunk.c net: sctp: avoid incorrect time_t use 2015-10-05 03:16:48 -07:00
sm_sideeffect.c sctp: Prevent soft lockup when sctp_accept() is called during a timeout event 2015-09-28 21:03:40 -07:00
sm_statefuns.c net: sctp: avoid incorrect time_t use 2015-10-05 03:16:48 -07:00
sm_statetable.c
socket.c net: fix sock_wake_async() rcu protection 2015-12-01 15:45:05 -05:00
ssnmap.c
sysctl.c sctp: avoid to repeatedly declare external variables 2015-03-25 11:40:16 -04:00
transport.c remove abs64() 2015-11-09 15:11:24 -08:00
tsnmap.c
ulpevent.c
ulpqueue.c net: introduce SO_INCOMING_CPU 2014-11-11 13:00:06 -05:00