From: sashiko-bot@kernel.org
To: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 04/14] selftests/bpf: Test addr_space_cast of pointers that are not in arena
Date: Wed, 04 Nov 2026 01:40:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-196371@kernel.org> (raw)
In-Reply-To: <20261104012401.1354861-5-alexei.starovoitov@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/bpf: wrong stack offset in r10_stored_to_arena()
--
commit 54fbcf6815ff6f19ca4963d449d29e574fbc1941
Author: Alexei Starovoitov <ast@kernel.org>
selftests/bpf: Test addr_space_cast of pointers that are not in arena
This commit adds BPF verifier selftests in verifier_arena_cast.c to test
addr_space_cast behavior on non-arena pointers, numbers, and stack slot
liveness tracking across casts.
> diff --git a/tools/testing/selftests/bpf/progs/verifier_arena_cast.c b/tools/testing/selftests/bpf/progs/verifier_arena_cast.c
> new file mode 100644
> index 0000000000000..14a199318d0d5
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/verifier_arena_cast.c
> @@ -0,0 +1,800 @@
[ ... ]
> +SEC("syscall")
> +__description("arena cast: r10 is stored to arena, a pointer to map value is in the stack")
> +__failure __msg("invalid access to map value, value_size=8 off=4096 size=1")
> +__naked void r10_stored_to_arena(void)
> +{
> + asm volatile (
> + "r1 = %[arena] ll;"
> + UPDATE_AND_LOOKUP
> + "if r0 == 0 goto 2f;"
> + "r9 = r0;"
> + STALE_SPILL_R7(-8)
> + ".8byte %[cast_r7_r7];"
> + "r1 = r9;"
> + "r1 += 8;"
> + "*(u64 *)(r10 - 32) = r1;"
> + /* to arena, not to fp-32 */
> + "*(u64 *)(r7 + 0) = r10;"
> + "r7 = *(u64 *)(r10 - 32);"
[Severity: Medium]
In r10_stored_to_arena() in
tools/testing/selftests/bpf/progs/verifier_arena_cast.c, should
STALE_SPILL_R7(-8) be STALE_SPILL_R7(-32) instead?
As written, STALE_SPILL_R7(-8) gives r7 a stale stack offset of fp-8 rather
than fp-32. When *(u64 *)(r7 + 0) = r10 executes, static stack analysis
tracks the store against slot fp-8 (which is immediately overwritten by
SPILL_FP24_TO_FP8) and never touches slot fp-32, so the test does not
exercise joining the map value pointer in fp-32 (ARG_NONE) with r10 (fp+0).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104012401.1354861-1-alexei.starovoitov@gmail.com?part=4
next prev parent reply other threads:[~2026-11-04 1:40 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 1:23 [PATCH bpf-next v3 00/14] bpf: A stack in arena Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 01/14] libbpf: Make arena 4 Gbyte when max_entries is not set Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 02/14] selftests/bpf: Test the default size of arena Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 03/14] bpf: Treat addr_space_cast of a pointer that is not in arena as a move Alexei Starovoitov
2026-11-04 2:12 ` bot+bpf-ci
2026-11-04 2:32 ` Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 04/14] selftests/bpf: Test addr_space_cast of pointers that are not in arena Alexei Starovoitov
2026-11-04 1:40 ` sashiko-bot [this message]
2026-11-04 1:23 ` [PATCH bpf-next v3 05/14] libbpf: Support .bss.addr_space.1 section Alexei Starovoitov
2026-11-04 1:59 ` bot+bpf-ci
2026-11-04 1:23 ` [PATCH bpf-next v3 06/14] libbpf: Relocate pointers that are stored in arena Alexei Starovoitov
2026-11-04 1:44 ` sashiko-bot
2026-11-04 2:02 ` Alexei Starovoitov
2026-11-04 2:32 ` Roman Gushchin
2026-11-04 2:37 ` Alexei Starovoitov
2026-11-04 1:59 ` bot+bpf-ci
2026-11-04 2:30 ` Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 07/14] selftests/bpf: Test pointers in arena and .bss.addr_space.1 Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 08/14] bpf: Introduce bpf register BPF_REG_ARENA_SP Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 09/14] bpf: Add stacks for programs to arena Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 10/14] bpf, x86: Add BPF_ATOMIC_LOCAL Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 11/14] bpf: Support BPF_REG_ARENA_SP in the verifier Alexei Starovoitov
2026-11-04 2:12 ` bot+bpf-ci
2026-11-04 1:23 ` [PATCH bpf-next v3 12/14] bpf, x86: Support BPF_REG_ARENA_SP Alexei Starovoitov
2026-11-04 1:23 ` [PATCH bpf-next v3 13/14] bpf, arm64: " Alexei Starovoitov
2026-11-04 1:24 ` [PATCH bpf-next v3 14/14] selftests/bpf: Add tests for BPF_REG_ARENA_SP Alexei Starovoitov
2026-11-04 2:12 ` bot+bpf-ci
2026-11-04 2:29 ` Alexei Starovoitov
2026-11-04 3:31 ` [PATCH bpf-next v3 00/14] bpf: A stack in arena Alexei Starovoitov
2026-11-04 7:35 ` Kumar Kartikeya Dwivedi
2026-11-04 18:02 ` Alexei Starovoitov
2026-11-04 20:10 ` patchwork-bot+netdevbpf
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=sashiko-outbox-196371@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.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