All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Willem de Bruijn <willemb@google.com>,
	 Simon Horman <horms@kernel.org>,
	 Lorenz Bauer <lmb@cloudflare.com>,
	 Kuniyuki Iwashima <kuni1840@gmail.com>,
	 netdev@vger.kernel.org
Subject: Re: [PATCH v1 net] net: Annotate sk->sk_write_space() for UDP SOCKMAP.
Date: Mon, 01 Jun 2026 12:45:05 +0200	[thread overview]
Message-ID: <87cxya5yku.fsf@cloudflare.com> (raw)
In-Reply-To: <20260529193941.3897256-1-kuniyu@google.com> (Kuniyuki Iwashima's message of "Fri, 29 May 2026 19:39:23 +0000")

On Fri, May 29, 2026 at 07:39 PM GMT, Kuniyuki Iwashima wrote:
> UDP TX skb->destructor() is sock_wfree(), and UDP holds lock_sock()
> only for UDP_CORK / MSG_MORE sendmsg().

Nit: lock_sock() serializes map updates via bpf() syscall. We also have
sockmap iterator programs which can insert UDP sockets into sockmap. On
this path, sock_map_update_elem, we grab only bh_lock_sock, so the race
against UDP_CORK / MSG_MORE sendmsg() path also exists.

> Otherwise, sk->sk_write_space() may be read locklessly while SOCKMAP
> rewrites sk->sk_write_space().
>
> Let's use WRITE_ONCE() and READ_ONCE() for sk->sk_write_space().
>
> Note that the write side is annotated by commit 2ef2b20cf4e0
> ("net: annotate data-races around sk->sk_{data_ready,write_space}").
>
> Fixes: 7b98cd42b049 ("bpf: sockmap: Add UDP support")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> ---

Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>

  reply	other threads:[~2026-06-01 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 19:39 [PATCH v1 net] net: Annotate sk->sk_write_space() for UDP SOCKMAP Kuniyuki Iwashima
2026-06-01 10:45 ` Jakub Sitnicki [this message]
2026-06-02 19:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cxya5yku.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.