From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eduard Zingerman <eddyz87@gmail.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
kkd@meta.com, kernel-team@meta.com
Subject: [PATCH bpf-next v1 12/14] resolve_btfids: Drop KF_ARENA_ARG flag support
Date: Sat, 22 Aug 2026 01:35:06 +0200 [thread overview]
Message-ID: <20260821233516.3426127-13-memxor@gmail.com> (raw)
In-Reply-To: <20260821233516.3426127-1-memxor@gmail.com>
Arena argument suffixes now describe the address-space contract at any
parameter position, while the kernel no longer publishes KF_ARENA_ARG1
or KF_ARENA_ARG2. Keeping private copies in resolve_btfids would leave an
obsolete second annotation mechanism and silently accept flags the
kernel no longer understands.
Derive arena arguments exclusively from their suffixes and retain
KF_ARENA_RET for functions returning arena pointers. Update the resolver
selftest to distinguish return-only flags, unannotated pointer arguments,
and suffix-annotated arguments.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
tools/bpf/resolve_btfids/main.c | 22 ++-----------------
.../selftests/bpf/prog_tests/resolve_btfids.c | 22 ++++++-------------
2 files changed, 9 insertions(+), 35 deletions(-)
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index 37d7e7224207..3dbf329edb46 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -177,8 +177,6 @@ struct object {
#define KF_FASTCALL (1 << 12)
#define KF_ARENA_RET (1 << 13)
-#define KF_ARENA_ARG1 (1 << 14)
-#define KF_ARENA_ARG2 (1 << 15)
#define KF_IMPLICIT_ARGS (1 << 16)
#define KF_IMPL_SUFFIX "_impl"
#define TYPE_ATTR_ARENA "address_space(1)"
@@ -1317,22 +1315,6 @@ static int process_kfunc_with_implicit_args(struct btf2btf_context *ctx, struct
return 0;
}
-static bool is_arena_arg(const struct btf *btf, const struct kfunc *kfunc,
- const struct btf_param *param, u32 idx)
-{
- if (is_arena_param(btf, param))
- return true;
-
- switch (idx) {
- case 0:
- return kfunc->flags & KF_ARENA_ARG1;
- case 1:
- return kfunc->flags & KF_ARENA_ARG2;
- default:
- return false;
- }
-}
-
static s32 arena_tag_ptr(struct btf *btf, u32 ptr_id, struct kfunc *kfunc)
{
const struct btf_type *ptr = btf__type_by_id(btf, ptr_id);
@@ -1382,7 +1364,7 @@ static s32 add_arena_tagged_proto(struct btf *btf, struct kfunc *kfunc)
int err, i;
for (i = 0; i < nr_params; i++) {
- if (is_arena_arg(btf, kfunc, ¶ms[i], i)) {
+ if (is_arena_param(btf, ¶ms[i])) {
has_arena_arg = true;
break;
}
@@ -1420,7 +1402,7 @@ static s32 add_arena_tagged_proto(struct btf *btf, struct kfunc *kfunc)
for (i = 0; i < nr_params; i++) {
t = btf__type_by_id(btf, new_proto_id);
tag_params = btf_params(t);
- if (!is_arena_arg(btf, kfunc, &tag_params[i], i))
+ if (!is_arena_param(btf, &tag_params[i]))
continue;
id = arena_tag_ptr(btf, tag_params[i].type, kfunc);
diff --git a/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c b/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
index 3f9949e8227d..a4381c7fa7da 100644
--- a/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
+++ b/tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
@@ -23,13 +23,6 @@
#ifndef KF_ARENA_RET
#define KF_ARENA_RET (1 << 13)
#endif
-#ifndef KF_ARENA_ARG1
-#define KF_ARENA_ARG1 (1 << 14)
-#endif
-#ifndef KF_ARENA_ARG2
-#define KF_ARENA_ARG2 (1 << 15)
-#endif
-
struct symbol {
const char *name;
int type;
@@ -57,9 +50,8 @@ struct kfunc_symbol {
static struct kfunc_symbol kfunc_symbols[] = {
{ "kfunc_a", -1, 0, 0, false },
{ "kfunc_b", -1, KF_FASTCALL, 0, false },
- { "kfunc_c", -1, KF_ARENA_RET | KF_ARENA_ARG1 | KF_ARENA_ARG2,
- ARENA_ARG(0) | ARENA_ARG(1), true },
- { "kfunc_d", -1, KF_ARENA_ARG2, ARENA_ARG(1), false },
+ { "kfunc_c", -1, KF_ARENA_RET, 0, true },
+ { "kfunc_d", -1, 0, 0, false },
{ "kfunc_e", -1, 0, ARENA_ARG(0) | ARENA_ARG(1) | ARENA_ARG(2) |
ARENA_ARG(3) | ARENA_ARG(4), false },
{ "kfunc_f", -1, 0, ARENA_ARG(1), false },
@@ -111,8 +103,8 @@ BTF_SET_END(test_set)
BTF_KFUNCS_START(test_kfunc_set)
BTF_ID_FLAGS(func, kfunc_a)
BTF_ID_FLAGS(func, kfunc_b, KF_FASTCALL)
-BTF_ID_FLAGS(func, kfunc_c, KF_ARENA_RET | KF_ARENA_ARG1 | KF_ARENA_ARG2)
-BTF_ID_FLAGS(func, kfunc_d, KF_ARENA_ARG2)
+BTF_ID_FLAGS(func, kfunc_c, KF_ARENA_RET)
+BTF_ID_FLAGS(func, kfunc_d)
BTF_ID_FLAGS(func, kfunc_e)
BTF_ID_FLAGS(func, kfunc_f)
BTF_ID_FLAGS(func, kfunc_g, KF_ARENA_RET)
@@ -126,8 +118,8 @@ BTF_KFUNCS_START(test_kfunc_set_rev)
BTF_ID_FLAGS(func, kfunc_g, KF_ARENA_RET)
BTF_ID_FLAGS(func, kfunc_f)
BTF_ID_FLAGS(func, kfunc_e)
-BTF_ID_FLAGS(func, kfunc_d, KF_ARENA_ARG2)
-BTF_ID_FLAGS(func, kfunc_c, KF_ARENA_RET | KF_ARENA_ARG1 | KF_ARENA_ARG2)
+BTF_ID_FLAGS(func, kfunc_d)
+BTF_ID_FLAGS(func, kfunc_c, KF_ARENA_RET)
BTF_ID_FLAGS(func, kfunc_b, KF_FASTCALL)
BTF_ID_FLAGS(func, kfunc_a)
BTF_KFUNCS_END(test_kfunc_set_rev)
@@ -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.
*/
--
2.53.0
next prev parent reply other threads:[~2026-08-21 23:35 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 23:34 [PATCH bpf-next v1 00/14] Retire KF_ARENA_ARG kfunc flags Kumar Kartikeya Dwivedi
2026-08-21 23:34 ` [PATCH bpf-next v1 01/14] bpf: Split arena kfunc and struct_ops JIT capabilities Kumar Kartikeya Dwivedi
2026-08-22 0:46 ` bot+bpf-ci
2026-08-24 22:28 ` Eduard Zingerman
2026-08-24 22:37 ` Kumar Kartikeya Dwivedi
2026-08-26 19:52 ` Ihor Solodrai
2026-08-21 23:34 ` [PATCH bpf-next v1 02/14] bpf, riscv: Fix stack-passed arguments for indirect trampolines Kumar Kartikeya Dwivedi
2026-08-24 6:21 ` Pu Lehui
2026-08-21 23:34 ` [PATCH bpf-next v1 03/14] bpf, riscv: JIT arena kfunc argument rebasing Kumar Kartikeya Dwivedi
2026-08-24 6:36 ` Pu Lehui
2026-08-21 23:34 ` [PATCH bpf-next v1 04/14] bpf, riscv: Convert struct_ops arena arguments in the trampoline Kumar Kartikeya Dwivedi
2026-08-21 23:44 ` sashiko-bot
2026-08-24 6:38 ` Pu Lehui
2026-08-21 23:34 ` [PATCH bpf-next v1 05/14] bpf, s390: JIT arena kfunc argument rebasing Kumar Kartikeya Dwivedi
2026-08-21 23:35 ` [PATCH bpf-next v1 06/14] bpf, s390: Convert struct_ops arena arguments Kumar Kartikeya Dwivedi
2026-08-22 0:46 ` bot+bpf-ci
2026-08-21 23:35 ` [PATCH bpf-next v1 07/14] bpf, loongarch: Fix stack arguments for indirect trampolines Kumar Kartikeya Dwivedi
2026-08-22 0:46 ` bot+bpf-ci
2026-08-28 4:33 ` Tiezhu Yang
2026-08-28 4:55 ` Kumar Kartikeya Dwivedi
2026-08-28 8:19 ` Tiezhu Yang
2026-08-21 23:35 ` [PATCH bpf-next v1 08/14] bpf, loongarch: JIT arena kfunc argument rebasing Kumar Kartikeya Dwivedi
2026-08-21 23:46 ` sashiko-bot
2026-08-21 23:35 ` [PATCH bpf-next v1 09/14] bpf, loongarch: Convert struct_ops arena arguments in trampolines Kumar Kartikeya Dwivedi
2026-08-21 23:51 ` sashiko-bot
2026-08-21 23:35 ` [PATCH bpf-next v1 10/14] bpf, powerpc: JIT arena kfunc argument rebasing Kumar Kartikeya Dwivedi
2026-08-22 0:46 ` bot+bpf-ci
2026-08-21 23:35 ` [PATCH bpf-next v1 11/14] bpf: Replace arena kfunc argument flags with suffixes Kumar Kartikeya Dwivedi
2026-08-21 23:58 ` sashiko-bot
2026-08-22 0:46 ` bot+bpf-ci
2026-08-24 22:15 ` Eduard Zingerman
2026-08-24 22:52 ` Kumar Kartikeya Dwivedi
2026-08-26 20:42 ` Ihor Solodrai
2026-08-28 5:07 ` Kumar Kartikeya Dwivedi
2026-08-21 23:35 ` Kumar Kartikeya Dwivedi [this message]
2026-08-22 0:46 ` [PATCH bpf-next v1 12/14] resolve_btfids: Drop KF_ARENA_ARG flag support bot+bpf-ci
2026-08-24 22:25 ` Eduard Zingerman
2026-08-24 22:53 ` Kumar Kartikeya Dwivedi
2026-08-26 20:47 ` Ihor Solodrai
2026-08-21 23:35 ` [PATCH bpf-next v1 13/14] selftests/bpf: Exercise arena arguments on every capable JIT Kumar Kartikeya Dwivedi
2026-08-22 0:46 ` bot+bpf-ci
2026-08-26 20:50 ` Ihor Solodrai
2026-08-28 5:00 ` Kumar Kartikeya Dwivedi
2026-08-21 23:35 ` [PATCH bpf-next v1 14/14] docs/bpf: Document split arena argument JIT capabilities Kumar Kartikeya Dwivedi
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=20260821233516.3426127-13-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--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 \
/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.