Thread (6 messages) 6 messages, 3 authors, 8d ago

Re: [PATCH net-next 2/2] net: annotate lockless writes to sk->sk_err

flat view

From: Eric Dumazet <edumazet@kernel.org>
Date: 2026-10-02 08:51:10
Also in: bpf, lkml

On Fri, Oct 2, 2026 at 9:29 AM Quanye Yang via B4 Relay
[off-list ref] wrote:
From: Quanye Yang <redacted>

do_recvmmsg() and getsockopt(SO_ERROR) clear sk_err with xchg()
without the socket lock. TCP, MPTCP and kTLS already peek the same
field with READ_ONCE() or consume it via sock_error().

sock_dequeue_err_skb() still uses plain stores. tcp_recvmsg() can
call it via MSG_ERRQUEUE before lock_sock(), so those writes race
with the annotated readers and with sock_error(). The same unmarked
stores exist in strp_abort_strp() and sk_psock_report_error(), which
run on the TCP/TLS socket.

Annotate those writers with WRITE_ONCE(). No extra ordering is
needed; this does not change who wins when ICMP error-queue entries
overwrite sk_err.

Link: https://lore.kernel.org/netdev/3d9d442f-f168-43da-87b0-010ad5a78365@redhat.com/ (local)
Signed-off-by: Quanye Yang <redacted>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help