BPF List
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Michal Luczaj <mhal@rbox.co>
Cc: sashiko-reviews@lists.linux.dev,  bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 1/4] bpf, sockmap: Reject unhashed UDP sockets on sockmap update
Date: Mon, 29 Jun 2026 13:37:34 +0200	[thread overview]
Message-ID: <87v7b137cx.fsf@cloudflare.com> (raw)
In-Reply-To: <e08be4f5-0bd9-4228-843d-86ed20594bac@rbox.co> (Michal Luczaj's message of "Sun, 28 Jun 2026 23:59:37 +0200")

On Sun, Jun 28, 2026 at 11:59 PM +02, Michal Luczaj wrote:
> On 6/26/26 22:58, sashiko-bot@kernel.org wrote:
>> [Severity: High]
>> Could a memory ordering regression here allow unbound UDP sockets to still
>> bypass this check?
>> 
>> In udp_v4_get_port(), the flag and hash are set:
>> 
>> net/ipv4/udp.c:udp_v4_get_port() {
>>     ...
>>     sock_set_flag(sk, SOCK_RCU_FREE);
>>     sk_add_node_rcu(sk, &hslot->head);
>>     ...
>> }
>> 
>> Because these stores lack a memory barrier between them, could sk_hashed(sk)
>> return true on another CPU while SOCK_RCU_FREE is not yet visible, allowing
>> the leak to still trigger?
>
> I'd like to verify it on a weakly-ordered CPU; please give me a day or two.

False positive, IMO.
Both ->get_port and sock_map_sk_state_allowed run with sk_lock held.

  reply	other threads:[~2026-06-29 11:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 20:36 [PATCH bpf v2 0/4] bpf, sockmap: Fix sockmap leaking UDP socks Michal Luczaj
2026-06-26 20:36 ` [PATCH bpf v2 1/4] bpf, sockmap: Reject unhashed UDP sockets on sockmap update Michal Luczaj
2026-06-26 20:45   ` Kuniyuki Iwashima
2026-06-26 20:58   ` sashiko-bot
2026-06-28 21:59     ` Michal Luczaj
2026-06-29 11:37       ` Jakub Sitnicki [this message]
2026-06-29 21:40         ` Michal Luczaj
2026-07-01 10:04           ` Jakub Sitnicki
2026-07-01 22:58             ` John Fastabend
2026-07-01 23:19               ` Michal Luczaj
2026-06-29 11:38   ` Jakub Sitnicki
2026-07-01 22:59     ` John Fastabend
2026-06-26 20:36 ` [PATCH bpf v2 2/4] selftests/bpf: Ensure UDP sockets are bound Michal Luczaj
2026-06-26 20:47   ` Kuniyuki Iwashima
2026-06-28 21:58     ` Michal Luczaj
2026-06-26 20:36 ` [PATCH bpf v2 3/4] selftests/bpf: Adapt sockmap update error handling Michal Luczaj
2026-06-26 20:43   ` sashiko-bot
2026-06-28 21:58     ` Michal Luczaj
2026-06-26 20:58   ` Kuniyuki Iwashima
2026-06-28 21:59     ` Michal Luczaj
2026-06-26 21:14   ` bot+bpf-ci
2026-06-26 20:36 ` [PATCH bpf v2 4/4] selftests/bpf: Fail unbound UDP on sockmap update Michal Luczaj
2026-06-26 20:41   ` sashiko-bot
2026-06-28 21:58     ` Michal Luczaj
2026-06-26 21:03   ` Kuniyuki Iwashima
2026-07-01 23:19     ` Michal Luczaj
2026-06-27 17:34 ` [PATCH bpf v2 0/4] bpf, sockmap: Fix sockmap leaking UDP socks sun jian
2026-06-28 22:00   ` Michal Luczaj

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=87v7b137cx.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=bpf@vger.kernel.org \
    --cc=mhal@rbox.co \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox