From: Emil Tsalapatis <emil@etsalapatis.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, eddyz87@gmail.com,
memxor@gmail.com, daniel@iogearbox.net,
Emil Tsalapatis <emil@etsalapatis.com>, Tejun Heo <tj@kernel.org>
Subject: [PATCH bpf-next 0/2] bpf: expand BPF arena kernel fault handling
Date: Wed, 28 Oct 2026 01:51:39 +0000 [thread overview]
Message-ID: <20261028015141.10710-1-emil@etsalapatis.com> (raw)
Currently, the BPF arena fault handler protects against
a misbehaving BPF program passing an arena pointer to a
kfunc then unmapping the backing pages, causing a kernel
fault. However, it does not handle errors where the now
unmapped arena address is instead accessed by a non-BPF
path, or by a BPF program that has a different arena.
The former case is already possible in sched-ext if a
BPF program removes from the arena pages allocated
from the genpool allocator.
Keep a list of all arenas in the system and attempt to match
the kernel fault to all of them. If the fault does fall in
an arena, handle it with the already established scratch
page technique and retry the access.
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
Emil Tsalapatis (2):
bpf: recover page faults across all arenas
selftests/bpf: add arena fault recovery tests
kernel/bpf/arena.c | 54 +++++++----
tools/testing/selftests/bpf/Makefile | 2 +-
.../selftests/bpf/prog_tests/arena_fault.c | 91 +++++++++++++++++++
.../testing/selftests/bpf/progs/arena_fault.c | 55 +++++++++++
.../selftests/bpf/progs/arena_fault_noarena.c | 17 ++++
.../testing/selftests/bpf/test_kmods/Makefile | 2 +-
.../bpf/test_kmods/bpf_test_arena_fault.c | 55 +++++++++++
.../bpf/test_kmods/bpf_test_arena_fault.h | 10 ++
8 files changed, 265 insertions(+), 21 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/arena_fault.c
create mode 100644 tools/testing/selftests/bpf/progs/arena_fault.c
create mode 100644 tools/testing/selftests/bpf/progs/arena_fault_noarena.c
create mode 100644 tools/testing/selftests/bpf/test_kmods/bpf_test_arena_fault.c
create mode 100644 tools/testing/selftests/bpf/test_kmods/bpf_test_arena_fault.h
--
2.54.0
next reply other threads:[~2026-10-28 1:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 1:51 Emil Tsalapatis [this message]
2026-10-28 1:51 ` [PATCH bpf 1/2] bpf: recover page faults across all arenas Emil Tsalapatis
2026-10-28 2:36 ` bot+bpf-ci
2026-10-28 1:51 ` [PATCH bpf 2/2] selftests/bpf: add arena fault recovery tests Emil Tsalapatis
2026-10-28 2:13 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028015141.10710-1-emil@etsalapatis.com \
--to=emil@etsalapatis.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=memxor@gmail.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.