From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-167.mta0.migadu.com [91.218.175.167]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 615184BFE93 for ; Tue, 15 Sep 2026 18:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.167 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789497594; cv=none; b=jYKKzqNCLRl6DxoJRJXJWzeH9V/jocGz0IOqJioTaAF3PFLmPxukOBMQlG929KtKFb6lqiNIw0iMRyNYT8me0ZcwCnhgi//ivkiHWwhnhO4rHEYn/Ohm152+ElN5h388jth71Wclo9cFWDBe+lmVpRjb9ohgUh7AbAcdbLluv9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789497594; c=relaxed/simple; bh=r7pT69vfL8KLaY3d/Q2bjsDbJ9zI0lbKl6VgdFFxXrI=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=Szr9tU9CCdwsQ8zgbvXzyen8WombbuM4as4EvXeoF2SCi0QvhxozS/9dFdhIOtXPLNguW4MxNkOXGkPWFS7dfcsD0b5qNgli1f1RFbOLNbrUcPJ00/qOD3/ojI3ipm/qBzm3jzAFptYTqREIIemyytVlbICwVsujVoRVzFpAZNM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=f7oEgX7M; arc=none smtp.client-ip=91.218.175.167 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) header.d=linux.dev header.i=@linux.dev header.b="f7oEgX7M" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=r7pT69vfL8KLaY3d/Q2bjsDbJ9zI0lbKl6VgdFFxXrI=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789497589; v=1; x=1790102389; b=f7oEgX7MXk+DeSMq9wevk5JkhQa0iHRF4pSVPMyTqi3Fr7FFDXD5fG0vsRwB4uoY7e13SZmK zeUNhwKyCEceeLanKDsV/R1vRbKJfDLw729LS0aXQq9Now8ge6XfnRwelX8rr1yaffFyW0WD1RF llrV5LeICH3ri8QR+BlgniLY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 429d9ecf31e9208d; Tue, 15 Sep 2026 18:39:39 +0000 X-Mizu-Trace-ID: 429d9ecf31e9208d X-Migadu-Flow: FLOW_OUT Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 15 Sep 2026 18:39:30 +0000 Message-Id: From: "Florent Revest" To: "Alexei Starovoitov" , , "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" Cc: "Martin KaFai Lau" , "Eduard Zingerman" , "Kumar Kartikeya Dwivedi" , "Song Liu" , "Yonghong Song" , "Jiri Olsa" , "KP Singh" , "John Fastabend" , "Leon Hwang" , "Junseo Lim" , "Sechang Lim" , "Puranjay Mohan" , "Xu Kuohai" , "Ilya Leoshkevich" , "Hari Bathini" , "Christophe Leroy" , "Naveen N Rao" , =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , "Pu Lehui" , "Tiezhu Yang" , "Hengqi Chen" , Subject: Re: [PATCH bpf v2 1/2] bpf: Skip detached progs in trampoline images that are still in use X-Mailer: aerc 0.17.0 References: <20260912095924.866254-1-florent.revest@linux.dev> <20260912095924.866254-2-florent.revest@linux.dev> In-Reply-To: On Sat Sep 12, 2026 at 4:42 PM UTC, Alexei Starovoitov wrote: > On Sat Sep 12, 2026 at 2:59 AM PDT, Florent Revest (Anthropic) wrote: > > +struct bpf_tramp_skip { > > + struct bpf_prog *prog; > > prog pointer shouldn't be necessary. [...] > > + void *nop; > > + void *target; > > +}; > > + > > struct bpf_tramp_image { > > void *image; > > int size; > > @@ -1374,8 +1389,27 @@ struct bpf_tramp_image { > > struct rcu_head rcu; > > struct work_struct work; > > }; > > + /* entry in tr->images, the image holds a reference on tr */ > > + struct bpf_trampoline *tr; > > + struct list_head list; > > + struct bpf_tramp_skip *skips; > > + int nr_skips; > > I don't follow why you need link list and 'tr' pointer here. > Also why keep ip_after_call ? > > Replace ip_after_call with array of bpf_tramp_skip { void *nop, *target; = } > and then in bpf_tramp_image_put() instead of ip_after_call do: > for (i =3D 0; i < im->nr_skips; i++) { > struct bpf_tramp_skip *skip =3D &im->skips[i]; > > err =3D bpf_arch_text_poke(skip->nop, BPF_MOD_NOP, BPF_MOD_JUMP, > NULL, skip->target); > } > > what am I missing? Ah yeah, I tried to address that in the cover letter. Basically, if we patc= h all the nops, tasks running in the old image could skip some progs that are still attached. For fexit, that's already what happens with ip_after_call b= ut for fmod_ret it would be new and this would cause for example an LSM prog's verdict to get skipped when another prog gets attached to the same hook. Th= at's why I thought that patching only the detached prog's nop would be better an= d needed these extra pointers. But it's a bit of an edge case and I don't hav= e a strong opinion on it. If you'd prefer the simpler version, I can do what you suggested here in v3= . If you'd rather only skip the detached progs, then yeah, I think ip_after_call wasn't needed anymore and I should have dropped it too.