Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mike Bazov" <mikeba@sentinelone.com>, bpf@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/5] bpf: Avoid per-CPU private stack in preemptible tracing progs
Date: Wed, 11 Nov 2026 20:10:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-209613@kernel.org> (raw)
In-Reply-To: <20261111-bpf-preempt-v2-r2-v2-1-9d8f6b952ad2@sentinelone.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: raw_tp tests in verifier_private_stack no longer
  test priv stack
--

commit 173ae153d8d266fe351d0833f08f2920b88ec9ce
Author: Mike Bazov <mikeba@sentinelone.com>

bpf: Avoid per-CPU private stack in preemptible tracing progs

This commit disables per-CPU private stacks for tracing, raw_tp, and
tracepoint programs because they run preemptibly and can be entered by a
second task on the same CPU, and updates check_recursion() and the BPF
selftests accordingly.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_private_stack.c b/tools/testing/selftests/bpf/progs/verifier_private_stack.c
> index e7f410a74a21b..bebdb0aff23fd 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_private_stack.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_private_stack.c
> @@ -127,6 +127,23 @@ __naked void no_private_stack_kprobe(void)
>  "	::: __clobber_all);
>  }
>  
> +SEC("fentry/bpf_fentry_test9")
> +__description("No private stack, fentry")
> +__success
> +__arch_x86_64
> +__jited("	subq	$0x100, %rsp")
> +__arch_arm64
> +__jited("	sub	sp, sp, #0x100")
> +__naked void no_private_stack_fentry(void)
> +{
> +	asm volatile ("			\
> +	r1 = 42;			\
> +	*(u64 *)(r10 - 256) = r1;	\
> +	r0 = 0;				\
> +	exit;				\
> +"	::: __clobber_all);
> +}
> +
>  SEC("uprobe")
>  __description("No private stack, uprobe")
>  __success

[Severity: Low]
Should no_private_stack_nested() and no_private_stack_stack_args() above
this hunk also be switched from SEC("raw_tp") to a program type that is
still eligible for a private stack, such as SEC("kprobe.multi") or
SEC("perf_event")?

With raw_tp returning NO_PRIV_STACK from bpf_enable_priv_stack(),
check_max_stack_depth() now skips both tests on priv_stack_mode !=
PRIV_STACK_ADAPTIVE before reaching the 64-byte BPF_PRIV_STACK_MIN_SIZE
threshold or the x86-64 si[s].stack_arg_cnt check they were written to
cover:

tools/testing/selftests/bpf/progs/verifier_private_stack.c:
    SEC("raw_tp")
    __description("No private stack")
    ...
    __naked void no_private_stack_nested(void)
    ...
    /* x86-64 has one register for the private stack and for the sixth argument */
    SEC("raw_tp")
    __description("No private stack, stack arguments")
    ...
    __naked void no_private_stack_stack_args(void)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111-bpf-preempt-v2-r2-v2-0-9d8f6b952ad2@sentinelone.com?part=1

  reply	other threads:[~2026-11-11 20:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 19:39 [PATCH bpf-next v2 0/5] bpf: Check recursion per task for preemptible programs Mike Bazov via B4 Relay
2026-11-11 19:39 ` [PATCH bpf-next v2 1/5] bpf: Avoid per-CPU private stack in preemptible tracing progs Mike Bazov via B4 Relay
2026-11-11 20:10   ` sashiko-bot [this message]
2026-11-11 21:07   ` bot+bpf-ci
2026-11-11 19:39 ` [PATCH bpf-next v2 2/5] bpf: Check program recursion per task via bpf_ctx Mike Bazov via B4 Relay
2026-11-11 19:39 ` [PATCH bpf-next v2 3/5] bpf: Check recursion per task for programs on syscall tracepoints Mike Bazov via B4 Relay
2026-11-11 19:39 ` [PATCH bpf-next v2 4/5] selftests/bpf: Add trampoline and raw_tp preemption recursion test Mike Bazov via B4 Relay
2026-11-11 20:08   ` sashiko-bot
2026-11-11 19:39 ` [PATCH bpf-next v2 5/5] selftests/bpf: Test syscall tracepoint programs under preemption Mike Bazov via B4 Relay

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=sashiko-outbox-209613@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mikeba@sentinelone.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox