From: Michal Luczaj <mhal@rbox.co>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Eric Dumazet <edumazet@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
John Fastabend <john.fastabend@gmail.com>,
Jakub Sitnicki <jakub@cloudflare.com>,
Jiayuan Chen <jiayuan.chen@linux.dev>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Stanislav Fomichev <sdf@fomichev.me>,
Martin KaFai Lau <martin.lau@linux.dev>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>, Joe Stringer <joe@wand.net.nz>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH bpf 3/3] bpf: Unconditionally take socket references in lookup helpers
Date: Mon, 3 Aug 2026 11:07:53 +0200 [thread overview]
Message-ID: <e9e7e534-80d5-4597-b340-e7f34ca08d8f@rbox.co> (raw)
In-Reply-To: <DKDR02T36EVT.ODA2A3LW6MC2@gmail.com>
On 8/1/26 18:29, Kumar Kartikeya Dwivedi wrote:
> On Thu Jul 30, 2026 at 1:55 PM CEST, Michal Luczaj wrote:
>> On 7/29/26 22:32, Emil Tsalapatis wrote:
>>> On Thu Jul 23, 2026 at 7:33 AM EDT, Michal Luczaj wrote:
>>>> Lookup helpers gate whether to acquire a socket reference on
>>>> sk_is_refcounted(), a check re-evaluated at release. An established socket
>>>> refcounted at acquire time can gain SOCK_RCU_FREE via
>>>> connect(AF_UNSPEC)+listen() before release runs; the release-side re-check
>>>> then reads sk_is_refcounted() == false and skips the put. The reference
>>>> leaks.
>>>>
>>>> Make acquire and release unconditional and symmetric: always take a
>>>> reference, always put it. Adapt sk_select_reuseport().
>>>
>>> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
>>
>> Thanks!
>>
>>> The bot's concern about the comment style is obviously invalid here.
>>
>> Are the prompts incorrect?
>> https://github.com/masoncl/review-prompts/blob/59469708305eca305cbd9eb94e5aa0ee3627529c/kernel/subsystem/bpf.md#bpf-comment-style
>>
>
> The prompt is correct, but we don't bother for existing comments, if you add a
> new one, you can use the new style.
>
> Overall, looks like the set is pretty close. You can respin targeting bpf-next
> as John suggested (and we can wait for his ack before landing) so it can go
> through CI again.
Sure, here's v2 with patch 1 dropped (I'll repost it targeting bpf-next
later):
https://lore.kernel.org/bpf/20260803-sockmap-lookup-tcp-leak-2-0-306e025bfe66@rbox.co/
thanks,
Michal
prev parent reply other threads:[~2026-08-03 9:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 11:33 [PATCH bpf 0/3] bpf: Fix socket leaks around connect(AF_UNSPEC)+listen() Michal Luczaj
2026-07-23 11:33 ` [PATCH bpf 1/3] bpf, sockmap: Use sock_hold() instead of refcount_inc_not_zero() in lookup Michal Luczaj
2026-07-25 0:00 ` John Fastabend
2026-07-25 18:07 ` Michal Luczaj
2026-07-29 20:29 ` Emil Tsalapatis
2026-07-23 11:33 ` [PATCH bpf 2/3] bpf: Extract shared reqsk-to-listener upgrade Michal Luczaj
2026-07-29 20:30 ` Emil Tsalapatis
2026-07-23 11:33 ` [PATCH bpf 3/3] bpf: Unconditionally take socket references in lookup helpers Michal Luczaj
2026-07-23 15:25 ` bot+bpf-ci
2026-07-29 20:32 ` Emil Tsalapatis
2026-07-30 11:55 ` Michal Luczaj
2026-08-01 16:29 ` Kumar Kartikeya Dwivedi
2026-08-03 9:07 ` Michal Luczaj [this message]
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=e9e7e534-80d5-4597-b340-e7f34ca08d8f@rbox.co \
--to=mhal@rbox.co \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=emil@etsalapatis.com \
--cc=horms@kernel.org \
--cc=jakub@cloudflare.com \
--cc=jiayuan.chen@linux.dev \
--cc=joe@wand.net.nz \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sashiko-bot@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=willemb@google.com \
--cc=yonghong.song@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
all inboxes | Powered by JetHome®