Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DC2E37BE83 for ; Mon, 18 May 2026 17:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779124060; cv=none; b=XDPDaWqC8OTDC+9M23YZlT/7GDsy5z+pbAaRa3c8lc7D70K517bkHEqPVDvpPZx3tkchylGW6m82hC/pI7vZ76nqAuWfgrQG9BNK29UBf72A2CBqXVIqJgFFOGxuY7eYHtz4kxzX2bshRvY0V5OrcPlcnJx5jdD0qbYhr4u83uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779124060; c=relaxed/simple; bh=e1FwZTDR08KbFRNJtnzwjcwwgmq5u+Xq0m4WzIq98yE=; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date: Message-Id; b=Vd9lyNfCDrWauOaN4VDzmku99VmEN+cveDMH+rlXU6mCAACU+FBdUwGUSFTXg/Zs5KVDmyxFFxVTCk6vuewBKz2epgaRiDjpKdPpQoB8kPPf8Mx7dC6W0ObHqn5YBWzjpUhFr/U0MINTvdD5afQComuCBRi/HTN8sIPq8fYcXAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XiPOZYFg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XiPOZYFg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3626C2BCB7; Mon, 18 May 2026 17:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779124059; bh=e1FwZTDR08KbFRNJtnzwjcwwgmq5u+Xq0m4WzIq98yE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date:From; b=XiPOZYFgvayDoAgDRPGV8SfapbLXehBr/D+zyvFJzJ7X1FCyDLqrG+tbnQuqAYuMi cK9PEAsgUZ1kdb0pW09ms6ri654bCVdAK62/jMYiaRpoQxmqt5BM43gKNf3nRwheS6 1wnj0ObiNBJ0UlzrzODGo44JOw0pdAEW8cSWN6Lm3RPOdngQ2DeXfXuIn/9kKuFbfd 6yxzcZsB/HGfZ+UuD0Y26wE5g0xOIbHXiW8c5HBhWKWVyASabaUhHHttjD6Nvun3Fj +z9o44QK7/2CUkcWrVeA20l9h1/34i6b1xWi41Lmrj9DMOqRwnzlSju4jPTGL45EHB EtoXCBJcjWErw== From: sashiko-bot@kernel.org Subject: Re: [PATCH bpf-next v6 6/6] selftests/bpf: add bpf_icmp_send recursion test Reply-To: sashiko-reviews@lists.linux.dev To: "Mahe Tardy" Cc: bpf@vger.kernel.org In-Reply-To: <20260518122842.218522-7-mahe.tardy@gmail.com> References: <20260518122842.218522-7-mahe.tardy@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 18 May 2026 17:07:39 +0000 Message-Id: <20260518170739.A3626C2BCB7@smtp.kernel.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] The BPF program `recursion` acts as a global drop-all firewall for= host IPv4 traffic, causing severe network disruption and test flakiness. -- commit d88b16de11be32b864006f6686e0acf06d339e51 Author: Mahe Tardy selftests/bpf: add bpf_icmp_send recursion test This commit adds a test to verify that the bpf_icmp_send kfunc stops early and returns -EBUSY when triggered recursively. The test attaches a BPF program to the root cgroup to intercept the kernel-generated ICMP packet. > diff --git a/tools/testing/selftests/bpf/progs/icmp_send.c b/tools/testin= g/selftests/bpf/progs/icmp_send.c > index 6e1ba539eeb0f..7830334b747ac 100644 > --- a/tools/testing/selftests/bpf/progs/icmp_send.c > +++ b/tools/testing/selftests/bpf/progs/icmp_send.c [ ... ] > @@ -65,4 +68,32 @@ int egress(struct __sk_buff *skb) > return SK_DROP; > } > =20 > +SEC("cgroup_skb/egress") > +int recursion(struct __sk_buff *skb) > +{ > + void *data =3D (void *)(long)skb->data; > + void *data_end =3D (void *)(long)skb->data_end; > + struct iphdr *iph; > + int ret; > + > + iph =3D data; > + if ((void *)(iph + 1) > data_end || iph->version !=3D 4) > + return SK_PASS; > + > + /* This call will provoke a recursion: the ICMP packet generated by the > + * kfunc will re-trigger this program since we are in the root cgroup in > + * which the kernel ICMP socket belongs. However when re-entering the > + * kfunc, it should return EBUSY. > + */ > + ret =3D bpf_icmp_send(skb, unreach_type, unreach_code); > + rec_kfunc_rets[rec_count & 1] =3D ret; > + __sync_fetch_and_add(&rec_count, 1); > + > + /* Let the first ICMP error message pass */ > + if (iph->protocol =3D=3D IPPROTO_ICMP) > + return SK_PASS; > + > + return SK_DROP; > +} Since this program is attached to the global root cgroup, does it act as a global drop-all firewall for host IPv4 traffic?=20 If any background traffic occurs while this test runs, it appears it will be unconditionally dropped here. Could this also cause test flakiness? If concurrent background traffic triggers this program, it would race with the test traffic and overwrite the rec_kfunc_rets array, leading to unexpected values in the test assertions. Should the program explicitly filter packets, for example by checking iph->daddr or iph->protocol, to ensure it only processes the test's intended traffic? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260518122842.2185= 22-1-mahe.tardy@gmail.com?part=3D6