๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22937

Re: [PATCH net v3 1/2] netfilter: nf_dup: do not duplicate packets from br_netfilter

#22937
From: netdev-bot+sashiko
Date: Thu, 26 Nov 2026 07:35
103 lines
11578 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] nf_dup_ipv4() and nf_dup_ipv6() now return early, doing
  nothing, for every skb that carries SKB_EXT_BRIDGE_NF.

--

netfilter: nf_dup: do not duplicate packets from br_netfilter

This commit makes nf_dup_ipv4() and nf_dup_ipv6() return early when the
skb carries bridge netfilter info. It does this to avoid a KMSAN infoleak.
The leak happens when a tcp reset reject of the pskb_copy() duplicate takes
the bridge path in nf_send_reset() or nf_send_reset6() and builds the
Ethernet header from uninitialised headroom.

> diff --git a/net/ipv4/netfilter/nf_dup_ipv4.c b/net/ipv4/netfilter/nf_dup_ipv4.c
> index 9a773502f10ac..a4ad26a564a46 100644
> --- a/net/ipv4/netfilter/nf_dup_ipv4.c
> +++ b/net/ipv4/netfilter/nf_dup_ipv4.c

[ ... ]

> @@ -53,6 +54,11 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum,
>  {
>  	struct iphdr *iph;
>  
> +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
> +	if (nf_bridge_info_exists(skb))
> +		return;
> +#endif
> +

[Severity: Medium]
Does this turn off TEE and nft dup completely for any packet that has
passed through br_netfilter?

The check runs on the original skb before pskb_copy(). With
bridge-nf-call-iptables or bridge-nf-call-ip6tables enabled, a rule like
this one no longer sends any copy:

  iptables -t mangle -A PREROUTING -m physdev --physdev-in X \
           -j TEE --gateway G

The same applies to packets that enter on a bridge port and are then routed
or delivered locally. That is common on container and VM hosts.

Nothing reports the skip. Both functions return void, and the xt_TEE
callers always continue:

net/netfilter/xt_TEE.c:tee_tg4() {
	...
	nf_dup_ipv4(xt_net(par), skb, xt_hooknum(par), &info->gw.in, oif);

	return XT_CONTINUE;
}

So the rule still matches and its counters still go up, but no copy is
sent. Because of Cc: stable, this change would also reach stable trees.

The commit message mentions the routed and local delivery side effect. It
does not say that mirroring of bridged traffic stops completely.

Would it work to remove the extension from the copy instead? For example,
call skb_ext_del() with SKB_EXT_BRIDGE_NF on the new skb right after
pskb_copy().

nf_dup_ipv4_route() gives the duplicate its own dst and dev, and
ip_local_out() sends it, so the bridge info it inherits is stale. Both
reject paths choose the bridge path only by checking for the extension:

net/ipv4/netfilter/nf_reject_ipv4.c:nf_send_reset() {
	...
	if (nf_bridge_info_exists(oldskb)) {
		struct ethhdr *oeth = eth_hdr(oldskb);
	...
}

nf_send_reset6() has the same check.

Without the extension, a reject of the copy would go down the normal
ip_local_out() or ip6_local_out() path. Physdev and other bridge info users
would also stop seeing the original's ports on the copy. Dup would keep
working for bridged traffic.

The later patch in this series, "net: unset the mac header of a pskb copy
that points into headroom", relies on this skip to avoid an out-of-bounds
eth_hdr() read in the reject bridge path. Would removing the extension from
the copy also meet that need?

The same question applies to the identical check added to nf_dup_ipv6().

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124163358.755345-1-theodorlarionov%40gmail.com
Technical Details
Message-ID: <179567851468.3135.1445286719198754408@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371922-linux-kernel-netdev=dewy.ru
References: <20261124163358.755345-2-theodorlarionov@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371922-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/2] netfilter: nf_dup: do not duplicate packets
 from br_netfilter
Date: Thu, 26 Nov 2026 07:35:14 +0000
Organization: Usenet Network
Message-ID: <179567851468.3135.1445286719198754408@kernel.org>
References: <20261124163358.755345-2-theodorlarionov@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="407418"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gCUdqQ4HIqm7l6+xICHXz224uUk= sha256:6rewCXUxbW1K13LH8nVG/hD3MYFt6Stb0q0xPlWgDJM=
	sha1:c4wi8WlB1typvh/wka6WjkGsg9M= sha256:3D76FUoyLdjN1yJUANTS+1lMk69WrWYI8VSNWjNSZRE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 9A06E125EB4; Thu, 26 Nov 2026 10:35:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 0tawKR30OUmH;
	Thu, 26 Nov 2026 10:35:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371922-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 291CF125EB1; Thu, 26 Nov 2026 10:35:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 41D193BE80; Thu, 26 Nov 2026 07:35:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795678522;
	b=2lMwJr0FPHah9/ivygBjPby8IHnNfXZZy8tWXPUj1Fc5pi0Z2jKUFRQQdhTsh6CvmhGm
	 dC2Dmr4AMI0GJXcK4ZK2a+XvVvlTkvSVhbtyhOQSTXw1Z79vHrbpDVG7Z6na9a8wHE/e6
	 bjXWz1xRmgDoKCW3xXzICMtBShDKQLgJOjwwwGNIgfrjLn64Osvv+OGft5oLp3zsNgjfX
	 M7+A6WalL4zbsH7fiyZW/8IDGBYEnlMUXjc5bAuwtU506kLZvlkl9588znojDJa8jJxaT
	 u9TNTre6UYrEi9Um6hS6ZnvTgH+cqieYWoBRChy2YoPxIjTYLSlqTJwWCZZCNTvbR0A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795678522;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=M0Flsf6nylnvXa67j+kFp5pfohgWPoECa8mwzAsasWc=;
	b=qTCNsZ57QZl/eEZAHmd4CbpzuangFbnXCC6bDzyGE59hSLjN3hDaEPLFPzfpls1gyn0/
	 VvPRsVlZMboMSP8nbt3jBt8rd2mvW9s96AG/lz8dXQ238TI9PvLm6TJzahzvQBfPR0aqe
	 XyZa3wn7oe/4oxPd0JxSCsTmNXEHM/ej6yZhtmLq8lToaHVzUZRbFbzSc9htOPNY7mzNR
	 d+W5q3COKltHc5keTAHrWs7Fu9Ng77mZDyf+Cr6VL7UoASPDdjhJXQQob4Y1Smx0Hr3XV
	 koHj3F4XLkdHELpWqQ99MMjKv5iRC1tPFWELkxx3vikx5lfXPkzffRzOg2IJ7gdfR3w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LUNdrgXN;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 144A2606A327;
	Thu, 26 Nov 2026 07:35:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LUNdrgXN
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795678516;
	b=GioLt+IEq2eJhqjDE4tx3yVTsn/gUT8nwy1rN9FQ7sy4M2zU2b6FYRUqN72t0C5QJJ+l
	 sEgAbK1fsUP0XMwyaT0Gkg1RufUvHkgQpsJwmwTd+BPCPY3b8S9vgfgGl6heTq+mcxV1U
	 z0Nw6uRB4lTGCY3MfryKcV6WdTq1y1pnmP5TZHbX63aMs+ZwCuMm4hq0gellEaRXbwFCv
	 Ms/3Bf7gJnPCcy30a+HwC6hhw3qalPYjBm11YusuVFlS3/f6KHnhG+tFB9eUK4Gti6jue
	 zatUupreoiOBpBardWlIwqyn53v1VEoaOEpKHpLVxK3eep0mUw4KQz4iKTOcaO/60JQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795678516;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=M0Flsf6nylnvXa67j+kFp5pfohgWPoECa8mwzAsasWc=;
	b=bC/OTz2b2YgXAvvDh6qUMNplW2aJJYGJdJZ45IQlINhRCOebJ2cNO96iQ+32YR1k05Rl
	 4gdB97Hre6r7Xl9gZPq66uKuC4GcwlTuOMGCh9rkEyjimsf2J0kURxhkkYYeJdrvJVjFe
	 ybPBXYrQ4pm1wy4V34VEz13GaD9hSEqg1lTRKvcIp2wcafQo2fx0EDBSNtXwbSos9J8Ak
	 nEReGCcUrI4MfP3LpTtxUArCFGP6Gb0GsoTRcXqlXLCDkN3QPtgzshAlqjoeNUCgTDRiC
	 62AtzkOtl4aU3tA44OODte6/5d+GwpiK3j7HQrm7klcAgy5FlftpmTzcBMESHgl3GQg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LUNdrgXN;
	arc=none smtp.remote-ip=100.103.45.18
X-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 30ED5606A31C;
	Thu, 26 Nov 2026 07:35:16 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21E091F000C4;
	Thu, 26 Nov 2026 07:35:15 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795678515;
	bh=M0Flsf6nylnvXa67j+kFp5pfohgWPoECa8mwzAsasWc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=LUNdrgXNn7BVHOiBmBTsGBnFmHtKaelTndLNt7lUFtoV+BgHc4WOEtnQ1hYYNBiuf
	 BKmD0qbDqTG/MDLDr4GymzseFD9D06bFtOzYOuTtCiChyUL757153bBECr4WmKQk7v
	 +GTLfV/WX3foH/fQC+1jk4jHgS2W7oRopuVY/OjGbo5VQ8sYxMjvGFOv/s3yuLjBMg
	 WPY1fDYuzpGp8uuuEIQgUsDt+ekqVH0bfy6cjHw75DSHNESIJILZb38PlW/fVG6zX+
	 novYDdrCqf9+JLHM/byzDILWz/0Yr8/w1wwoHu4JvHDWFSGstUfWP1XdmzCFq9zFlH
	 3bB4jOhtiJh3g==
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, horms@kernel.org, pablo@netfilter.org, fw@strlen.de,
 phil@nwl.cc, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
 coreteam@netfilter.org
X-In-Reply-To: <20261124163358.755345-2-theodorlarionov@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list