Re: [PATCH bpf-next v3 6/9] selftests/bpf: Add JIT-sequence tests for __arena kfunc arguments
Eduard Zingerman <[email protected]> Tue, 04 Aug 2026 22:43:01 -0700
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2026-08-03 at 14:51 +0200, Kumar Kartikeya Dwivedi wrote:
...
> diff --git a/tools/testing/selftests/bpf/prog_tests/arena_kfunc_jit.c b/tools/testing/selftests/bpf/prog_tests/arena_kfunc_jit.c
> new file mode 100644
> index 000000000000..2359cde24c45
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/arena_kfunc_jit.c
> @@ -0,0 +1,13 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
> +#include <test_progs.h>
> +#include "arena_kfunc_jit.skel.h"
> +
> +/*
> + * Runs with full capabilities: resolving module kfunc ksyms requires
> + * CAP_SYS_ADMIN, which rules out the capability-restricted runner.
> + */
> +void test_arena_kfunc_jit(void)
> +{
> + RUN_TESTS(arena_kfunc_jit);
> +}
Nit: please avoid adding this file, and instead put this
function under prog_tests/verifier.c.
There are multiple tests there that invoke RUN_TESTS
instead of RUN for same exact reason.
Same applies to the previous patch.
> diff --git a/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c b/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
...
> +SEC("syscall")
> +__arch_x86_64
> +__jited("...")
> +__jited(" movl %edi, %edi")
> +__jited(" testl %edi, %edi")
> +__jited(" je {{.*}}")
> +__jited(" addq %r12, %rdi")
> +__success
Note that __jited output generates labels like this:
50: 89 ff movl %edi, %edi
52: 85 ff testl %edi, %edi
54: 74 03 je L0
56: 4c 01 e7 addq %r12, %rdi
59: e8 42 5f 40 00 L0: callq 0x405fa0
I think it would make sense to match L0 in this test.
> +int arena_arg_jit_nullable(void *ctx)
> +{
> + stash = (u64)bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0);
> + bpf_kfunc_arena_cap_nullable_test((u64 *)stash);
> + return 0;
> +}
...