From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: xmei5@asu.edu, daniel@iogearbox.net, john.fastabend@gmail.com,
sdf@fomichev.me, martin.lau@linux.dev, ast@kernel.org,
andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
emil@etsalapatis.com, ihor.solodrai@linux.dev,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
aditi.ghag@isovalent.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
martin.lau@kernel.org, mason@kernel.org
Subject: Re: [PATCH bpf 1/2] bpf: Fix out-of-bounds read of sk_protocol in bpf_sock_destroy()
Date: Thu, 3 Sep 2026 22:34:53 +0800 [thread overview]
Message-ID: <dfc2ac40-a1d8-4ec1-a8b7-fcfd85408b75@linux.dev> (raw)
In-Reply-To: <88d25f82f5261c0a7f12d6e82988bda387f8180c656cd163eec959d327f48769@mail.kernel.org>
on 9/3/26 10:01 PM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 61940e7535523..1bbb72138ac64 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -12912,8 +12912,8 @@ __bpf_kfunc_start_defs();
>> * @sock: Pointer to socket to be destroyed
>> *
>> * Return:
>> - * On error, may return EPROTONOSUPPORT, EINVAL.
>> - * EPROTONOSUPPORT if protocol specific destroy handler is not supported.
>> + * On error, may return EOPNOTSUPP, EINVAL.
>> + * EOPNOTSUPP if protocol specific destroy handler is not supported.
>> * 0 otherwise
> The EPROTONOSUPPORT -> EOPNOTSUPP correction is right, but the rewritten
> error list is incomplete. tcp_abort() returns -ENOENT when the socket is
> already closed (net/ipv4/tcp.c, around the sk_state == TCP_CLOSE check):
>
> /* Avoid closing the same socket twice. */
> if (sk->sk_state == TCP_CLOSE) {
> if (!has_current_bpf_ctx())
> release_sock(sk);
> return -ENOENT;
> }
>
> That error propagates through sk->sk_prot->diag_destroy(sk, ECONNABORTED)
> and is reachable from a BPF iterator (destroying a sock the iterator
> already destroyed, or one closed concurrently). In contrast, EINVAL is only
> reachable through the narrower tcp_abort_override() path for MPTCP listener
> subflows.
>
> Should ENOENT be added to the list?
I'd like to describe it as "others" since diag_destroy may change it's
return value.
prev parent reply other threads:[~2026-09-03 14:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 12:52 [PATCH bpf 1/2] bpf: Fix out-of-bounds read of sk_protocol in bpf_sock_destroy() Jiayuan Chen
2026-09-03 12:52 ` [PATCH bpf 2/2] selftests/bpf: Test bpf_sock_destroy() on a TIME_WAIT sock Jiayuan Chen
2026-09-03 14:01 ` [PATCH bpf 1/2] bpf: Fix out-of-bounds read of sk_protocol in bpf_sock_destroy() bot+bpf-ci
2026-09-03 14:34 ` Jiayuan Chen [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=dfc2ac40-a1d8-4ec1-a8b7-fcfd85408b75@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=aditi.ghag@isovalent.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@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=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=xmei5@asu.edu \
--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