🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6493

[BUG] net/sched: DualPI2 memory accounting underflows after TBF peek

#6493
From: shaos
Date: Thu, 22 Oct 2026 14:47
29 lines
10170 bytes
Hello,

A TBF parent peeks a DualPI2 child packet, causing DualPI2 to subtract its truesize while parking it in gso_skb. Reducing the DualPI2 memory limit drains the parked skb and subtracts its truesize again, wrapping the u32 memory_used counter.

HEAD commit:    c03c1a14507dfaf8b856c2608f9ac216021fc222
git tree:       30fd2ef82912c26cf3a58ad0ba6afc375fa851ac
source version: Linux 7.3.0, local master
compiler:       gcc 11.4.0, GNU ld 2.38

console output:
https://gist.githubusercontent.com/shaos26/6f3e3d3667401ad3325959e321928400/raw/c50aae5c021dee0b3ab97e76d260da585d1fde98/console-output.txt
kernel config:
https://gist.githubusercontent.com/shaos26/6f3e3d3667401ad3325959e321928400/raw/6b13332e308ed8ce37b28ea2d7c8fb50265a8b88/kernel-config.txt
reproducer:
https://gist.githubusercontent.com/shaos26/6f3e3d3667401ad3325959e321928400/raw/937e24e9b0dcfcd847a80e74ad2707f6b4781030/poc.c
auxiliary reproducer (init):
https://gist.githubusercontent.com/shaos26/6f3e3d3667401ad3325959e321928400/raw/17fb0deae08ba739b9e044cfd6c93be24eff2e6e/init

Build the tested kernel with the attached configuration and CONFIG_NET_SCH_DUALPI2 and CONFIG_NET_SCH_TBF enabled. Run poc.c as a static /init in the attached minimal initramfs inside disposable QEMU; the test creates a user/network namespace and reports the counter through rtnetlink.

Impact and prerequisites:
After the rejected/in-progress accounting state wraps, packets continue to fail with ENOBUFS even after restoring the original memory limit; replacing the qdisc is required. The test is reachable by a caller with CAP_NET_ADMIN in a user-created network namespace and is a namespace-local availability issue.

Validation: Two exact-revision fresh boots reproduced the same counter wrap and persistent enqueue failures; no-drain and close accounting controls passed.

Thanks,

shaos
Technical Details
Message-ID: <20261022144758.65248-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-350622-linux-kernel-netdev=dewy.ru

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-350622-linux-kernel-netdev=dewy.ru
From: shawnq1@163.com (shaos)
Newsgroups: linux.kernel.netdev
Subject: [BUG] net/sched: DualPI2 memory accounting underflows after TBF peek
Date: Thu, 22 Oct 2026 14:47:58 +0000
Organization: Usenet Network
Message-ID: <20261022144758.65248-1-shawnq1@163.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="241795"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BrQQ4x8fPF71O/JcC/5osBPR6O4= sha256:HGwfWY+JEqGMW4aI8tQ7D8PEXM5sTJK+mILqSq0vsNU=
	sha1:/zOWKnslXbndLVnShcbhmjlDjhE= sha256:bqiWz5J9SZMPPGU6o2Tk/adojwsO68JssrMGXZt+lLQ=
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 484A01112CC; Thu, 22 Oct 2026 18:15:55 +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 LCO1BlnlvU8b;
	Thu, 22 Oct 2026 18:15:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-350622-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 520D311129C; Thu, 22 Oct 2026 18:15:39 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 58DE024AB4; Thu, 22 Oct 2026 14:50:13 +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=1792680536;
	b=zsfLVja97Ylk1N7ahIzVh+9Zs7VabgEW8aKoEiLp0/l5qygIkvs/6AedSaEf8UxQ4dxz
	 4wsPtfHJLcuyPTPmAGyK/LOQ5f7zZHmcC5TgvoA3urzg2tsNNqusaM0Fodo/C96oDxkaW
	 dlM9I+md4vROuRsGznCa/M2ONOdexi8edsnI+m6R3eXtLj2Up3FsskkEl5W4ABtjOlKCf
	 7DdRuAPN7ZpjAQHH1w6fogcKjU5IiIW8tcpQVCovUFVN6wuNnlTLQUYHxxW6bl6NKVoJQ
	 xMkdqthVhEmB8iZVoINIkfkSDV4UHR4MUTfFZdNO5U3ps62IzjoYxqOmgvm0OxwykWw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792680536;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To:
	 Cc:Subject:Date:Message-Id:X-Mailer: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=Cf99JJBQHA8reXbSZeA4i7nmGdCSdeC8pjhp03xP1tM=;
	b=vs/gKqkXTjPIIj0irmprftEzRBNJ0a2u+86gm0CeyWLGYxwqAI4oPF+CZ2TRtiWQxRGX
	 OgI7SC1npkoRCfsFVKuR/SO1bFLA16GM2zfewgvR9VUOgZ1D2NXL51iJmCwK8tV0ixRze
	 C2K2IY0udnMC3nbmSwoC4QqwveWMyCI2LfWK2GSibC0Ki6KFuGPxuJKhbSq4oI3zxrXLe
	 fNGrVxrUA8MLL+9mZ8J3shQnP7rH5Z+HfE9vW93pwhVAM9Lu0sYkL1ldQPBsJC1w6DYlV
	 2ATV4LpHLAMY5dnzv1KrIQ+uE67CRuNZTQmqkg/yRrLsWnsVgLPpFDjandS1DofQbqw==
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=i5q9b8eS;
	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 478AA60A262E;
	Thu, 22 Oct 2026 14:48:51 +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=i5q9b8eS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.4
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792680520;
	b=b/E+37EfYkBHJkVh+aikQ11JePKieSBvorzCFZiGt8sFVhtek6S402iVuqVPSgKwR7Tt
	 2U7vRG1ElUbkPmo1CkVn6569DVYTj7u22mVqU2WIde7ewP+sSkqppZKNyUZ+CHP+Kv9hs
	 9j2Q2VWbTc340iSpUOL5FVVf5kqQM2W7EuR05TdDbNTLOzHx3kXzHnQFmeUjL6fAX5JkL
	 pIJFECbJzFQ225Ln2U1sUq4Ym2swOeM8LDg2BtSbNTXtdW94ADTqnUeW44Pj0xNb2Cltg
	 EyxRoGNuig3oRw0azn8LL9E5fz+5csKqdDtBoB/s4DMP8LYFVMhbUfl/LhnZpn2O2kA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792680520;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
	bh=Cf99JJBQHA8reXbSZeA4i7nmGdCSdeC8pjhp03xP1tM=;
	b=c6CS3h/GHx0saxsRNVBZO5nbNcMt6AEotuvBrCgn/GuEfbV3G6od0E9XA2C/2qmtw0xY
	 mDVmARQykxuqU9qcu5tIZSU698v8p6E5iJ1FaoWGCDQ6PDaV1EMPNcjoaGPHq1+s/hFu0
	 xECM9+bBe2atTb1hANjDrsRwGB7ELGAr6aDRU7eF70B2hmI7WgrWSApqbmAJAHgYkqiA+
	 lB8G4CWlPe8tXmwGu54KE94BvQKhN8yKH9YQvGOJqx7f9DWIa/QQaFiT+DufU4Mc0LRYv
	 tslTHp50jumaPEbSG0P5BzBK3Yuml12NdvEuN4u6dFoRn2tkYNtkdI1P+CRVOdMLpYQ==
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=i5q9b8eS;
	arc=none smtp.remote-ip=220.197.31.4
X-Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4])
	(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 474EF60A3831;
	Thu, 22 Oct 2026 14:48:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 474EF60A3831
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=Cf
	99JJBQHA8reXbSZeA4i7nmGdCSdeC8pjhp03xP1tM=; b=i5q9b8eS/78aa99uuB
	CULXrRmoRDKJQPh2oE1vH2IjkMyPMChbgb3iJOZXAunxA2c80rKmvOe44EXEQNDG
	3C96MXyY7CDnXgHy3vTOSAN4Uoc/2GpG/iX08xc6QTP9y8YKF3gJ38t/WVpvc7Cn
	NMoYseZ/9aSPrHlGiCApe/E+0=
X-Received: from shaos.localdomain (unknown [])
	by gzga-smtp-mtada-g0-3 (Coremail) with SMTP id _____wDn31ceItpqHPYSCA--.13546S2;
	Thu, 22 Oct 2026 22:47:59 +0800 (CST)
X-Cc: Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.34.1
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: _____wDn31ceItpqHPYSCA--.13546S2
X-Coremail-Antispam: 1Uf129KBjvJXoW7uw1fKFW3AryUJF1UWFyUKFg_yoW8ZF13pF
	9ay3yakw1YgFs5JF4vkFWxXwnYg395C3y5Gas5Xr18ua1rGw18ArWxKayYvF1xZr4kXa4r
	ZFZF9a40vr4jkF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07josjbUUUUU=
X-CM-SenderInfo: pvkd40jtr6il2tof0z/xtbC0B-g7mraIh-dOgAA3r