🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25060

[PATCH net] macvlan: drop the conntrack entry of broadcast clones

#25060
From: Kyuwon Cho
Date: Tue, 01 Dec 2026 08:04
71 lines
12854 bytes
macvlan_broadcast_one() hands a clone of a broadcast or multicast frame
to each macvlan device. In bridge mode the clone goes through
__dev_forward_skb(), which drops its conntrack entry, but in the other
modes it keeps the entry of the original skb. If tc act_ct attached an
unconfirmed conntrack entry at the ingress of the lower device, the
original skb and the clones then share one unconfirmed entry, while
netfilter treats an unconfirmed entry as owned by a single skb. When
one of them adds a conntrack extension, e.g. the helper extension that
an nft ct expectation object adds, krealloc() frees the extension area
that the others still read:

  BUG: KASAN: slab-use-after-free in nft_ct_get_eval (include/net/netfilter/nf_conntrack_extend.h:46 include/net/netfilter/nf_conntrack_labels.h:28 net/netfilter/nft_ct.c:117)
  Read of size 1 at addr ff11000013ec5507 by task kworker/u8:0/13
  Call Trace:
   nft_ct_get_eval (net/netfilter/nft_ct.c:117)
   nft_do_chain (net/netfilter/nf_tables_core.c:237 net/netfilter/nf_tables_core.c:285)
   nft_do_chain_ipv4 (net/netfilter/nft_chain_filter.c:24)
   nf_hook_slow (net/netfilter/core.c:633)
   ip_rcv (net/ipv4/ip_input.c:618)
   __netif_receive_skb_one_core (net/core/dev.c:6451)
   process_backlog (net/core/dev.c:6917)
  Freed by task 114:
   krealloc_node_align_noprof (mm/slub.c:7098)
   nf_ct_ext_add (net/netfilter/nf_conntrack_extend.c:115)
   nf_ct_helper_ext_add (net/netfilter/nf_conntrack_helper.c:187)
   nft_ct_expect_obj_eval (net/netfilter/nft_ct.c:1432)
   nft_do_chain (net/netfilter/nf_tables_core.c:232 net/netfilter/nf_tables_core.c:285)

Two such adds free the area twice (KASAN double-free in
krealloc_node_align_noprof()).

Drop the conntrack entry of the clone, as __dev_forward_skb() does and
as act_mirred does since commit d09c548dbf3b ("net: sched: act_mirred:
Reset ct info when mirror/redirect skb").

Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyuwon Cho <kyuwon.cho@skku.edu>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype. Any user reaches it from its own
user and network namespace. Our reproducer puts tc act_ct (and a mirred
mirror) on the ingress of a veth peer with two private-mode macvlan
devices on top, adds an nft ct expectation object and a ct labels read
in prerouting, and sends a burst of broadcast UDP frames. Both
use-after-free reads and double frees (KASAN double-free in
krealloc_node_align_noprof()) show up. With the patch the frames go
through and nothing is reported. The reproducer is available on
request.

Found and tested on mainline fe6ff8d5d675 (v7.4-rc5, with KASAN);
the patch is against net (76fca30e8d34).

 drivers/net/macvlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 4f8416bb5169..237744d6bfc2 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -237,6 +237,7 @@ static int macvlan_broadcast_one(struct sk_buff *skb,
 	if (local)
 		return __dev_forward_skb(dev, skb);
 
+	nf_reset_ct(skb);
 	skb->dev = dev;
 	if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
 		skb->pkt_type = PACKET_BROADCAST;
-- 
2.43.0
Technical Details
Message-ID: <179607207068.562302.5326868635249894085@skku.edu>
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-374818-linux-kernel-netdev=dewy.ru

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-374818-linux-kernel-netdev=dewy.ru
From: kyuwon.cho@skku.edu (Kyuwon Cho)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] macvlan: drop the conntrack entry of broadcast clones
Date: Tue,  1 Dec 2026 17:04:20 +0900
Organization: Usenet Network
Message-ID: <179607207068.562302.5326868635249894085@skku.edu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1654389"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:P4q5+xqtjaOaSf2Q3aGROuTKyUc= sha256:Ih/YZDpRxLbKgtZOHSK0buIockli/mDL0VFgi5eKFNc=
	sha1:xMq3Vmo7nlehTllBAAdNrJJ+6S8= sha256:uYVHG5ZPS788u/94CVVjaUstcpq5kdH1VmCVWpnQeLc=
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 C710B1172AC; Tue,  1 Dec 2026 11:04:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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=worksmobile.com header.b=B/5EiQI9; dkim=pass (2048-bit key)
	header.d=skku.edu header.b=aMMND6gf
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 2IGG4t5zZAJ7;
	Tue,  1 Dec 2026 11:04:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374818-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=skku.edu
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 053691172B0; Tue,  1 Dec 2026 11:04:36 +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 9050D281F9; Tue,  1 Dec 2026 08:04:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1796112272;
	b=n80fl4Wb8XdHTStUC9d0FnR8vO/UQATMnvbuXmmwaqqR5/Mt41l0tboouaxiydNJRrZ2
	 hIA356qDXRDkrN0YMts4kjfgeM412PCfrfI0YBfB039ZslvI+z046xdHbBIv1IbcXemU8
	 /x49DoxvXS6siwTzsKFiOz2zm2D8VSxSBez8+f950spKZdWZidcswLrudfhJ9VyUksMuc
	 FmEud7it6XPvr64uSLbrk5f+mNF5pZy3xxSITVOo4N3kWXJEVxWcAN4sFAlmAIJp6BhQR
	 2IcLrqXIi7gDw5H2upg8IqXB6N3u/PNrMWXz5djl+FNAT5BR+zWtQ8/RHrXe7RaOW0g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796112272;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:
	 DKIM-Signature:X-Session-ID:X-Works-Send-Opt:X-Works-Smtp-Source:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=Vvl+fny3qMht94458Xtwsgfc7KwZ0sOt/ZdAbj6vdFQ=;
	b=G3DpblxNm52GDrpsZTCBhVUtaixfu5Ewz73f4+SzV8CwpztfLi6T/kBwa7bNWUmVck4X
	 NCbEwfwL4ieaChS92uAHsHjBfoJfxvcUmMfPonfTlm4gxC6lnsbAEwyFPYCR/W9U4VZ9S
	 soYNHP4eqpUL5HRz4x7PjnDmDkeCqhHApA0/Gvwnt1Wr9hhSD0aVqfjACqahQGhQ/kJ1b
	 QRYpcPEja2JwI91qpufchUnvH1dyW7sfqc+8b0OqtqmnzgB/I/cOQmQ73oODD0OltTn+o
	 5ZcB/bnMSKbunvE7CC2rai8MrR+raEOp3d39AojgKgyY3WDeuAfW/ayHxn+85Fz6h0g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=worksmobile.com header.i=@worksmobile.com header.a=rsa-sha256 header.s=s20171120 header.b="B/5EiQI9";
	dkim=pass header.d=skku.edu header.i=@skku.edu header.a=rsa-sha256 header.s=naverworks header.b=aMMND6gf;
	dmarc=pass header.from=skku.edu;
	spf=pass smtp.mailfrom=skku.edu;
	arc=fail 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 66AD9606A325;
	Tue,  1 Dec 2026 08:04:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=worksmobile.com header.i=@worksmobile.com header.a=rsa-sha256 header.s=s20171120 header.b=B/5EiQI9;
	dkim=pass (2048-bit key) header.d=skku.edu header.i=@skku.edu header.a=rsa-sha256 header.s=naverworks header.b=aMMND6gf
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=125.209.209.74
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796112271;
	b=tf9yaN34hBS8kCvTDzA10aIgvdZVQRLwOuJKjHq/fZ8PKD3X2nfrEmLZdilxCcYBW8F3
	 nq0lbpH3GB3jUr+KGI74MrPcyYmuKsp1gqOjnBhjeZTdotF+sP0V07PcnppnXzPmhuSxJ
	 r3zNsR8wwyJjsXpZ5KP0N66ByLiRZ4BmX8UIAytOupGAL8Mw1cqOGFAJez1+XH46gsGNg
	 59YODCoMV9bbAKEPhFoZdtIfTrjkhrr6GTacMK11PckZVf/Q+hR/ajOAMSJUsN9kczVVV
	 eSMvqj7DaQyrqf4eeSPeZtcLI0Rya2+sFepKTNy4sncJ+7aWSr48p1k8yz9CehwqNGQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796112271;
	h=DMARC-Filter:DKIM-Signature:X-Originating-IP:Received:DKIM-Signature:
	 X-Session-ID:X-Originating-IP:X-Works-Send-Opt:X-Works-Smtp-Source:
	 Received:From:To:Cc:Subject:Date:Message-ID:MIME-Version:
	 Content-Transfer-Encoding;
	bh=Vvl+fny3qMht94458Xtwsgfc7KwZ0sOt/ZdAbj6vdFQ=;
	b=STojEvMm1jJHqcamt8RM5vgv+vfpOEWsnS9TbaLd+hmtWmrXTcDTCkChj6TtneDu45bT
	 ymBE7ZFvl7jK7wk8ZdQnJUbWUpn/Oi0QP21QsYySctvDSYHf+W+Rw/Ua5voFcN1rMs07m
	 OB0LCIGAllLVKwBK2GN44oFWcRsYji60FPH4IwV0noCGl9dnTCz2VGQcj8FMft4ZFzdJZ
	 nWam4ac+cYXLC/g/7QhJ+JHNSZFs3JkLcQfAdVCkCXu0EBZXqBALdyIetg9QcqBXdvtam
	 BpFCSJztoZxBDSLE/lKbs1IqM7alpnFndQpqJSMpY8+c37vfUp2FSp4KOkHUBwyuftQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=skku.edu;
	spf=pass smtp.mailfrom=skku.edu;
	dkim=pass header.d=worksmobile.com header.i=@worksmobile.com header.a=rsa-sha256 header.s=s20171120 header.b="B/5EiQI9";
	dkim=pass header.d=skku.edu header.i=@skku.edu header.a=rsa-sha256 header.s=naverworks header.b=aMMND6gf;
	arc=none smtp.remote-ip=125.209.209.74
X-Received: from cvsmtppost106.wmail.worksmobile.com (cvsmtppost106.wmail.worksmobile.com [125.209.209.74])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 202C4606A320
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 08:04:29 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 202C4606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=skku.edu
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=skku.edu
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=worksmobile.com;
	s=s20171120; t=1796112261;
	bh=MKnSvcPAEmexckSVd1fqZ0TMKDDyjBU2JJTFvcIZTvg=;
	h=From:To:Subject:Date:Message-ID:From:Subject:Feedback-ID:
	 X-Works-Security;
	b=B/5EiQI9Urni4NCXY2XH9RCJ1Oy+s1Cy5fh9eXeexvY45R+MVnUoo0CXuDT0AURa/
	 zLTMqu5Qxkywrb+B6G+H3abEJwEOwUnkwH/XNdl6sKtFQw1LEBpRAoo440IWtYgQR6
	 QcIvqLPPU9/YqHRHjvr0PlZarah60CTjqKcTolPJO3gn+tnfT+w+jyTwQzbZ9Yly3h
	 I9pv+YH+pc1JLVfjqqk7RU3fVFuhKJQqEMDS0giFiMweCsG9qFjM0VvxBsPqG/fpQz
	 5+OCtCEIgu9AV3+MLIRXYdHE33YfA5GJFi4F1whRko0Cc6cH66Q1NUvN/bteJF7TG5
	 ZjCsvTLDdg8sA==
X-Received: from kr1-hmac-real-5 ([10.174.201.129])
  by cvsmtppost106.wmail.worksmobile.com with ESMTP id 7JLlrSqXTZKI7F6i0S5n1A
  for <netdev@vger.kernel.org>;
  Tue, 01 Dec 2026 08:04:21 -0000
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=skku.edu; s=naverworks;
	t=1796112261; bh=MKnSvcPAEmexckSVd1fqZ0TMKDDyjBU2JJTFvcIZTvg=;
	h=From:To:Subject:Date:Message-ID:From:Subject:Feedback-ID:
	 X-Works-Security;
	b=aMMND6gf3GMpUMB8gzMJoE26UP+TV0Ae5OvcX/04GMqyjmC/T/IcgBhpUu1al/Ie/
	 ODPXBE5iMrPSeyf4nkxvHQKOcetwiILDjN79ms94Zba6I5i5taDgKbyMjRchhdYK97
	 iP3XZ0RydFC+ZFNWf9+E4GQNy05bFpb1m+/xj5oOs711Ph7qAMsyiP6DgaCU+wFU7o
	 ll2XeUoopQO2HRCZXfi1mpYC4MAQjB7B4fZuHWNBI8JYRA/bZ2tdP9YOKCxH7gHjba
	 1bx2fKImHEh9A9dcAhulUcLIMtrE3xOTJ9CQLKket2O0BJO76mb3pthJstYVITn5oT
	 B1uxazmuipmqA==
X-Session-ID: cvlxZ4huRMCA0BYXaU-DQA
X-Works-Send-Opt: wlbXFqgmKAKmKAFYKqMqKA2mFAurjAumKAgmKxEmKqK/aAtwaBmmjACYKxM/axKmKo2rFBwYjAg=
X-Works-Smtp-Source: Q9KXKAMlFqJZ+HmwFo2l+6E=
X-Received: from d4082dd914b5.tail196be.ts.net ([115.145.173.180])
  by cvnsmtp102.wmail.worksmobile.com with ESMTP id cvlxZ4huRMCA0BYXaU-DQA
  for <multiple recipients>
  (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
  Tue, 01 Dec 2026 08:04:21 -0000
X-Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	netdev@vger.kernel.org
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