]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
raw: convert raw sockets to RCU
authorEric Dumazet <edumazet@google.com>
Sat, 18 Jun 2022 03:47:05 +0000 (20:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:40:49 +0000 (14:40 +0200)
commit648067dd541591a0ddaa31afaaf4a7655d33c0d8
tree6fb924075a5c90d3a884c3d37fa2fdf5d5c5b9b9
parent09c0229301c2d7dcc00201d3af5a43543049e91f
raw: convert raw sockets to RCU

[ Upstream commit 0daf07e527095e64ee8927ce297ab626643e9f51 ]

Using rwlock in networking code is extremely risky.
writers can starve if enough readers are constantly
grabing the rwlock.

I thought rwlock were at fault and sent this patch:

https://lkml.org/lkml/2022/6/17/272

But Peter and Linus essentially told me rwlock had to be unfair.

We need to get rid of rwlock in networking code.

Without this fix, following script triggers soft lockups:

for i in {1..48}
do
 ping -f -n -q 127.0.0.1 &
 sleep 0.1
done

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/raw.h
include/net/rawv6.h
net/ipv4/af_inet.c
net/ipv4/raw.c
net/ipv4/raw_diag.c
net/ipv6/af_inet6.c
net/ipv6/raw.c