[PATCH bpf v4 0/2] bpf: bound arena allocations to the user VMA
From: YanXin Li via B4 Relay
Date: Sun Nov 22 2026 - 07:36:24 EST
When map_extra is omitted, a short first mmap() can leave free arena
pages beyond the user VMA. Automatic allocation can select those pages;
near a 4 GiB boundary, the kernel mapping can extend past the arena's
vmalloc reservation. Patch 1 confines the range tree to the VMA, and
patch 2 adds a regression selftest.
---
Changes in v4:
- Check the first allocation in the selftest and remove the incorrect
offset-zero NULL comment. Patch 1 is unchanged.
- Link to v3: https://lore.kernel.org/r/20261122-b4-03-bpf-arena-vmalloc-oob-v3-da2dc21683c6-v3-0-1f94ae9a884a@xxxxx
To: Alexei Starovoitov <ast@xxxxxxxxxx>
To: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
To: Andrii Nakryiko <andrii@xxxxxxxxxx>
To: Eduard Zingerman <eddyz87@xxxxxxxxx>
To: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
Cc: Martin KaFai Lau <martin.lau@xxxxxxxxx>
Cc: Song Liu <song@xxxxxxxxxx>
Cc: Yonghong Song <yonghong.song@xxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Emil Tsalapatis <emil@xxxxxxxxxxxxxxx>
Cc: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
Cc: bpf@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
YanXin Li (2):
bpf: bound arena allocations to the user VMA
selftests/bpf: test arena allocation after a short mmap
kernel/bpf/arena.c | 25 ++++++++++
.../testing/selftests/bpf/prog_tests/arena_mmap.c | 53 ++++++++++++++++++++++
.../testing/selftests/bpf/progs/arena_mmap_alloc.c | 33 ++++++++++++++
3 files changed, 111 insertions(+)
---
base-commit: c44104f3642da720164042623e4832836aefdd8e
change-id: 20261122-b4-03-bpf-arena-vmalloc-oob-v4-8090cdc58ff8-f2eb9eff6db8
Best regards,
--
YanXin Li <fadouse@xxxxx>