From: sashiko-bot@kernel.org
To: "Emil Tsalapatis" <emil@etsalapatis.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 5/5] selftests/bpf: Add arena allocation race tests
Date: Wed, 02 Sep 2026 07:14:30 +0000 [thread overview]
Message-ID: <20260902071430.A8C4B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902070239.16968-6-emil@etsalapatis.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The selftest fails to load on ARM64 because `flush_tlb_kernel_range` is a static inline function.
- [Medium] Busy-waiting in an fentry BPF program for a userspace thread guarantees a test timeout on UP non-preemptible kernels.
--
commit 03dd0a4c6fda5e1c4877d7ca2aff23509f39c69f
Author: Emil Tsalapatis <emil@etsalapatis.com>
Subject: selftests/bpf: Add arena allocation race tests
This commit adds selftests to handle concurrent accesses to arena
allocations, including sleepable and non-sleepable page allocation
paths, to ensure no inconsistent or lost data occurs.
> diff --git a/tools/testing/selftests/bpf/prog_tests/arena_race.c b/tools/testing/selftests/bpf/prog_tests/arena_race.c
> index 0000000000000..c3a2a4397315a
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/arena_race.c
[ ... ]
> + /* Force a reallocation during the flush. */
> + run_prog(skel->progs.try_realloc, "realloc_before_flush");
> + ASSERT_NULL(skel->bss->realloc_ptr, "realloc_before_flush");
> +
> +release:
> + skel->bss->release = 1;
[Severity: Medium]
Will this test deterministically timeout or deadlock on uniprocessor systems
when CONFIG_PREEMPT_NONE is set?
The userspace thread needs CPU time to execute this assignment, but the BPF
program may be hogging the only CPU by spinning in wait_for_release().
[ ... ]
> diff --git a/tools/testing/selftests/bpf/progs/arena_race.c b/tools/testing/selftests/bpf/progs/arena_race.c
> index 0000000000000..df5b54ef5b4c0
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/arena_race.c
[ ... ]
> +static __always_inline void wait_for_release(void)
> +{
> + while (!*(volatile int *)&release && can_loop)
> + ;
[Severity: Medium]
Could this tight loop starve the CPU if preemption is disabled during the
fentry program?
On uniprocessor non-preemptible kernels, the userspace thread cannot be
scheduled to set the release variable while the BPF program runs. The loop
terminates only when can_loop runs out, which sets timed_out = 1 and causes
the test to fail.
> + if (!*(volatile int *)&release)
> + timed_out = 1;
> +}
[ ... ]
> +SEC("fentry/flush_tlb_kernel_range")
> +int BPF_PROG(trace_flush, unsigned long start, unsigned long end)
[Severity: Medium]
Does this fentry program fail to load on ARM64?
On ARM64, flush_tlb_kernel_range is defined as a static inline function in
<asm/tlbflush.h>. Because inline functions do not generate BTF IDs in
vmlinux, libbpf will fail to resolve the attach target during
arena_race__load(skel), which breaks the selftest CI on ARM64.
> +{
> + if (!pause_on_flush ||
> + (__u32)bpf_get_current_pid_tgid() != target_tid)
> + return 0;
> + flush_entered = 1;
> + wait_for_release();
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902070239.16968-1-emil@etsalapatis.com?part=5
next prev parent reply other threads:[~2026-09-02 7:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 7:02 [PATCH bpf-next 0/5] bpf: Fix arena memory incoherence Emil Tsalapatis
2026-09-02 7:02 ` [PATCH bpf-next 1/5] bpf: Update is_range_tree_set to work for consecutive ranges Emil Tsalapatis
2026-09-02 8:01 ` bot+bpf-ci
2026-09-02 7:02 ` [PATCH bpf-next 2/5] bpf: Track availability information for ranges in range tree Emil Tsalapatis
2026-09-02 8:20 ` bot+bpf-ci
2026-09-02 7:02 ` [PATCH bpf-next 3/5] bpf: Fix arena race between page free and alloc leading to incoherency Emil Tsalapatis
2026-09-02 8:20 ` bot+bpf-ci
2026-09-07 11:41 ` Puranjay Mohan
2026-09-02 7:02 ` [PATCH bpf-next 4/5] bpf: Atomically update PTE and range tree in arena VM fault handler Emil Tsalapatis
2026-09-02 7:19 ` sashiko-bot
2026-09-07 11:45 ` Puranjay Mohan
2026-09-02 7:02 ` [PATCH bpf-next 5/5] selftests/bpf: Add arena allocation race tests Emil Tsalapatis
2026-09-02 7:14 ` sashiko-bot [this message]
2026-09-02 8:20 ` bot+bpf-ci
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=20260902071430.A8C4B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=emil@etsalapatis.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.