From: Eduard Zingerman <eddyz87@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Emil Tsalapatis <emil@etsalapatis.com>,
kkd@meta.com, kernel-team@meta.com
Subject: Re: [PATCH bpf-next v3 7/9] selftests/bpf: Add struct_ops __arena and __arena_nullable argument tests
Date: Tue, 04 Aug 2026 23:52:18 -0700 [thread overview]
Message-ID: <fd14689efe162687c9a6dda514815d381b659dad.camel@gmail.com> (raw)
In-Reply-To: <20260803125115.2264733-8-memxor@gmail.com>
On Mon, 2026-08-03 at 14:51 +0200, Kumar Kartikeya Dwivedi wrote:
> From: Tejun Heo <tj@kernel.org>
>
> Add test_arena and test_arena_nullable members to bpf_testmod_ops3 with
> arena-tagged stub arguments and kfuncs that forward a caller-provided
> pointer to them. The kfuncs take arena-tagged arguments, so each round
> trip exercises both conversion directions end to end: the kfunc receives
> a kernel arena address and the trampoline converts it back to an arena
> pointer for the callback.
>
> The non-nullable callback dereferences its argument with no NULL branch
> and captures the raw ctx value, which the trigger program compares
> against the arena offset of the passed object, pinning the exact
> (u32)(kaddr - kern_vm_start) conversion. The nullable callback verifies
> that only a true kernel NULL arrives as NULL. Failure coverage: a
> program with no arena is rejected when it loads. The tests run on x86-64
> and skip elsewhere, as the programs fail verification where the JIT
> lacks arena argument support.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
...
> diff --git a/tools/testing/selftests/bpf/progs/arena_kfunc.c b/tools/testing/selftests/bpf/progs/arena_kfunc.c
> index e7250c5197ab..15d48151797d 100644
> --- a/tools/testing/selftests/bpf/progs/arena_kfunc.c
> +++ b/tools/testing/selftests/bpf/progs/arena_kfunc.c
> @@ -235,16 +235,26 @@ int arena_arg_bad_reg(void *ctx)
> return 0;
> }
>
> +#if defined(__BPF_FEATURE_ADDR_SPACE_CAST) && \
> + defined(__BPF_FEATURE_STACK_ARGUMENT)
> SEC("syscall")
> __arch_x86_64
> __failure __msg("arena pointer cannot be a stack argument")
> int arena_arg_stack(void *ctx)
> {
> -#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
> bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0);
> bpf_kfunc_arena_stack_arg_test(1, 2, 3, 4, 5, (u64 *)1);
> -#endif
> return 0;
> }
> +#else
> +SEC("syscall")
> +__arch_x86_64
> +__description("arena_arg_stack: not supported, dummy test")
> +__success
> +int arena_arg_stack(void *ctx)
> +{
> + return 0;
> +}
> +#endif
Nit: should this be a part of the first selftests patch?
...
next prev parent reply other threads:[~2026-08-05 6:52 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 12:51 [PATCH bpf-next v3 0/9] Add arena argument support to kfuncs and struct_ops Kumar Kartikeya Dwivedi
2026-08-03 12:51 ` [PATCH bpf-next v3 1/9] bpf: Support __arena and __arena_nullable kfunc argument suffixes Kumar Kartikeya Dwivedi
2026-08-03 13:19 ` sashiko-bot
2026-08-04 17:42 ` Amery Hung
2026-08-03 12:51 ` [PATCH bpf-next v3 2/9] bpf: Support __arena and __arena_nullable on struct_ops arguments Kumar Kartikeya Dwivedi
2026-08-03 14:19 ` sashiko-bot
2026-08-04 23:55 ` Eduard Zingerman
2026-08-05 5:14 ` Eduard Zingerman
2026-08-03 12:51 ` [PATCH bpf-next v3 3/9] bpf, x86: JIT __arena kfunc argument rebasing Kumar Kartikeya Dwivedi
2026-08-05 0:40 ` Eduard Zingerman
2026-08-03 12:51 ` [PATCH bpf-next v3 4/9] bpf, x86: Convert struct_ops arena arguments in the trampoline Kumar Kartikeya Dwivedi
2026-08-03 12:51 ` [PATCH bpf-next v3 5/9] selftests/bpf: Add kfunc __arena and __arena_nullable argument tests Kumar Kartikeya Dwivedi
2026-08-03 13:35 ` sashiko-bot
2026-08-04 20:01 ` Eduard Zingerman
2026-08-04 20:14 ` Kumar Kartikeya Dwivedi
2026-08-04 20:24 ` Eduard Zingerman
2026-08-04 20:26 ` Eduard Zingerman
2026-08-04 20:28 ` Kumar Kartikeya Dwivedi
2026-08-04 20:33 ` Eduard Zingerman
2026-08-04 20:36 ` Eduard Zingerman
2026-08-03 12:51 ` [PATCH bpf-next v3 6/9] selftests/bpf: Add JIT-sequence tests for __arena kfunc arguments Kumar Kartikeya Dwivedi
2026-08-03 13:35 ` sashiko-bot
2026-08-05 5:43 ` Eduard Zingerman
2026-08-03 12:51 ` [PATCH bpf-next v3 7/9] selftests/bpf: Add struct_ops __arena and __arena_nullable argument tests Kumar Kartikeya Dwivedi
2026-08-03 13:39 ` sashiko-bot
2026-08-05 6:52 ` Eduard Zingerman [this message]
2026-08-03 12:51 ` [PATCH bpf-next v3 8/9] bpf, x86: Fix stack-passed arguments for indirect trampolines Kumar Kartikeya Dwivedi
2026-08-03 13:42 ` sashiko-bot
2026-08-05 8:00 ` Eduard Zingerman
2026-08-03 12:51 ` [PATCH bpf-next v3 9/9] selftests/bpf: Test stack-passed struct_ops arena arguments Kumar Kartikeya Dwivedi
2026-08-05 8:00 ` Eduard Zingerman
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=fd14689efe162687c9a6dda514815d381b659dad.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=emil@etsalapatis.com \
--cc=kernel-team@meta.com \
--cc=kkd@meta.com \
--cc=memxor@gmail.com \
--cc=tj@kernel.org \
/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