From: bot+bpf-ci@kernel.org
To: vineet.gupta@linux.dev,bpf@vger.kernel.org
Cc: ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,john.fastabend@gmail.com,shuah@kernel.org,linux-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,jose.marchesi@oracle.com,david.faust@oss.qualcomm.com,vineet.gupta@linux.dev,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 7/8] selftests/bpf: write the mixed arena/scalar ALU tests in asm
Date: Wed, 28 Oct 2026 21:22:36 +0000 (UTC) [thread overview]
Message-ID: <e08eb87415801027d75170c930dc709beaea5f20f4afc92ff0affd434faaa9a0@mail.kernel.org> (raw)
In-Reply-To: <20261028204158.1021284-8-vineet.gupta@linux.dev>
[-- Attachment #1: Type: text/plain, Size: 2998 bytes --]
> selftests/bpf: write the mixed arena/scalar ALU tests in asm
TL;DR: Test comment only: the new verifier_arena.c comment claiming the r9
arena load is needed for addr_space_cast looks stale, since libbpf now binds
the arena via fd_array. Suggest dropping or rewording it.
> diff --git a/tools/testing/selftests/bpf/progs/verifier_arena.c b/tools/testing/selftests/bpf/progs/verifier_arena.c
> index 21b66d51c61e..b84d8f1e0b39 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_arena.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_arena.c
> @@ -539,53 +539,58 @@ int arena_ptr_add_arena_ptr(void *ctx)
> return 0;
> }
>
> +/*
> + * The r9 load is never read; it is there so libbpf records the arena map
> + * as used, which is what lets the verifier accept addr_space_cast at all.
> + */
> SEC("syscall")
> __failure __msg("same insn cannot be used with and without arena pointer")
Is this comment still accurate? Commit cd7a395838cb ("libbpf: Bind the arena
of an object to every program in it") is already in the base of this series.
With it, bpf_object_load_prog() calls bpf_object__bind_arena(), which puts
the object's arena into a continuous fd_array when the kernel supports
fd_array_cnt:
obj->fd_array[0] = map->fd;
load_attr->fd_array = obj->fd_array;
load_attr->fd_array_cnt = obj->fd_array_used;
The kernel binds that array before it looks at any insn:
process_fd_array_continuous()
add_fd_from_fd_array()
__add_used_map()
check_map_prog_compatibility()
env->prog->aux->arena = (void *)map;
This happens for every program in verifier_arena.o, including these two,
whether or not an insn refers to the map. The addr_space_cast check in
check_alu_op() (if (!env->prog->aux->arena)) and the prevent_zext/needs_zext
logic in adjust_reg_min_max_vals() only look at prog->aux->arena, so
removing the r9 load would not change what either test does with a kernel and
libbpf from this tree.
The comment also describes the mechanism differently from what happens.
libbpf only relocates the ld_imm64 to the map fd, and the verifier records
the map as used in add_used_map() during resolve_pseudo_ldimm64().
The log of the libbpf commit describes referring to the arena artificially,
as in asm volatile("" :: "r"(&arena)), as something that change makes
unnecessary. The r9 load would only matter on a kernel that rejects
fd_array_cnt, or with the light skeleton loader, which test_loader does not
use.
The same four comment lines are repeated word for word above
mixed_arena_scalar_alu64_arena_first(). Could the comment be dropped
together with the r9 load, or be reworded to say the load is a fallback for
kernels where libbpf cannot bind the arena through fd_array_cnt?
---
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/40768193895
next prev parent reply other threads:[~2026-10-28 21:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 20:41 [PATCH bpf-next v2 0/8] selftests/bpf: cleanup bpf-gcc runs Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 1/8] selftests/bpf: Build callx tests with GCC that defines __BPF_FEATURE_CALLX Vineet Gupta
2026-10-28 21:22 ` bot+bpf-ci
2026-10-28 22:28 ` Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 2/8] selftests/bpf: don't pass clang-only warning flags to GCC Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 3/8] selftests/bpf: report SKIP for arena tests a compiler cannot build Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 4/8] selftests/bpf: make arena_base() opaque to GCC's -Warray-bounds Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 5/8] selftests/bpf: don't report arena tests as passing with an empty body Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 6/8] selftests/bpf: cast explicitly in the arena subprog and callback faults Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 7/8] selftests/bpf: write the mixed arena/scalar ALU tests in asm Vineet Gupta
2026-10-28 21:22 ` bot+bpf-ci [this message]
2026-10-28 23:14 ` Vineet Gupta
2026-10-28 20:41 ` [PATCH bpf-next v2 8/8] selftests/bpf: skip the struct_ops arena tests without compiler support Vineet Gupta
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=e08eb87415801027d75170c930dc709beaea5f20f4afc92ff0affd434faaa9a0@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=david.faust@oss.qualcomm.com \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jose.marchesi@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=vineet.gupta@linux.dev \
--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
all inboxes | Powered by JetHome®