Re: [PATCH bpf v3 1/5] bpf, sockmap: Annotate af_unix sock::sk_state data-races

From: Kuniyuki Iwashima

Date: Fri Mar 06 2026 - 00:31:08 EST


On Thu, Mar 5, 2026 at 3:31 PM Michal Luczaj <mhal@xxxxxxx> wrote:
>
> sock_map_sk_state_allowed() and sock_map_redirect_allowed() read af_unix
> socket sk_state locklessly.
>
> Use READ_ONCE(). Note that for sock_map_redirect_allowed() change affects
> not only af_unix, but all non-TCP sockets (UDP, af_vsock).
>
> Suggested-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
> Suggested-by: Martin KaFai Lau <martin.lau@xxxxxxxxx>
> Signed-off-by: Michal Luczaj <mhal@xxxxxxx>

Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>

Actually TCP path also needs READ_ONCE(), but I think
it's okay for now since this series focuses on AF_UNIX.