Re: [PATCH bpf-next v1 12/14] resolve_btfids: Drop KF_ARENA_ARG flag support
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <633e8cec05d3a6c95f8c3ce2343469d4341c5b8d7c4da1bfbf5a79d22fcd77f1@mail.kernel.org> |
> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
> index 37d7e7224207d..3dbf329edb469 100644
> --- a/tools/bpf/resolve_btfids/main.c
> +++ b/tools/bpf/resolve_btfids/main.c
[ ... ]
> diff --git a/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c b/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
> index 3f9949e8227df..a4381c7fa7da4 100644
> --- a/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
> +++ b/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
[ ... ]
> @@ -315,7 +307,7 @@ void test_resolve_btfids(void)
> }
>
> /*
> - * Check resolve_btfids wrapped exactly the arena-flagged or suffixed
> + * Check resolve_btfids wrapped exactly the arena return or suffixed
> * return/args with the address_space(1) type attribute, and left other
> * pointers/returns untouched.
> */
Does the reworded comment accurately describe the mechanism? After this
patch there are exactly two annotation sources: KF_ARENA_RET for the
return value, and the __arena/__arena__nullable parameter-name suffixes
for arguments.
A return value has no parameter name, so it cannot be suffix-annotated.
Looking at add_arena_tagged_proto():
if (kfunc->flags & KF_ARENA_RET) {
ret_type_id = arena_tag_ptr(btf, ret_type_id, kfunc);
...
if (!is_arena_param(btf, &tag_params[i]))
continue;
is_arena_param() is only ever applied to btf_params(), never to
proto->type.
The new text 'the arena return or suffixed return/args' mentions the
return twice and asserts a 'suffixed return', which the code cannot
produce. The old wording ('arena-flagged or suffixed return/args') was
defensible because 'arena-flagged' collectively covered KF_ARENA_RET,
KF_ARENA_ARG1 and KF_ARENA_ARG2; the reword keeps the '/args' shorthand
but drops the term that made it coherent.
Could this be reworded to 'the KF_ARENA_RET return and the suffixed
args' to match what the code below actually checks?
---
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/32538351576