[PATCH bpf v3 0/2] bpf: bound arena allocations to the user VMA

YanXin Li via B4 Relay posted 2 patches 23 hours ago
There is a newer version of this series
kernel/bpf/arena.c                                 | 25 ++++++++++
.../testing/selftests/bpf/prog_tests/arena_mmap.c  | 53 ++++++++++++++++++++++
.../testing/selftests/bpf/progs/arena_mmap_alloc.c | 32 +++++++++++++
3 files changed, 110 insertions(+)
[PATCH bpf v3 0/2] bpf: bound arena allocations to the user VMA
Posted by YanXin Li via B4 Relay 23 hours ago
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 v3:
- Correct the 288-page boundary calculation and describe the vmalloc guard.
- Distinguish out-of-VMA allocations from 32-bit wrap and limit claims to
  what the local test establishes.
- Remove the unreachable arena_adjust_tree() bound check.
- Point Fixes at the range-tree conversion and identify the test commit.
- Split the regression selftest into patch 2/2 and skip it when arena
  program loading returns -EOPNOTSUPP with JIT disabled.
- Link to v2: https://lore.kernel.org/r/20261122-b4-03-bpf-arena-vmalloc-oob-v2-5f6209c1a20e-v2-1-b2a9906e9676@pm.me

---
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 | 32 +++++++++++++
 3 files changed, 110 insertions(+)
---
base-commit: c44104f3642da720164042623e4832836aefdd8e
change-id: 20261122-b4-03-bpf-arena-vmalloc-oob-v3-da2dc21683c6-16baca6b3f21

Best regards,
--  
YanXin Li <fadouse@pm.me>