Skip to content

bpf/arena: Add kfunc for reserving arena memory

Emil Tsalapatis bpf 6 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesApplied 2/2
  2. v3 posting 3/32 patches 3 repliesSuperseded
  3. v3 posting 2/32 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v3 posting 1/30 of 2 patches0 repliesSuperseded
v22 patches1 replySuperseded
v12 patches7 repliesSuperseded

Patches in v4 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf/arena: add bpf_arena_reserve_pages kfunckernel/bpf/arena.c+43 -01 replyApplied
2/2selftests/bpf: add selftests for bpf_arena_reserve_pagestools/testing/selftests/bpf/bpf_arena_common.h tools/testing/selftests/bpf/progs/verifier_arena.c tools/testing/selftests/bpf/progs/verifier_arena_large.c+207 -01 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchYonghong SongKumar Kartikeya Dwivedi
1/2A-b A-b
2/2A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

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

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
=========

Quoted 1 line

From v3 ([email protected])

------------------------------------------------------

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

Quoted 1 line

From v2 ([email protected])

------------------------------------------------------

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

Quoted 1 line

From v1 ([email protected])

------------------------------------------------------

- 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).

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(+)
Signature · 1 line
2.49.0