Re: [PATCH net] net: restrict SO_REUSEPORT to TCP, UDP and SCTP sockets
From: Martin KaFai Lau <martin.lau@linux.dev>
Date: 2025-01-10 19:13:51
On 12/31/24 4:44 AM, Eric Dumazet wrote:
On Tue, Dec 31, 2024 at 1:07 AM Jakub Kicinski [off-list ref] wrote:quoted
On Mon, 30 Dec 2024 19:34:30 +0000 Eric Dumazet wrote:quoted
After blamed commit, crypto sockets could accidentally be destroyed from RCU callback, as spotted by zyzbot [1]. Trying to acquire a mutex in RCU callback is not allowed. Restrict SO_REUSEPORT socket option to TCP, UDP and SCTP sockets.Looks like fcnal_test.sh and reuseport_addr_any.sh are failing after this patch, we need to adjust their respective binaries. I'll hide this patch from patchwork, even tho it's probably right..It seems we should support raw sockets, they already use SOCK_RCU_FREE anyway. Although sk_reuseport_attach_bpf() has the following checks : if ((sk->sk_type != SOCK_STREAM && sk->sk_type != SOCK_DGRAM) || (sk->sk_protocol != IPPROTO_UDP && sk->sk_protocol != IPPROTO_TCP) || (sk->sk_family != AF_INET && sk->sk_family != AF_INET6)) {
I think this should be mostly aligned with what is supported in the bpf reuseport_array and sock_map. This can be changed if other sock supported is added to the bpf map.
err = -ENOTSUPP; goto err_prog_put; }