🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8558

[PATCH net] net/sched: act_csum: guard skb pull length overflow

#8558
From: shaos
Date: Thu, 29 Oct 2026 12:57
55 lines
10624 bytes
Hi Jamal,

Thanks for offering to reproduce this. I have a fix below.

The length passed to pskb_may_pull() is computed from ipl and the
network header offset. With an IPv6 jumbogram, that unsigned addition
can wrap, allowing the helper to accept a short skb before the
checksum path uses the original length.

The patch computes the pull length in s64 and checks it against
skb->len before calling pskb_may_pull().

I tested this on c339f4010dea8 with the posted reproducer. The
unpatched kernel matched the root-seeded checksum in 45/512 trials.
With the patch, the malformed packet was dropped (tc action stats:
dropped 1). A normal IPv6 UDP-Lite packet still had its checksum
updated.

net/sched: act_csum: guard skb pull length overflow

An IPv6 Jumbo Payload option can provide a length close to UINT_MAX.
Adding the network-header offset before the pskb_may_pull() check can
wrap the requested length to zero or another short value. The checksum
code then uses the original length and may read beyond skb->len.

Calculate the pull length in s64, reject negative values and values
past skb->len, then narrow the value for pskb_may_pull().

Fixes: eb4d40654505 ("net/sched: add ACT_CSUM action to update packets checksums")
Link: https://lkml.iu.edu/hypermail/linux/kernel/2610.2/16452.html
Link: https://lists.openwall.net/netdev/2026/08/24/344
Signed-off-by: shaos <shawnq1@163.com>
---
 net/sched/act_csum.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 5fff52a8ca90d..196b940cd6230 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -137,8 +137,10 @@ static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,
 {
 	int ntkoff = skb_network_offset(skb);
 	int hl = ihl + jhl;
+	s64 pull_len = (s64)ipl + ntkoff;
 
-	if (!pskb_may_pull(skb, ipl + ntkoff) || (ipl < hl) ||
+	if (ipl < hl || pull_len < 0 || pull_len > (s64)skb->len ||
+	    !pskb_may_pull(skb, (unsigned int)pull_len) ||
 	    skb_try_make_writable(skb, hl + ntkoff))
 		return NULL;
 	else
-- 
2.34.1
Technical Details
Message-ID: <20261029125754.3835541-1-shawnq1@163.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353293-linux-kernel-netdev=dewy.ru
References: <CAM0EoMnP3VkEV6fOAMdZ9ma9egUpV4AFfB+44k4VD7jx2dHPNA@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353293-linux-kernel-netdev=dewy.ru
From: shawnq1@163.com (shaos)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] net/sched: act_csum: guard skb pull length overflow
Date: Thu, 29 Oct 2026 12:57:54 +0000
Organization: Usenet Network
Message-ID: <20261029125754.3835541-1-shawnq1@163.com>
References: <CAM0EoMnP3VkEV6fOAMdZ9ma9egUpV4AFfB+44k4VD7jx2dHPNA@mail.gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2010043"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UMUwsdfjj3jEPkwKQuUKX5BxlbI= sha256:IbrT4zWFiTaceSACpeSssIF7juZfBYHtHFhhCeL1vO4=
	sha1:sou+y4F3E2R/SeiDz8hrgYxXaNY= sha256:UWs1tcBX0RPtDikrNAtFjz1Y3UR+ly7OznnyM08SDVg=
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 1A740125C68; Thu, 29 Oct 2026 15:59:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.047
X-Spam-Status: No, score=-3.047 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=163.com
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 dWbqWzPwOpUa;
	Thu, 29 Oct 2026 15:59:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-353293-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 0F25B125C65; Thu, 29 Oct 2026 15:59:01 +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 6A05427F09; Thu, 29 Oct 2026 12:58:55 +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=1793278734;
	b=q2vjH3SuIvqylYHXsjy4qBu07KmFt+ls640RUYRWyNGdYF5+RcU3fd9gnIzywRorSgTf
	 xNYT9Fr25tcAvvt36WWQBMDWyl0RSd9X3+RAXJHYBIcZ6e+GO6WI907B+zc1TXz2gFBLh
	 MZ09f4AC03E6zWbzjRRBiAAL/Kwuo+zS2EOwVozSZrrxKAJGyZzy7DmGV6SGCXzYiwFDm
	 Uy4cptsaHY0kCEnU75tdQmS5UUGl7ZqMujEoFCUU9RNSAMNrH4JfQ+rSrWtiyoo+zU7Pm
	 JYpr2STBDqnysz1l7epNTiiR5gCrrcLSYcdHkY1doMoQjMqmbYhlFoViF7RXfr2PLLA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793278734;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received: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:X-CM-TRANSID:X-Coremail-Antispam:
	 X-CM-SenderInfo;
	bh=tQgQ+G0h0FFJlo7h0nDEWPps1fXYqGMjaMK2CkDcgXQ=;
	b=RruYoqTTqwtjPgQYjdtdrMl8ZoPM2PjEAypOG6s0x7bZOaTbxj6h+mzuVcfBBEBCeyZb
	 AqtY0VSRK/GX096it85Qf+wnk9wNLt5/e4GgwdVfTla06QW0RU7qsjE0Wj4k7kZ6wmSU6
	 LNof8s593k4RnR1XAOF+5rf+Pxs+RC9qdZ4hvlnxDkr3WactucJJFIOohD3pnCM05YrE5
	 JdoVa97C8CPaKWTbsrCPg8zV7r3vnbmfEWHtNp1wK+V7mpSFl9BT9MkMTcExy4ibR47cD
	 iIKDPUdMyt4VIpb6vOLaloLjUeWa6UbN8XqWIXVzOk8wJTnKWKVSMfB6HX3L2Tae9dg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b="dxS1O/DH";
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	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 9EADF606A324;
	Thu, 29 Oct 2026 12:58:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=dxS1O/DH
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.3
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793278733;
	b=CnEy2cDWj03AmDj0j45KcOijLl4K7VipnA/ka6i8IF0siSK3VgeU1DYbwTnxu1LizsMn
	 dl4MtCelIQOAU9g9jpPpdT8Wmpa0L54KYEhXkLCBt17RDM2nODb7VBvoY7Ro5uEKt5WsD
	 s+NUVahw2gzFBAWbmFGqFPnqQDaDmhlDkR0GZiOWYfYDtvGdCWldK+S7akXuhBtvp27T3
	 P8r8AcTqnaKl3B47cPMd1rvaujGhsQG+QPH0DLQ54Zv4eO2Tzxxs7rmBcqRoWwfL+yGJd
	 f8FHChQlL3ce0DFO26Xldw6dhlz308xYp5532mwyy+BsxbLj3Uj2zZlcDyeDY4m2Blg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793278733;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam:
	 X-CM-SenderInfo;
	bh=tQgQ+G0h0FFJlo7h0nDEWPps1fXYqGMjaMK2CkDcgXQ=;
	b=tg/wPhLPiDQkWb2CeEI1HxNSS0V/ncD6Std1qf6RAV9/jrg50AG470iJGrjt1CxXuxXp
	 381gpz5hW5X0jowkBARCq3+0BZW5CDyBjcguW0Ao6Ul2tLJe5QrAyguv7d/K0z/d0hhrd
	 r5ZsrGvBL/R6hzdMkxKgHlcnazd8oYfJpLlOYBgo5ofJbYY/8DSFCXA8TaRnRxrzWw4pi
	 U/NwjwGtQd4j6WCD7AT+Ci2NSv8GRBtJOwih6DHC979kaDZ+0UIfuZCvS62+utzsgykaA
	 VSD0zjISsOY605nWp8llMDJGExgeObXpEbPAnmWvASfevvZKzooHwhZGkGkbAlW9Pcg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b="dxS1O/DH";
	arc=none smtp.remote-ip=220.197.31.3
X-Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3])
	(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 6A662606A31D
	for <netdev@vger.kernel.org>; Thu, 29 Oct 2026 12:58:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6A662606A31D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
	s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=tQ
	gQ+G0h0FFJlo7h0nDEWPps1fXYqGMjaMK2CkDcgXQ=; b=dxS1O/DHY0AhcQ7Kgz
	ZdFlmgoMwyIXn5XuHn6nGaSYwoRmI+jstHNOBl03+/DdfjxhcHPwUI36HV+F1qiT
	GtNYAZXHLO52IdzU9kFleQiaqreQ66UFzINtGv1DB1TL9NddwEFZwI8vr2i4YEiD
	yWNl/4EhkFB/7lMQy/QMK62gw=
X-Received: from shaos.localdomain (unknown [])
	by gzsmtp1 (Coremail) with SMTP id PCgvCgAnynXSQuNqnN38CQ--.14706S2;
	Thu, 29 Oct 2026 20:57:55 +0800 (CST)
X-Cc: Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <CAM0EoMnP3VkEV6fOAMdZ9ma9egUpV4AFfB+44k4VD7jx2dHPNA@mail.gmail.com>
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
X-CM-TRANSID: PCgvCgAnynXSQuNqnN38CQ--.14706S2
X-Coremail-Antispam: 1Uf129KBjvJXoW7uw1kZw1DuFWxGrW8Zw1rtFb_yoW8uF18pF
	ZIgw4j9rWkGr12qrs7tw4kJw1rGwsxGa43WFn7Wr4UCF98Ww1FgrW0gwsFgay0kr4rCa4S
	vFs0vrWxJF4UZFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j4uWdUUUUU=
X-CM-SenderInfo: pvkd40jtr6il2tof0z/xtbC8RVZZ2rjQtVHbgAA3t