From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: <bot+bpf-ci@kernel.org>, <bpf@vger.kernel.org>
Cc: <ast@kernel.org>, <andrii@kernel.org>, <daniel@iogearbox.net>,
<eddyz87@gmail.com>, <emil@etsalapatis.com>, <tj@kernel.org>,
<ihor.solodrai@linux.dev>, <kkd@meta.com>, <kernel-team@meta.com>,
<martin.lau@kernel.org>, <yonghong.song@linux.dev>,
<clm@meta.com>
Subject: Re: [PATCH bpf-next v1 1/2] resolve_btfids: Emit arena attributes from kfunc parameter suffixes
Date: Sun, 09 Aug 2026 16:08:01 +0200 [thread overview]
Message-ID: <DKKH029BDMUE.ZRUN10UFRGLP@gmail.com> (raw)
In-Reply-To: <dc4f01fc137a1c4c66bb2eb39f721654bf539f065a623af7dd05b90c32b6f569@mail.kernel.org>
On Sun Aug 9, 2026 at 12:10 PM CEST, bot+bpf-ci wrote:
>> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
>> index d2e4176339da..3c88ea192f7b 100644
>> --- a/tools/bpf/resolve_btfids/main.c
>> +++ b/tools/bpf/resolve_btfids/main.c
>
> [ ... ]
>
>> @@ -1067,6 +1070,22 @@ static int collect_decl_tags(struct btf2btf_context *ctx)
>> return 0;
>> }
>>
>> +static bool param_name_has_suffix(const char *name, const char *suffix)
>> +{
>> + size_t name_len = strlen(name);
>> + size_t suffix_len = strlen(suffix);
>> +
>> + return name_len >= suffix_len && !strcmp(name + name_len - suffix_len, suffix);
>> +}
>
> Should this be `name_len > suffix_len` instead of `name_len >= suffix_len`?
>
> The kernel's btf_param_match_suffix() in kernel/bpf/btf.c rejects a parameter
> whose name is exactly equal to the suffix:
>
> kernel/bpf/btf.c:btf_param_match_suffix() {
> ...
> len = strlen(param_name);
> if (len <= suffix_len)
> return false;
> param_name += len - suffix_len;
> return !strncmp(param_name, suffix, suffix_len);
> }
>
> That `len <= suffix_len` early return is what both is_kfunc_arg_arena() in
> kernel/bpf/verifier.c and btf_func_model_flags() in kernel/bpf/btf.c rely on.
> The same helper is also used by kernel/bpf/bpf_struct_ops.c for arena suffix
> matching.
>
> With the current implementation, a parameter named exactly "__arena" would be
> treated as an arena pointer by resolve_btfids (causing address_space(1) to be
> emitted in vmlinux.h), but would be treated as an ordinary kernel pointer by
> the verifier's is_kfunc_arg_arena().
>
> No in-tree kfunc currently uses a parameter named exactly "__arena" or
> "__arena__nullable" (checked kernel/bpf/arena.c, test_kmods/bpf_testmod.c,
> and btf_data.c), and the selftests added by commit 52b915d08490 only use
> names like "a__arena", so this would be a latent inconsistency rather than a
> currently-firing failure.
>
I think it's fine, won't matter in practice.
>> +
>> +static bool is_arena_param(const struct btf *btf, const struct btf_param *param)
>> +{
>> + const char *name = btf__name_by_offset(btf, param->name_off);
>> +
>> + return param_name_has_suffix(name, PARAM_SUFFIX_ARENA) ||
>> + param_name_has_suffix(name, PARAM_SUFFIX_ARENA_NULLABLE);
>> +}
>
> [ ... ]
>
>
> ---
> 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/31305217088
next prev parent reply other threads:[~2026-08-09 14:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 8:51 [PATCH bpf-next v1 0/2] Add resolve_btfids support for __arena kfunc suffix Kumar Kartikeya Dwivedi
2026-08-09 8:51 ` [PATCH bpf-next v1 1/2] resolve_btfids: Emit arena attributes from kfunc parameter suffixes Kumar Kartikeya Dwivedi
2026-08-09 10:10 ` bot+bpf-ci
2026-08-09 14:08 ` Kumar Kartikeya Dwivedi [this message]
2026-08-11 0:11 ` Ihor Solodrai
2026-08-09 8:51 ` [PATCH bpf-next v1 2/2] selftests/bpf: Test resolve_btfids arena argument suffixes Kumar Kartikeya Dwivedi
2026-08-09 9:57 ` bot+bpf-ci
2026-08-09 14:07 ` Kumar Kartikeya Dwivedi
2026-08-11 0:16 ` Ihor Solodrai
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=DKKH029BDMUE.ZRUN10UFRGLP@gmail.com \
--to=memxor@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=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@meta.com \
--cc=kkd@meta.com \
--cc=martin.lau@kernel.org \
--cc=tj@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