Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795027103; b=w9wQRNYm2oVGLRI8LhvignwuLZIfYpMDSVWaJaUOHaHFJ699C1dSCxOPeIH90n/CWsvn Ipbg0F6lpj6dOR3csdEqQXdNweYegFURvZwuLjOIuqE0yCsjrQitFVYFnIa8DJjgDE1F6 g415zwxCEUPOk5oLdex97eG+qfGYBsvKhYZVPqeiHkekLbrf9VdFRdB2voJO30ZlaCo8A UofBKlKkhcGxvkUg3l0iPqWJaSvbtZLmNcsKCEPOxfo6YkFBcibe75ehHO2LxAy/Dw1uo Gwv6KUOgdy9MS74Mm7YPARY4yPBnNaOGGllM8Y1jQqPEQ3WgwivqF6iljOm+sBDx4VQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795027103; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=CoKW0/4vxMWRAdVR2cWQqntMUrytjfqxvw4Eh2FRSVE=; b=UOwWkgnwSHV8fNpv5twQmC82EyjfX0Z6VpPe5VluSIYiyKsTqwQkz1GpVrWd0VFXw2kx I0tKNj/RNtDHK0Ur3S1SRqflcGC1YUGP6gsM2OdRNfbSoRYybOIyf4tJXSDtMagG+vlnN IEYK0rAsOcC7oJoLrS0OGjn/St25z5V+TpRwZ6AotR7eFUFKEyF5M1MIRiPkKuDzhTGtb JC+n9VsMuLyHUdlDFonkftReDL+Gc4ysQwRF9EFhN3dfWI5xTka2bQ225t6Fa0UewyBL4 dg/GKa3WF6Y736+BP+q5SEA0Qb7r3wOyA3pOFOyj3X053dcJXCyg0tm8GqDxZ5bOF2Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=w0jwh2TF; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D553D606A31C; Wed, 18 Nov 2026 18:38:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=w0jwh2TF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 311841F000C5; Wed, 18 Nov 2026 18:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795027103; bh=CoKW0/4vxMWRAdVR2cWQqntMUrytjfqxvw4Eh2FRSVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=w0jwh2TFDDllOSBLih0VkH8mugOav2p4lsDjU3GAjFTbwb3TKirH/NKp6A5/yLdZF jk3uYQSR6YVr2iUF0q/ivmPRu1aQcr/U6oyT5shzOulb8OrDcGzN86m3xqpZnY97Da LqZ7KAxEJNx18xunkVXb9Jzi8zm0zvrNsNCw7RxU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qiliang Yuan , Daniel Borkmann , Sasha Levin Subject: [PATCH 6.18 1671/2151] selftests/bpf: Record only the test ICMP echo in tc8 of tc_netkit_scrub Date: Wed, 18 Nov 2026 15:56:46 +0100 Message-ID: <20261118150222.705282400@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150121.603863898@linuxfoundation.org> References: <20261118150121.603863898@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Qiliang Yuan [ Upstream commit 17f6fc3ad257b0ad7a11f276a5c0f57e0bdf3f4a ] tc_netkit_scrub attaches tc8 to the primary netkit device, sends an ICMP echo with a mark and a priority through it, and checks the mark and the priority that tc8 saw against what the scrub mode lets through. tc8 records the mark and priority of every packet it sees, and the device also carries what the system sends on its own once the device is up, like IPv6 neighbor discovery or the mDNS of avahi-daemon. When such a packet goes out after the echo, it overwrites what tc8 recorded, and the test finds a mark and a priority of 0. Record only IPv4 ICMP packets in tc8. tc_netkit_scrub run 100 times on a bpf-next kernel with KASAN enabled, x86_64 VM with 32 vCPUs and avahi-daemon running, before and after this patch: before after outcome 2 of 100 failed (mark and priority 0) 0 of 100 failed Fixes: 716fa7dadf11 ("selftests/bpf: Extend netkit tests to validate skb meta data") Signed-off-by: Qiliang Yuan Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20261016-selftests-bpf-tc-netkit-scrub-v2-1-b484a7ce2a63@gmail.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/progs/test_tc_link.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/test_tc_link.c b/tools/testing/selftests/bpf/progs/test_tc_link.c index 630f12e51b075..2a91793674dd5 100644 --- a/tools/testing/selftests/bpf/progs/test_tc_link.c +++ b/tools/testing/selftests/bpf/progs/test_tc_link.c @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include #include @@ -119,11 +121,19 @@ SEC("tc/egress") int tc8(struct __sk_buff *skb) { struct net_device *dev = BPF_CORE_READ((struct sk_buff *)skb, dev); + struct iphdr iph = {}; + if (skb->protocol != __bpf_constant_htons(ETH_P_IP)) + goto out; + if (bpf_skb_load_bytes(skb, sizeof(struct ethhdr), &iph, sizeof(iph))) + goto out; + if (iph.protocol != IPPROTO_ICMP) + goto out; seen_tc8 = true; mark = skb->mark; prio = skb->priority; headroom = BPF_CORE_READ(dev, needed_headroom); tailroom = BPF_CORE_READ(dev, needed_tailroom); +out: return TCX_PASS; } -- 2.53.0