All of lore.kernel.org
 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 v3 1/4] bpf: Avoid per-CPU private stack in preemptible tracing progs
Date: Tue, 17 Nov 2026 11:44:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-218720@kernel.org> (raw)
In-Reply-To: <20261117-bpf-preempt-v2-r2-v3-1-586376ec3672@sentinelone.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: missing Fixes trailer for commit a76ab5731e32 in commit
  message
--

commit 3dec129be9ecaaef86d1be659b28f0d6ce4d6395
Author: Mike Bazov <mikeba@sentinelone.com>

> bpf: Avoid per-CPU private stack in preemptible tracing progs
>
> A per-CPU private stack is only safe if a program never runs in two
> tasks at once on one CPU. Commit a76ab5731e32 ("bpf: Find eligible
> subprogs for private stack support") gave one to tracing, raw_tp and
> tracepoint programs, but they run preemptibly, and two tasks can
> already be inside one of them on a CPU:
>
> - Two raw_tp dispatchers that tail-call the same handler each pass
>   their own per-CPU recursion check, so both tasks run the handler.
> - A tracepoint program attached to a syscall tracepoint and to a
>   regular tracepoint can be entered by a second task through the
>   regular one, which only checks bpf_prog_active.
>
> The second task then overwrites the preempted task's stack. Neither
> case can be seen when the program is loaded, so never give these
> program types a private stack. The next patches make such overlap the
> normal case.
>
> check_recursion() told tracing programs apart by whether they can get a
> private stack. Make it check the program type instead, so that
> recursive subprograms stay rejected in these program types.
>
> Move the selftests that relied on these program types having a private
> stack to kprobe.multi and perf_event programs.
>
> Trade-offs:
>
> - These programs use the kernel stack again.
> - A program with two 2000-byte frames no longer loads: "combined stack
>   size of 2 calls is 4000. Too large".
> - Unwinding on a private stack is no longer tested at run time: raw_tp
>   was the only such program type that BPF_PROG_TEST_RUN runs.
>
> Signed-off-by: Mike Bazov <mikeba@sentinelone.com>

[Severity: Low]
Since this fixes per-CPU private stack corruption in existing tracing,
raw_tp and tracepoint programs, should it include a Fixes: tag?

  Fixes: a76ab5731e32 ("bpf: Find eligible subprogs for private stack support")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-bpf-preempt-v2-r2-v3-0-586376ec3672@sentinelone.com?part=1

  reply	other threads:[~2026-11-17 11:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 11:29 [PATCH bpf-next v3 0/4] bpf: Check recursion per task for preemptible programs Mike Bazov via B4 Relay
2026-11-17 11:29 ` Mike Bazov
2026-11-17 11:29 ` [PATCH bpf-next v3 1/4] bpf: Avoid per-CPU private stack in preemptible tracing progs Mike Bazov via B4 Relay
2026-11-17 11:29   ` Mike Bazov
2026-11-17 11:44   ` sashiko-bot [this message]
2026-11-17 11:29 ` [PATCH bpf-next v3 2/4] bpf: Mark programs whose runs must not overlap on a CPU Mike Bazov via B4 Relay
2026-11-17 11:29   ` Mike Bazov
2026-11-17 11:29 ` [PATCH bpf-next v3 3/4] bpf: Check program recursion per task via bpf_ctx Mike Bazov via B4 Relay
2026-11-17 11:29   ` Mike Bazov
2026-11-17 12:20   ` bot+bpf-ci
2026-11-17 11:29 ` [PATCH bpf-next v3 4/4] selftests/bpf: Add preemption recursion test for tracing programs Mike Bazov via B4 Relay
2026-11-17 11:29   ` Mike Bazov

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-218720@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 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.