๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15782

[PATCH net 1/5] ipv6: gro: limit the number of extension headers

#15782
From: Eric Dumazet
Date: Fri, 13 Nov 2026 12:46
70 lines
10866 bytes
Hyunwoo Kim reported that a long chain of IPv6 extension headers
can push the transport header offset of a GRO packet beyond what
the 16-bit skb->transport_header can store. The truncated offset
is later used by gro_receive_network_flush() to locate the network
header of a packet held in the GRO list, leading to an out-of-bounds
read.

Since commit 3744b0964d52 ("ipv6: Implement limits on extension header
parsing"), ip6_protocol_deliver_rcu() drops packets carrying more than
IP6_MAX_EXT_HDRS_CNT extension headers, but ipv6_gro_pull_exthdrs()
was left unbounded.

There is no point trying to aggregate packets that the stack is going
to drop anyway if they are locally delivered. Apply the same limit in
ipv6_gro_pull_exthdrs().

When the limit is hit, @proto still designates an extension header.
Extension header offloads have no gro_receive() callback, so
ipv6_gro_receive() takes its existing "goto out" path with flush set,
and the packet is given to the normal receive path. Local delivery
drops it with SKB_DROP_REASON_IPV6_TOO_MANY_EXTHDRS, while forwarded
packets are simply not aggregated.

An extension header being at most 2048 bytes, this bounds a chain
to 24576 bytes.

Note that offsets can still accumulate over nested encapsulations,
so the places storing them should be hardened separately.

Fixes: 4b0ebbca3e16 ("net: gro: move L3 flush checks to tcp_gro_receive and udp_gro_receive_segment")
Cc: stable@vger.kernel.org
Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
Link: https://lore.kernel.org/netdev/avTTQNyvwPP6LtGx@v4bel/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>
---
 net/ipv6/ip6_offload.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 700f1861d8eb..01642900c0fa 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -26,6 +26,7 @@ static int ipv6_gro_pull_exthdrs(struct sk_buff *skb, int off, int proto)
 {
 	const struct net_offload *ops = NULL;
 	struct ipv6_opt_hdr *opth;
+	int exthdr_cnt = 0;
 
 	for (;;) {
 		int len;
@@ -38,6 +39,13 @@ static int ipv6_gro_pull_exthdrs(struct sk_buff *skb, int off, int proto)
 		if (!(ops->flags & INET6_PROTO_GSO_EXTHDR))
 			break;
 
+		/* Same limit as ip6_protocol_deliver_rcu().
+		 * @proto is left pointing to an extension header,
+		 * so that the caller does not aggregate this packet.
+		 */
+		if (unlikely(exthdr_cnt++ >= IP6_MAX_EXT_HDRS_CNT))
+			break;
+
 		opth = skb_gro_header(skb, off + sizeof(*opth), off);
 		if (unlikely(!opth))
 			break;
-- 
2.53.0
Technical Details
Message-ID: <20261113124625.4010206-2-edumazet@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362644-linux-kernel-netdev=dewy.ru
References: <20261113124625.4010206-1-edumazet@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362644-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/5] ipv6: gro: limit the number of extension headers
Date: Fri, 13 Nov 2026 13:46:21 +0100
Organization: Usenet Network
Message-ID: <20261113124625.4010206-2-edumazet@kernel.org>
References: <20261113124625.4010206-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1366626"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uajIIOgvfg0NlaxUoGhoNvj9MCY= sha256:FA8q5FP67oXI0Bh8+dFSZvW4j+c6YGvjOLOb22V4eUk=
	sha1:m10hdX7anvwcobx1xDKhJz8C2II= sha256:kH+IE71dYGm1u5aYlvPlLgklXXQ763SuvN2tcKIWW5s=
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 CE23B114572; Fri, 13 Nov 2026 17:53:55 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 0t4DVYIMjMuv;
	Fri, 13 Nov 2026 17:53:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-362644-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id EF9C6114530; Fri, 13 Nov 2026 17:53:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id C79F3108F39; Fri, 13 Nov 2026 12:46:42 +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=1794574000;
	b=X/ir/9yYPH8UJkOZgSEcUe8vGBOM6AxjibWmsqycpDEIqU6coVD11WMDi+Cht/Th7S1z
	 v2dzaj1UMmTC4D0eWNUeHn+g1YJTBFWSK3TUU54DFubpReH6qH2BiK1vq2/E8podT7lds
	 5cJvGGi7Rpnhq6EOAutaEDnWB2gl4zIyWUxu4potIbIjH7yWmo3q1j8BGkJPXT+KTR9MB
	 FDwNKO3di5Z3TTsq92V2yd5rM5f83RPOKp0uvO43h7xRRCXoDOShk/WZUXozTePxYbBSe
	 eCYfMDFHzoQ59N45hcJ2e1/VnSfangzCGoims6amOBGoMYvxa4yxeDZ+eWIKY6vN7WQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794574000;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=A0GM3PZVBKJhqopMld6/zhSyIM92Ig9ChbL4osc7uig=;
	b=d27QxAl5yHLWotWKgwMJdjE0vitD1aRWigeWjT/fsNzPDARFT5K4P8MaITKYNGpAOmMK
	 OQ4DaVEPdfocom0DtkC8pHTVrZtB3TYEEK606HPg+PPsenv42tdQVgDEglfhjvxF3JKwS
	 /Jcu6Axavk+IhbQW7Ntn8W6W0NrZILqJZvsnmVhIqRaQqoGbYeQblXmE79gNgMp4Ki2Ml
	 l34xKA4ZgMIiO9OEyu4RYVG7bgY6q4Q/58FgCNQbRIhPbwcMtI4l0R3pSO+wxhWbnIIgG
	 05fahjBCuaRjDnoo+VOUHj6HeeOP05Khn45ugXH1/Pw/3lC+Lwr7tNm3/15oWFlHYDw==
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=gVJsmRfg;
	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 BF88A606A333;
	Fri, 13 Nov 2026 12:46:40 +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=gVJsmRfg
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=1794573999;
	b=XaqDAIpDpa8isxXINxQ4q/mswAQkvfGanXogLzW4KGYERa4HXs+9B67JHTe4Bn5CtJC2
	 F/SsPwEW2nyxACWKKN7S1S4v+ASzn0MPTaZXP8XRqTyPdNritphwxMj0P0hQcO3V2+pwo
	 qaYfagBh2RU1XSVEXQHKdADmEz2i2uYz7Oi9jlV4ZLp6J0ACx10jG6Xf6A5OHrvkhqKS9
	 PUf1BY9Ir5JuB5eYN482R1Yrn/57wA+IvEkN94vy2juBTi1rRbQKjDhFANqMIOox6KMeL
	 YaSPVAPX5uZZTMRkAVRszwCBoRyTCI611xsfGxgxgaNtAkGAOxjJ7vKTc6LdZG1Vl1A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794573999;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=A0GM3PZVBKJhqopMld6/zhSyIM92Ig9ChbL4osc7uig=;
	b=VBivGkKVot/SVoWSjYlqjGjkwCs4PQOWn6/4ru3xUc75Qlj0WhkZP5ANYaSUI9o93gRE
	 Lopn7cIUPgMM6aRQwntCuJObItwoVrwDvQfeNSu3ZoxJjh6VxCequQYBR02Oi6GBHPaHe
	 nCq8r4q9fQpIkyGHDF0A1c0vakKQowhK/qFWNoBxIOGD7dP9edo6HRnuK0Mrwyn1O7zY3
	 aCk8IayXnICxPGyKNELRRlr7Z0DDqSoiDH1ejfd5GnxU2VBMDiqgskfnwS7+lA/okkdLO
	 4TkFDoevNg7OyvJP8de7anCqUP+RAWt6MnOplacmL7eqTGSIfL8YcLWY9TYQVIGsVUg==
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=gVJsmRfg;
	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 DD946606A323;
	Fri, 13 Nov 2026 12:46:39 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B739A1F000C4;
	Fri, 13 Nov 2026 12:46:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794573999;
	bh=A0GM3PZVBKJhqopMld6/zhSyIM92Ig9ChbL4osc7uig=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=gVJsmRfgDPDd9yBBxPqKik+KJ7Rv480wF+yiB7D0miEIh1HjnZOkNvcV886ui9vFf
	 46Vt+LnGKd3x7jgHL/xA3CZtZwzMqHQkhBdicR0y0smKMIw43CjO6lExhJSM4xp+DG
	 pOd8J8z2jHLlSo9twnx43olUyK2z/Y9Q5gJF9PHVvrqR+c7VZrZo8IzcCzC/sUUXtv
	 2UvcHb4LGgK3u/LouzsPpJWc/0DsKmVb/6bzrj7Cjp96rCUaauhSHYore8cn3bJbeF
	 INDGEnJnbLk0xQIgXRpYCARjyALhwhH9/WSP31USxd/kKa2Xcwp6siB/jSR9tYLz+7
	 TqtdZGpKxg3nQ==
X-Cc: Simon Horman <horms@kernel.org>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Xin Long <lucien.xin@gmail.com>,
	Aaron Conole <aconole@redhat.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Ilya Maximets <i.maximets@ovn.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Justin Iurman <justin.iurman@gmail.com>,
	Linus Lรผssing <linus.luessing@c0d3.blue>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Stefano Brivio <sbrivio@redhat.com>,
	Hyunwoo Kim <imv4bel@gmail.com>,
	netdev@vger.kernel.org,
	linux-sctp@vger.kernel.org,
	dev@openvswitch.org,
	Eric Dumazet <edumazet@kernel.org>,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261113124625.4010206-1-edumazet@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