From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Keisuke Nishimura" <keisuke.nishimura@inria.fr>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
"Amery Hung" <ameryhung@gmail.com>
Cc: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bpf: Fix refcount check in check_struct_ops_btf_id()
Date: Fri, 20 Mar 2026 21:44:33 -0400 [thread overview]
Message-ID: <DH82W06EW1BO.3SO7ZOCFR1DSM@etsalapatis.com> (raw)
In-Reply-To: <20260320130219.63711-1-keisuke.nishimura@inria.fr>
On Fri Mar 20, 2026 at 9:02 AM EDT, Keisuke Nishimura wrote:
> The current implementation only checks whether the first argument is
> refcounted. Fix this by iterating over all arguments.
>
Second Sun's recommendation to add a selftest for this.
> Signed-off-by: Keisuke Nishimura <keisuke.nishimura@inria.fr>
> Fixes: 38f1e66abd184 ("bpf: Do not allow tail call in strcut_ops program with __ref argument")
Nit: strcut_ops -> struct_ops
Once you add the selftest, feel free to add:
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
> ---
> kernel/bpf/verifier.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 159b25f8269d..278443118a23 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -24853,7 +24853,7 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env)
> }
>
> for (i = 0; i < st_ops_desc->arg_info[member_idx].cnt; i++) {
> - if (st_ops_desc->arg_info[member_idx].info->refcounted) {
> + if (st_ops_desc->arg_info[member_idx].info[i].refcounted) {
> has_refcounted_arg = true;
> break;
> }
next prev parent reply other threads:[~2026-03-21 1:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 13:02 [PATCH] bpf: Fix refcount check in check_struct_ops_btf_id() Keisuke Nishimura
2026-03-20 16:57 ` sun jian
2026-03-21 1:44 ` Emil Tsalapatis [this message]
2026-03-21 15:15 ` Amery Hung
2026-03-21 20:24 ` Kumar Kartikeya Dwivedi
2026-03-21 21:40 ` [PATCH bpf-next] selftests/bpf: Add test for struct_ops __ref argument in any position Varun R Mallya
2026-03-21 22:13 ` bot+bpf-ci
2026-03-21 22:19 ` Varun R Mallya
2026-03-22 0:49 ` Keisuke Nishimura
2026-03-24 16:24 ` 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=DH82W06EW1BO.3SO7ZOCFR1DSM@etsalapatis.com \
--to=emil@etsalapatis.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=keisuke.nishimura@inria.fr \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--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 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.