mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "JP Kobryn (CrowdStrike)" <jp.kobryn@linux.dev>
To: Mike Bazov <mikeba@sentinelone.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, martin.kelly@crowdstrike.com,
	andrey.grodzovsky@crowdstrike.com
Subject: Re: [EXT.MSG] Re: [PATCH RFC bpf-next 0/2] bpf: Do not let preemption cause false recursion drops in trampoline progs
Date: Tue, 10 Nov 2026 18:58:18 -0800	[thread overview]
Message-ID: <17511044-f7ab-4c9c-af00-1b30554aa938@linux.dev> (raw)
In-Reply-To: <CAPnbwjqw=uxd8UyhEgNjSrpK1DhbB+dex0mGVW=dwuoygqgRHA@mail.gmail.com>

On 11/10/26 12:43 PM, Mike Bazov wrote:
> On Mon, Nov 9, 2026 at 4:12 PM JP Kobryn wrote:
>> Before moving away from an in-kernel solution, can we consider the
>> direction this patch below takes?
> 
> I haven't proposed moving away from an in-kernel solution. Your patch
> is the same design I proposed earlier in this thread ("This is what I
> have in mind for v2") with Andrii's bpf_ctx suggestion folded in, and
> it's what I've been putting together for v2 (unless someone comes up
> with a better direction), which is nearly ready to
> post, so let's avoid duplicating the work.

Perhaps I could've replied inline to the mention of reusing bpf_ctx. I
read it as assuming the chain was already traversable. After
experimenting with making nesting traversable through the common
bpf_run_ctx, I shared the RFC to help validate that direction.

> 
> beyond trampoline progs, v2 also covers raw_tp, tp_btf, syscall
> tracepoints, and BPF_PROG_TEST_RUN, and disables the per-CPU private
> stack for preemptible tracing progs since two tasks can now run the
> same prog concurrently on one CPU.
> 
> a couple of notes on your patch:
> 
> - Passing prog to bpf_set_run_ctx() churns all callers that don't do
>   recursion checks, and doesn't fit bpf_prog_run_array_sleepable(),
>   which reuses one bpf_run_ctx across all progs in the array. In v2,
>   bpf_set_run_ctx() keeps its signature and initializes prog to NULL,
>   and bpf_prog_enter_recur_ctx() sets it after the walk succeeds.
> - bpf_io_uring_submit_sqes() calls bpf_set_run_ctx(NULL), so
>   dereferencing new_ctx unconditionally will NULL-deref there.
> - Cross-task synchronization isn't needed: a task only ever walks its
>   own current->bpf_ctx chain (and any IRQ/NMI on top of it runs on the
>   same CPU and walks the same chain), so compiler barriers around
>   linking and unlinking the frame are sufficient.

Fair points on 1 & 2. On 3, "cross-task" was originally inaccurate
wording. The intention was cross-context visibility under
interrupts.

> 
> I'll Cc you on v2 once I post it (probably by tomorrow evening UTC).
> testing and review there would be appreciated.

Sounds good.

      reply	other threads:[~2026-11-11  2:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 11:02 Mike Bazov via B4 Relay
2026-10-25 11:02 ` [PATCH RFC bpf-next 1/2] bpf: Keep recursion-checked trampoline programs non-preemptible on !PREEMPT_RT Mike Bazov via B4 Relay
2026-10-25 11:02 ` [PATCH RFC bpf-next 2/2] selftests/bpf: Add trampoline preemption false-recursion test Mike Bazov via B4 Relay
2026-10-30 22:22 ` [PATCH RFC bpf-next 0/2] bpf: Do not let preemption cause false recursion drops in trampoline progs Alexei Starovoitov
2026-11-02 23:24   ` [EXT.MSG] " Mike Bazov
2026-11-03  1:49     ` Alexei Starovoitov
2026-11-03 21:28       ` Mike Bazov
2026-11-04  2:20         ` Alexei Starovoitov
2026-11-05  1:12           ` Martin Kelly
2026-11-05  5:18             ` Alexei Starovoitov
2026-11-05  8:53               ` Peter Zijlstra
2026-11-05 20:16               ` Martin Kelly
2026-11-05 12:26             ` Peter Zijlstra
2026-11-05 20:44               ` Martin Kelly
2026-11-03 23:46   ` JP Kobryn
2026-11-04  2:21     ` Alexei Starovoitov
2026-11-05  0:12       ` [EXT.MSG] " Mike Bazov
2026-11-05  5:14         ` Alexei Starovoitov
2026-11-05 21:10           ` Martin Kelly
2026-11-05 23:35           ` Mike Bazov
2026-11-06 22:08             ` Andrii Nakryiko
2026-11-07 21:32               ` Mike Bazov
2026-11-10  0:12               ` JP Kobryn (CrowdStrike)
2026-11-10 20:43                 ` Mike Bazov
2026-11-11  2:58                   ` JP Kobryn (CrowdStrike) [this message]

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=17511044-f7ab-4c9c-af00-1b30554aa938@linux.dev \
    --to=jp.kobryn@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrey.grodzovsky@crowdstrike.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.kelly@crowdstrike.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=mikeba@sentinelone.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@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

all inboxes | Powered by JetHome®