🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10584

[PATCH] net/sched: hfsc: clear eligible node on reset

#10584
From: shaos
Date: Tue, 03 Nov 2026 17:38
106 lines
12507 bytes
Hello,

hfsc_reset_class() clears the realtime class counters but leaves its
el_node marked as linked.  hfsc_reset_qdisc() then discards the
scheduler-wide eligible tree by assigning RB_ROOT.  After a link
reset with an RSC class backlogged, the next packet sees the stale
non-empty el_node, skips init_ed(), and leaves the class absent from the
new eligible tree.  HFSC then retains the packet in its child qdisc
without a dequeue event or watchdog recovery.

Two fresh QEMU runs reproduced a permanently queued packet after
link down/up.  An FSC-only class, a drained-queue reset, and a no-reset
control transmitted normally.  A kernel with the patch below reported
RESULT=NOT_STUCK and transmitted the packet.  This requires control of
the HFSC qdisc and is a scheduler liveness/correctness defect; no memory
corruption or privilege escalation was observed.

HEAD commit:    c03c1a14507dfaf8b856c2608f9ac216021fc222
Git tree:       30fd2ef82912c26cf3a58ad0ba6afc375fa851ac
Source version: Linux 7.3
Compiler:       gcc 11.4.0, GNU ld 2.38

The console logs, full kernel config, packet sender, and QEMU/initramfs
harness are available from one fixed-revision Gist:

Console output:
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/console-output.txt
Kernel config:
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/kernel-config.txt
PoC source:
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/poc.c
Harness: hfsc_reset_harness.sh
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/hfsc_reset_harness.sh
Harness: init.sh
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/init.sh
Harness: mkinitramfs.sh
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/mkinitramfs.sh
Harness: run-qemu.sh
https://gist.githubusercontent.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268/raw/6344f32527074498da61f02b58068539859b388e/run-qemu.sh

Clone the Gist and build the vulnerable kernel and initramfs.  The
kernel source is the HEAD commit above; use the attached full config.
The host needs gcc, fakeroot, cpio, gzip, BusyBox, iproute2, and QEMU:

    git clone \
      https://gist.github.com/shaos26/d7ec57d3a631368bd50ad0182ce9c268.git \
      hfsc-repro
    cd hfsc-repro
    TMP=/tmp/hfsc-repro-build
    mkdir -p "$TMP/rootfs"
    git clone \
      https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git \
      linux
    git -C linux checkout c03c1a14507dfaf8b856c2608f9ac216021fc222
    cp kernel-config.txt linux/.config
    make -C linux olddefconfig
    make -C linux -j"$(nproc)" bzImage
    mkdir -p poc
    mv hfsc_reset_harness.sh init.sh mkinitramfs.sh run-qemu.sh poc/
    cc -O2 -static -Wall -Wextra -Werror -o poc/hfsc_probe poc.c
    fakeroot -- sh poc/mkinitramfs.sh "$TMP/rootfs" "$TMP/initramfs.cpio.gz"

Run the positive and close controls on fresh QEMU boots:

    KERNEL="$PWD/linux/arch/x86/boot/bzImage" \
    INITRD="$TMP/initramfs.cpio.gz" OUT="$TMP/rt-reset.log" \
    sh poc/run-qemu.sh rt-reset
    KERNEL="$PWD/linux/arch/x86/boot/bzImage" \
    INITRD="$TMP/initramfs.cpio.gz" OUT="$TMP/ls-reset.log" \
    sh poc/run-qemu.sh ls-reset
    KERNEL="$PWD/linux/arch/x86/boot/bzImage" \
    INITRD="$TMP/initramfs.cpio.gz" OUT="$TMP/rt-drained-reset.log" \
    sh poc/run-qemu.sh rt-drained-reset
    KERNEL="$PWD/linux/arch/x86/boot/bzImage" \
    INITRD="$TMP/initramfs.cpio.gz" OUT="$TMP/rt-noreset.log" \
    sh poc/run-qemu.sh rt-noreset

The positive prints RESULT=STUCK.  Controls print RESULT=CONTROL_PASS.
For the fixed-kernel mechanism control, rebuild from the patched source;
rt-reset then prints RESULT=NOT_STUCK.  The guest configures a qdisc and
sends AF_PACKET frames, so it runs as root in QEMU.  A direct trigger
requires CAP_NET_ADMIN and CAP_NET_RAW.

The eligible-node marker must be cleared when the class scheduler state
is reset:

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: shaos <shawnq1@163.com>
---
 net/sched/sch_hfsc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1488,6 +1488,7 @@ static void hfsc_reset_class(struct hfsc_class *cl)
 	cl->cl_myf          = 0;
 	cl->cl_cfmin        = 0;
 	cl->cl_nactive      = 0;
+	RB_CLEAR_NODE(&cl->el_node);
 
 	cl->vt_tree = RB_ROOT;
 	cl->cf_tree = RB_ROOT;
-- 
2.34.1
Technical Details
Message-ID: <6AEA1C23.11E1A6.00008@m16.mail.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-355874-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-355874-linux-kernel-netdev=dewy.ru
From: shawnq1@163.com (shaos)
Newsgroups: linux.kernel.netdev
Subject: [PATCH] net/sched: hfsc: clear eligible node on reset
Date: Wed, 4 Nov 2026 01:38:44 +0800 (CST)
Organization: Usenet Network
Message-ID: <6AEA1C23.11E1A6.00008@m16.mail.163.com>
Injection-Info: usenet.network;
	logging-data="3237046"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:X0jT+MNd9nD8RhCamozA6NzQxd8= sha256:BQvRwii3e3FilgvjhP4SR680tdcsNIFuHKeK33J1LVY=
	sha1:JMASxuWr918Nb+cDvJODjVS3dw4= sha256:aHwPY88wH5103bn6iB9J8iX3lRWHk9RSVnKT0SKmp3o=
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 3AFA91129B3; Tue,  3 Nov 2026 21:58:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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.249,
	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 (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 99Dtt5dHk9ZM;
	Tue,  3 Nov 2026 21:58:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-355874-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0EA1B1129AF; Tue,  3 Nov 2026 21:58:09 +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 613443B47C; Tue,  3 Nov 2026 17:39:05 +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=1793727542;
	b=mHQZv9rVr1KbiUXarrE3dF6uLXz5qnR3y6vOCl3dR4nIvPVZzTeVy+12pzsuumeCW2mn
	 WCmeEjuQ9kqZGXO5Lt9vHD2aEnPQqLxxbWSmXZ2C7BFjLzRCh0MXFs+sxzFVIs9Rf5BGp
	 gHHBCtDkclXTJ/fMv9lH/3Audbtw5BdcZRk5K/p01UZpYpG3dVgyEXn2qqyFEWKaxSEbt
	 l0EVYpY33JDEjzxLuC1ymYfbQtT6q+CzKD3EoyFs+xAcDGHAQ/epe6+TCYM1DcWO3Apn/
	 t1J1AGLY5c3o43geNPYm1JXaR6602+YZsYlXR9kBQgn2lXG4wrFN1pWrwppVeSkOb4w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793727542;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:From:To:Cc:
	 Subject:X-CM-TRANSID:Message-Id:X-Coremail-Antispam:Date:
	 X-CM-SenderInfo:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence;
	bh=NCGelH99NdIiK+XLBUHLsPdudRNaMO0Y3JYjrjdoWyc=;
	b=A29LjeiBAGSz19YHkxRutZA4t7uF+e2IVDGEAsuEsypQGzgUwl1cXmDnU3pQX/VqBcGi
	 oAnroD7ha/Gj4EygwCpqLmG1H6iORGFndwva/yO0nQpcqdLh1EEnJIyxF6DkRkqQY65Si
	 9Qlp+LwjrkBL6exibSiYRWWrbV4YRoYYg13rFMI3Et+GlbfKn2JhUQhvIABFg7TGf78Wc
	 sk0PAvENCv9b86jyEfzyTgQDp/V+5AiBq1P3TeztBvwohgejC2wEba2nTWAxjHQlPdiLu
	 QyfNc1ziGlZS4bj4wWTQE9KWvUzXp+Vi6GD6GwMIHoNgzQVlQtI27fZ/U9OZpKKQyZg==
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=KnGgVeaA;
	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 62D3B606A33F;
	Tue,  3 Nov 2026 17:39:02 +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=KnGgVeaA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.3
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793727541;
	b=KbC5ABiN6r41WT76r3dfQwO13g4VA99KLoZYT32/n/z+CKwOj5bRakTIZaYU+nV018Ti
	 txkOGaeE6W4NBpRF0tus2RKtpOd1SDO3oW0RiBS3PiSA/mkat+TzGv59WGPqYJIrmlf3v
	 p3/YOgrK0i9BEoxA/TjW/cAGreGmQeiUl/ismiAfDIrK5tB6jmt4t9tI6RnEllQli7KQ5
	 euhZ/aKZBune6t4hFKiZpc67dEKNsxg6AJ2F7dAHeGIfpqA77+DkeMtxGrlj7saVz1Ro9
	 gq9QWpAzcTL5UO76+M73s7g6K1GTIOrr+K0Qp6xyhpFPUESgxrdea1shVy27TbsyfMg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793727541;
	h=DMARC-Filter:DKIM-Signature:From:To:Cc:Subject:X-CM-TRANSID:
	 Message-Id:X-Coremail-Antispam:Date:X-CM-SenderInfo;
	bh=NCGelH99NdIiK+XLBUHLsPdudRNaMO0Y3JYjrjdoWyc=;
	b=KnGIkASKQnmntw8pEeHydeW+WPLpDCVLTR3PIQkh9h8coejUpqLGqcX7QpEGVhlVRvOy
	 YVJMkpRhZc1CrhYxMjzCzvUOf/CydQL3tzMA41lNOtafK6aO7IrrCacSwA6Jhyo1N3CQz
	 YZhoblqDuiXuNZhZrjV1Lud9bdeAg0iuP/YXcTXWfQ6H+rnBueo8fqi2jojELBh46ogHx
	 wyBeu/bcnYdsRb8HGe86zergh5nog4e9CKdOYQi1OUPoWr8bp558fttCoZstCUV1JtjUR
	 Udblbq/xoeVfZtZb79WtGUl4VJU9E9dakd/qbrwQaosVZDObThmYCxPBA82N2qpj9Cg==
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=KnGgVeaA;
	arc=none smtp.remote-ip=117.135.210.3
X-Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.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 B646A606A32E;
	Tue,  3 Nov 2026 17:38:58 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B646A606A32E
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:Message-Id:Date; bh=NCGelH99NdIiK+X
	LBUHLsPdudRNaMO0Y3JYjrjdoWyc=; b=KnGgVeaAbocLq2Zn8K8pVYwr4p451Y1
	FqxUWNDvnTyAAmnFnvQVrTUsH0HFZin1wIyB4/IgrUd7Yp/cNe55s3blJfp0uSR6
	f86xTYwO8lAOydj7m5X8ny5pl2XXy1dx990QMu0XahBYDxDbkUCaHwMblgokvjBN
	uxH2sPEshB40=
X-Cc: Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-CM-TRANSID: _____wDXv6UjHOpqVNNREw--.49754S2
X-Coremail-Antispam: 1Uf129KBjvJXoWxZF4kZw43Xr4DWr4DKrykKrg_yoW7Jw4xpr
	Wv9r15KayYga15Ja1vkFyUZFy8Zas3AFs8WF1kWws7Z347uw1IqrWxCryjkr90grWkCayF
	vr4jqw1Iq3yjqaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jrjjgUUUUU=
X-CM-SenderInfo: pvkd40jtr6il2tof0z/xtbCzwNkcmrqHCP7QAAA3e
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