All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] bpf/arena: Add kfunc for reserving arena memory
@ 2025-07-09  1:57 Emil Tsalapatis
  2025-07-09  1:57 ` [PATCH v3 1/2] bpf/arena: add bpf_arena_reserve_pages kfunc Emil Tsalapatis
  2025-07-09  1:57 ` [PATCH v3 2/2] selftests/bpf: add selftests for bpf_arena_reserve_pages Emil Tsalapatis
  0 siblings, 2 replies; 7+ messages in thread
From: Emil Tsalapatis @ 2025-07-09  1:57 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, andrii, martin.lau, eddyz87, song, memxor,
	yonghong.song, sched-ext, Emil Tsalapatis

(Resending the v3 because the email chain got mangled the first time
around, sorry for the noise)

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 v2 (20250702003351.197234-1-emil@etsalapatis.com)
------------------------------------------------------

- 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@etsalapatis.com)
------------------------------------------------------

- 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@etsalapatis.com>

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          |  95 ++++++++++++++++
 4 files changed, 247 insertions(+)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <20250709014751.96274-1-emil@etsalapatis.com>]

end of thread, other threads:[~2025-07-09 18:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09  1:57 [PATCH v3 0/2] bpf/arena: Add kfunc for reserving arena memory Emil Tsalapatis
2025-07-09  1:57 ` [PATCH v3 1/2] bpf/arena: add bpf_arena_reserve_pages kfunc Emil Tsalapatis
2025-07-09 15:58   ` Yonghong Song
2025-07-09  1:57 ` [PATCH v3 2/2] selftests/bpf: add selftests for bpf_arena_reserve_pages Emil Tsalapatis
2025-07-09 16:09   ` Yonghong Song
2025-07-09 18:47     ` Emil Tsalapatis
     [not found] <20250709014751.96274-1-emil@etsalapatis.com>
2025-07-09  1:53 ` [PATCH v3 1/2] bpf/arena: add bpf_arena_reserve_pages kfunc Emil Tsalapatis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.