[PATCH v4 0/2] bpf/arena: Add kfunc for reserving arena memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new kfunc for BPF arenas that reserves a region of the mapping
to prevent it from being mapped. These regions serve as guards against
out-of-bounds accesses and are useful for debugging arena-related code.

CHANGELOG
=========

>From v3 (20250709015712.97099-1-emil@xxxxxxxxxxxxxxx)
------------------------------------------------------

- Added Acked-by tags by Yonghong.
- Replace hardcoded error numbers in selftests (Yonghong).
- Fixed selftest for partially freeing a reserved region (Yonghong).

>From v2 (20250702003351.197234-1-emil@xxxxxxxxxxxxxxx)
------------------------------------------------------

- Removed -EALREADY and replaced with -EINVAL to bring error handling in
  line with the rest of the BPF code (Alexei).

>From v1 (20250620031118.245601-1-emil@xxxxxxxxxxxxxxx)
------------------------------------------------------

- Removed the additional guard range tree. Adjusted tests accordingly. 
  Reserved regions now behave like allocated regions, and can be 
  unreserved using bpf_arena_free_pages(). They can also be allocated 
  from userspace through minor faults. It is up to the user to prevent 
  erroneous frees and/or use the BPF_F_SEGV_ON_FAULT flag to catch 
  stray userspace accesses (Alexei).
- Changed terminology from guard pages to reserved pages (Alexei,
  Kartikeya).

Signed-off-by: Emil Tsalapatis <emil@xxxxxxxxxxxxxxx>

Emil Tsalapatis (2):
  bpf/arena: add bpf_arena_reserve_pages kfunc
  selftests/bpf: add selftests for bpf_arena_reserve_pages

 kernel/bpf/arena.c                            |  43 +++++++
 .../testing/selftests/bpf/bpf_arena_common.h  |   3 +
 .../selftests/bpf/progs/verifier_arena.c      | 106 ++++++++++++++++++
 .../bpf/progs/verifier_arena_large.c          |  98 ++++++++++++++++
 4 files changed, 250 insertions(+)

-- 
2.49.0





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux