From: sashiko-bot@kernel.org
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 3/4] selftests/bpf: Keep verifier_map_ptr exercising ops pointer access
Date: Tue, 02 Jun 2026 14:15:22 +0000 [thread overview]
Message-ID: <20260602141523.2D63C1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602133052.423725-4-daniel@iogearbox.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Test suite regression on 32-bit architectures due to hardcoded 64-bit struct offsets.
--
commit 3edf5d52e70729a68d2f02df9f51787362f009a3
Author: Daniel Borkmann <daniel@iogearbox.net>
selftests/bpf: Keep verifier_map_ptr exercising ops pointer access
This commit recovers the old test for verifier_map_ptr with the right
offsets to exercise ops pointer access. It also adds the existing test
as an additional test case.
> diff --git a/tools/testing/selftests/bpf/progs/verifier_map_ptr.c b/tools/testing/selftests/bpf/progs/verifier_map_ptr.c
> index d8e822d1a8bab..1661936598703 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_map_ptr.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_map_ptr.c
[ ... ]
> @@ -72,17 +72,43 @@ __naked void bpf_map_ptr_write_rejected(void)
[ ... ]
> __description("bpf_map_ptr: read non-existent field rejected")
> __failure
> -__msg("access beyond the end of member excl (mend:36) in struct bpf_map with off 33 size 4")
> +__msg("cannot access ptr member ops with moff 40 in struct bpf_map with off 41 size 4")
> __failure_unpriv
> __msg_unpriv("access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN")
> __flag(BPF_F_ANY_ALIGNMENT)
> __naked void read_non_existent_field_rejected(void)
> +{
> + asm volatile (" \
> + r6 = 0; \
> + r1 = %[map_array_48b] ll; \
> + r6 = *(u32*)(r1 + 41); \
[Severity: Medium]
Does this hardcoded offset in read_non_existent_field_rejected() cause test
failures on 32-bit architectures?
Since pointers are 4 bytes long on 32-bit, the excl field at offset 32
would be followed by ops at offset 36. Offset 41 would point inside
inner_map_meta instead, causing the verifier error message to mismatch
the expected __msg above.
[ ... ]
> @@ -105,7 +131,7 @@ __naked void ptr_read_ops_field_accepted(void)
> asm volatile (" \
> r6 = 0; \
> r1 = %[map_array_48b] ll; \
> - r6 = *(u64*)(r1 + 0); \
> + r6 = *(u64*)(r1 + 40); \
[Severity: Medium]
Will reading 8 bytes at offset 40 in ptr_read_ops_field_accepted() fail on
32-bit architectures?
On 32-bit, offset 40 corresponds to inner_map_meta which is only 4 bytes.
The verifier requires an exact size match for pointer reads, so a size 8
read would trigger a rejection instead of the expected success.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602133052.423725-1-daniel@iogearbox.net?part=3
next prev parent reply other threads:[~2026-06-02 14:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 13:30 [PATCH bpf-next 0/4] More gen_loader fixes #2 Daniel Borkmann
2026-06-02 13:30 ` [PATCH bpf-next 1/4] bpf: Reject exclusive maps for bpf_map_elem iterators Daniel Borkmann
2026-06-02 13:49 ` sashiko-bot
2026-06-02 15:38 ` Daniel Borkmann
2026-06-02 13:30 ` [PATCH bpf-next 2/4] libbpf: Guard add_data() against size overflow Daniel Borkmann
2026-06-02 13:30 ` [PATCH bpf-next 3/4] selftests/bpf: Keep verifier_map_ptr exercising ops pointer access Daniel Borkmann
2026-06-02 14:15 ` sashiko-bot [this message]
2026-06-02 13:30 ` [PATCH bpf-next 4/4] selftests/bpf: Test that exclusive maps are rejected as iter targets Daniel Borkmann
2026-06-02 16:50 ` [PATCH bpf-next 0/4] More gen_loader fixes #2 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=20260602141523.2D63C1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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 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.