[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <04f683c6-ac49-05fb-6ec9-9f0d698657a2@gmail.com>
Date: Fri, 27 Sep 2019 10:24:49 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Martin KaFai Lau <kafai@...com>, bpf@...r.kernel.org,
netdev@...r.kernel.org
Cc: Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>, kernel-team@...com
Subject: Re: [PATCH bpf] bpf: Fix a race in reuseport_array_free()
On 9/27/19 9:52 AM, Martin KaFai Lau wrote:
> In reuseport_array_free(), the rcu_read_lock() cannot ensure sk is still
> valid. It is because bpf_sk_reuseport_detach() can be called from
> __sk_destruct() which is invoked through call_rcu(..., __sk_destruct).
We could question why reuseport_detach_sock(sk) is called from __sk_destruct()
(after the rcu grace period) instead of sk_destruct() ?
>
> This patch takes the reuseport_lock in reuseport_array_free() which
> is not the fast path. The lock is taken inside the loop in case
> that the bpf map is big.
>
> Signed-off-by: Martin KaFai Lau <kafai@...com>
Fixes: 5dc4c4b7d4e8 ("bpf: Introduce BPF_MAP_TYPE_REUSEPORT_SOCKARRAY")
Powered by blists - more mailing lists