From: bot+bpf-ci@kernel.org
To: fadouse@pm.me,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com
Cc: martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,bpf@vger.kernel.org,linux-kernel@vger.kernel.org,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 v3 2/2] selftests/bpf: test arena allocation after a short mmap
Date: Sun, 22 Nov 2026 12:11:43 +0000 (UTC) [thread overview]
Message-ID: <f2ca7638ded85a06d7e9dd498cf248e741e95134694bc1ee9de25ac91782918d@mail.kernel.org> (raw)
In-Reply-To: <20261122-b4-03-bpf-arena-vmalloc-oob-v3-da2dc21683c6-v3-2-1f94ae9a884a@pm.me>
[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]
> selftests/bpf: test arena allocation after a short mmap
TL;DR: Test-only nit: the comment in arena_mmap_alloc.c claiming an
offset-zero allocation can return NULL looks inaccurate, so the first
allocation's result could be checked instead of ignored.
> diff --git a/tools/testing/selftests/bpf/progs/arena_mmap_alloc.c b/tools/testing/selftests/bpf/progs/arena_mmap_alloc.c
> new file mode 100644
> index 000000000000..3854afbebc45
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/arena_mmap_alloc.c
[ ... ]
> +SEC("syscall")
> +int alloc_beyond_vma(void *ctx)
> +{
> + void __arena *page;
> +
> + /* A successful allocation at offset zero can return a NULL pointer. */
> + bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0);
> + page = bpf_arena_alloc_pages(&arena, NULL, 2, NUMA_NO_NODE, 0);
This isn't a bug, but is the comment about offset zero accurate?
arena_alloc_pages() returns the full user address:
addr = clear_lo32(arena->user_vm_start) + uaddr32;
For pgoff 0 this is arena->user_vm_start, which cannot be zero since
arena_map_mmap() sets it from vma->vm_start. The kfunc return is treated
as an unknown scalar by the verifier and the JIT does not truncate it, so
"if (!page)" is a full 64-bit compare.
The offset-0-looks-like-NULL behavior seems to apply to nullable kfunc
arguments (see progs/arena_kfunc.c), not to this return value. Also,
prog_tests/arena_mem_usage.c asserts ASSERT_OK_PTR() on an offset-0
allocation.
Could the first result be checked like the others, for example with
"if (!page) return 4;", so an allocation failure here is distinguishable
from a VMA-bound regression, and the comment dropped or corrected?
> + if (!page)
> + return 1;
[ ... ]
---
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/45018621389
prev parent reply other threads:[~2026-11-22 12:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 11:28 [PATCH bpf v3 0/2] bpf: bound arena allocations to the user VMA YanXin Li via B4 Relay
2026-11-22 11:28 ` [PATCH bpf v3 1/2] " YanXin Li via B4 Relay
2026-11-22 11:28 ` [PATCH bpf v3 2/2] selftests/bpf: test arena allocation after a short mmap YanXin Li via B4 Relay
2026-11-22 12:11 ` bot+bpf-ci [this message]
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=f2ca7638ded85a06d7e9dd498cf248e741e95134694bc1ee9de25ac91782918d@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=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=fadouse@pm.me \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--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®