From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.20 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794365908; b=pU7qKaB35KkkmaarsNZSQP2ly/bF0U9QssDYTdxcST0dw+GtrMoy9WoBvJ5HHGECW9E0 T5inQhkBp2p75fzcuqSuAXDejL8cZY688JApcCIM1IHECYDcWPRS8Myrb1Arw0JLbrUrL ARlLi2dHqS1AewCQoZqGKfSHQ5fsgzMqUbpBq0FwMtDsVowazquirSuQMpW+HcPMglBdz wILsaLP1moT4hYHsuNZpj3GxBqI9s/Dn+4vFNleGTohbyy3KANKnjjmDEF7UKn46GN3xE o/N7M1EmgfB6P22JPAIx3MwrzLSpm885YtgY/5ptCYxfgcZ6ZPq08pyKW8OjEIM6Jxw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794365908; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=PeWu9qbTDaD6AUYNBe1UHdE6fcYEbMgUzjHngGTPIKc=; b=N+x9FOxsdwoYQ8v0T2U8eqjizkHpWNRZVUB4e8IM9O9KYjchE7s/+arF8Qss5JaSyQ/r A5rTDbzeJHM1cIDF/dUu960c2naTaAUDcDQmsqLCzmVMcQuvMW2Vowh9/931fUZm4RGbl moU31BajXVbMsFh4tQJs6lXu1jp4kEpma+MuLFiRsK2uc5elUxk2KB6+KwMz0pL/u/6kY DCNmSu6eTZbJ547rtfVw62ivFYpnvehjOEGBJdOTIOGzZn9LXb7mnZH7RfhKXjfrsZbAg 3rSK4UsP2a91qiSjJd4CBPnstPx/IRon3e7LbJ9oKsjRadyxxdLe6/iW0sUCNKq5oqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=FroNPVa7; arc=none smtp.remote-ip=95.215.58.20 Received: from mta1.migadu.com (out-20.mta1.migadu.com [95.215.58.20]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C58AC606A326 for ; Wed, 11 Nov 2026 02:58:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C58AC606A326 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=FroNPVa7 X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=2xQ14q8i4wn8y+T/i0DeDAU8TKCKRdi8NWCJr0SA9QA=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794365906; v=1; x=1794970706; b=FroNPVa72ltkC4UhYxIu2q2vaBk+6RKYJ0MS8MPDCHXqZ347RW/6y8O3OfR9QwSJU36Akmw6 WIpQhClSlADqABQh3mmHfbXlfw67LfOa0cdnH+4COBPY3H1VB/9+jUFtemzVR/X+Wkf1QHF9m46 TEGFnHCScFtpPgFLGhc4zYNY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id cadda0c8b6efabd5; Wed, 11 Nov 2026 02:58:25 +0000 X-Mizu-Trace-ID: cadda0c8b6efabd5 X-Migadu-Flow: FLOW_OUT Message-ID: <17511044-f7ab-4c9c-af00-1b30554aa938@linux.dev> Date: Tue, 10 Nov 2026 18:58:18 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [EXT.MSG] Re: [PATCH RFC bpf-next 0/2] bpf: Do not let preemption cause false recursion drops in trampoline progs To: Mike Bazov Cc: Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , John Fastabend , Shuah Khan , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, martin.kelly@crowdstrike.com, andrey.grodzovsky@crowdstrike.com References: <20261025-b4-bpf-trampoline-preempt-v1-0-198dcdc0c6ac@sentinelone.com> <95e07cae-85ee-4f14-b5f3-070803ee567e@linux.dev> Content-Language: en-US From: "JP Kobryn (CrowdStrike)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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.