From: Varun R Mallya <varunrmallya@gmail.com>
To: bot+bpf-ci@kernel.org
Cc: keisuke.nishimura@inria.fr, ameryhung@gmail.com,
andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
daniel@iogearbox.net, eddyz87@gmail.com, haoluo@google.com,
john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org,
linux-kernel@vger.kernel.org, martin.lau@linux.dev,
sdf@fomichev.me, song@kernel.org, yonghong.song@linux.dev,
martin.lau@kernel.org, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next] selftests/bpf: Add test for struct_ops __ref argument in any position
Date: Sun, 22 Mar 2026 03:49:17 +0530 [thread overview]
Message-ID: <ab8ZZRd-u1_GXy0B@computer> (raw)
In-Reply-To: <923f781f67dc846a8e61ed40f4ce45fc3ae71ba0db3ca3074a02153f33f5c887@mail.kernel.org>
On Sat, Mar 21, 2026 at 10:13:45PM +0000, bot+bpf-ci@kernel.org wrote:
>
> Will this test pass without Keisuke's fix [0] being applied first?
No, it needs to be applied first.
> The stub function has task__nullable as the second argument and
> task__ref as the third. prepare_arg_info() populates the arg_info
> array in order, so info[0] corresponds to the __nullable arg
> (refcounted = false) and info[1] to the __ref arg (refcounted = true).
>
> In check_struct_ops_btf_id(), the loop that sets has_refcounted_arg
> currently reads:
>
> for (i = 0; i < st_ops_desc->arg_info[member_idx].cnt; i++) {
> if (st_ops_desc->arg_info[member_idx].info->refcounted) {
> This always checks info[0].refcounted (the __nullable entry, which is
> false), never info[i].refcounted. The __ref argument at info[1] is
> never examined, so has_refcounted_arg stays false and the tail call
> is permitted.
>
> Since the test expects __failure, but the program loads successfully
> without the fix, the test will always fail when run on a tree that
> does not include the companion verifier fix.
>
> This patch may need to be folded into (or applied after) Keisuke's
> fix so the two land together.
Yes, that is the intention.
> > + /* ctx[2] is used because the refcounted variable is the third argument */
> > + struct task_struct *refcounted_task = (struct task_struct *)ctx[2];
> > +
> > + bpf_task_release(refcounted_task);
> > + bpf_tail_call(ctx, &prog_array, 0);
> > +
> > + return 0;
> > +}
>
> [ ... ]
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/23389590355
next prev parent reply other threads:[~2026-03-21 22:19 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
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 [this message]
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=ab8ZZRd-u1_GXy0B@computer \
--to=varunrmallya@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--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@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox