🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27330

[PATCH net] net/sched: taprio: check the usable txtime window

#27330
From: Dickson Wu via B4 Relay
Date: Sat, 05 Dec 2026 02:18
68 lines
13537 bytes
From: Dickson Wu <dickson.wu@certik.com>

In txtime-assist mode, find_entry_to_transmit() compares a packet's
transmission time with the configured entry interval. A cycle can end
an entry earlier, leaving a window shorter than the packet. The
function still selects that entry, and get_packet_txtime() retries
one cycle at a time while holding the qdisc lock. It never finds a
window that fits.

The search also considers an entry starting exactly at the cycle end,
even though the schedule restarts at its first entry there. Stop the
search at the cycle boundary and compare against the usable window.
A packet that fits no active entry then takes the existing drop path.

An unprivileged user can trigger the lockup in a user and network
namespace with one packet. A peer can trigger it by eliciting a large
reply when the host has such a schedule configured.

A reproducer is available on request.

Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
---
Tested on net e9d78fc6741a in KVM (x86_64), as an unprivileged user in
a user namespace:
- one taprio entry cut short by the cycle time, txtime-assist mode, one
  1400-byte send: base stalls in find_entry_to_transmit() with an RCU
  stall report; patched drops the packet and the guest stays responsive.
- two-entry schedule, large ping from a peer: base stalls; patched
  answers a small ping and drops the large reply.
- equal-cycle controls transmit normally on both kernels.
- tdc taprio tests: same results on both kernels (10 pass, 2 fail
  because CBS is unavailable in the guest, 2 skip).
- W=1 build of sch_taprio.o, no warnings.

A dropped GSO segment is still counted twice in the qdisc drop stats:
taprio_enqueue_segmented() adds a drop after qdisc_drop() already
counted it. That predates this patch (it happens for segments over
max_sdu or longer than every entry) and is left for a separate fix.

This was found and the fix prepared with AI coding tools (OpenAI Codex
agents, with review by Claude). I went over the analysis and the patch
before signing off.

 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 4f69ef3d847a..ee8a8a7022f8 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -364,11 +364,11 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,
 		curr_intv_end = get_interval_end_time(sched, admin, entry,
 						      curr_intv_start);
 
-		if (ktime_after(curr_intv_start, cycle_end))
+		if (!ktime_before(curr_intv_start, cycle_end))
 			break;
 
 		if (!(entry->gate_mask & BIT(tc)) ||
-		    packet_transmit_time > entry->interval)
+		    packet_transmit_time > ktime_sub(curr_intv_end, curr_intv_start))
 			continue;
 
 		txtime = entry->next_txtime;
-- 
2.43.0
Technical Details
Message-ID: <20261205-sched-taprio2-v1-1-09c11317bcad@certik.com>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-nl.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377931-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-nl.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377931-linux-kernel-netdev=dewy.ru
From: devnull+dickson.wu.certik.com@kernel.org (Dickson Wu via B4 Relay)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] net/sched: taprio: check the usable txtime window
Date: Sat, 05 Dec 2026 02:18:00 +0000
Organization: Usenet Network
Message-ID: <20261205-sched-taprio2-v1-1-09c11317bcad@certik.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3006264"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NMKt7dz8Jo9nVkiPdFxjPsbrckE= sha256:3q1MzDCjfEtkky6b2xzwDFJxutOvWR+f8NtHqlwN8oI=
	sha1:jIwPHtKSIZ03RT6s/Xo3d1huvHg= sha256:hEuoq2dBdO/lSX8fCqf9a39Z1LIYSJrdrGEL+5whsi0=
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 871AD117DE2; Sat,  5 Dec 2026 13:25:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.439
X-Spam-Status: No, score=-2.439 tagged_above=-9999 required=6.31
	tests=[DATE_IN_PAST_06_12=1.103, DCC_REPUT_70_89=0.1,
	DKIMWL_WL_HIGH=-0.142, 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 iaUPygYKVoaz;
	Sat,  5 Dec 2026 13:25:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377931-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id B70CC117DDA; Sat,  5 Dec 2026 13:25:40 +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 3B3F43122F; Sat,  5 Dec 2026 10:25:39 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796466339;
	b=AtZLrPYGJz6r+zyMkmIsnvq/HjqghQUP/331Aqeoec8K+tTrv7bISEBh5kp+98/TI+e6
	 x/6AKPU5yoJK3m73WuFJyaSGd75vlOUmNzAFRWuFupXvuYHjnrcM28qjP053a+xVuPuLe
	 tJx5WPQx41K9XOD/rut3irqEs6CxqdTZa0yZP6JLHKG/u8ZuuO55InTSxpvlxHGmO0otw
	 ZDx0P5NQTa5zlyplwtmsi7Z7MgCRjw48Fbf7/TtBBo+qKeEUsjdJQPGZX4Hjsq48UV2S7
	 /WJVVpkYXm+H1fn3CVLrIhzhKqCPa3j1TLIGTtGbort+I4JEjRhtiNbc+5f9wUzydqw==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796466339;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Message-Id:X-B4-Tracking:X-Change-ID:From:Date:Subject:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=nSWv7A/YoN9w2C7y3vT4cfRfG4LgjCZbGxgwogtMup4=;
	b=KXLGMJOyy/NPWdG+jjwqJo7CHGXqkXEyaNY0mGV0k2b1xYIh5sNrU21R8DTKCEsVXngv
	 Bp5sVrqO66MaEmlLqQx+MYlZBeV8zo6/f7D3OZON+o9FedAxrnICI6SwaGZHHYaarsMdH
	 bGSgbF7fzInscu4suQ9RRRknWIDbKrgYbN+431Q0CxBcrccTOJ0pj5l1yBm1J3zEwea+0
	 CT3oGszByJBpDXiOgqds7LUeZWz4MBIVuaQ2oGffBplZe+zXhxA9no/gp4/Rx7Dey1QvD
	 UDds/sxu2qU0ponSmkvg0JcdVq6ZzyMW0ktWPkyDaNe2IhkJNmpxsrt661jUbC/Cnog==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EYE4ECpE;
	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 12194606A335;
	Sat,  5 Dec 2026 10:25:39 +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=EYE4ECpE
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796466338;
	b=xCBJpVcDYeMNcE4Lcs83k9YJSybJeobtutzQ4V2TH3TN/iWe3J8jP6LmRk02C56zYeQq
	 Nm1w8ML4sG7DU7yk4SLOg8AfXnW7dI1WePE64dNsRV7kiaRPWogUwPX39qKM08UwTuRE8
	 BzfLERbfzx5cxIkn+2eQVPpMrDz1O4wbk7qyN6Ry8CuWegARWyYzyVWvUzwBQ5R3ah1Ye
	 Drz/6ocGsm2PwEFz+M2SzDuok4sbCM0UKHDyC1NQxPs3BQpiddncSil3rZEjoecqYw2VW
	 Z37BsAPU6s5zVvG/WDW+iCh6fA970s+yJJJZTWyb0tMv/0ZUua2Vk+4sWRsOE0tEOSw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796466338;
	h=Received:DKIM-Signature:Received:MIME-Version:Content-Type:
	 Message-Id:X-B4-Tracking:X-Change-ID:From:Date:Subject:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=nSWv7A/YoN9w2C7y3vT4cfRfG4LgjCZbGxgwogtMup4=;
	b=ofRCxI0q+gR73yqRWrHMhtRXx/WG5YsIhxyC8/xzt1lnOr7fvLmWY5Dyt8Qtbi4+0yFo
	 Lkzt0cWp6CXAXm9LMyovpC+b9zYLMY/yjJdVZ2lDDxwKrdfnhKTib7Xdou+ar6rW0nk3x
	 3X13mYYB0uBq7EwA2mGk0Hh+8BpT/+eok9sgJWIvopxAh2adHgtgiNrOCT0DEJeHlMEcW
	 73bQKrSxW+H0ZcLIB8CcYiEstcKGd9cZVdKaJKephVhF/duyQb1xdcsNfQ9jiNUygDVJJ
	 uWlTjTTEdquwhU4eLPQhAfzPjzDrkNfpNJhc7eUZb8uUvcfJvEhEpjc4llzxUa0W34g==
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=EYE4ECpE;
	arc=pass header.oldest-pass=0 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 2C652606A322
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 10:25:37 +0000 (UTC)
X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77
X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none;
	t=1796466337;
	b=vH8wubzFpkt85GCZQ2lrbuc4IyFkOKLkWGImZ7yNu4IlVA8VbofsaF2UkQ4LgWKX/6+b
	 T/ditH7PoQMGvbdEcXtlsKYyaEA3ygtSh6LNPhU2tzbCtilrBBVZuDtFG/UbOSXzVS36w
	 RrL946HRzK557oeAAnhjc59Xy1S8Q62RJ1zlRmmyy6VRIEykLyWfCeV7n1A9xZjG7NxQH
	 aKYfca4q89aLslUj2MCnWSxy7HRgPeMoWTfPJS7xiEdPdtlfwh5TugGNhVw+jNa4vn0mv
	 fyXQWABwbsytJbJhVRt1Lx0Gs5i9ojpNYcbDtZpjFaex64iQp5R6hAbEBAv4nsAhFfg==
X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256;
	c=relaxed/relaxed; t=1796466337;
	h=DKIM-Signature:Received:MIME-Version:Content-Type:Message-Id:
	 X-B4-Tracking:X-Change-ID:From:Date:Subject:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=nSWv7A/YoN9w2C7y3vT4cfRfG4LgjCZbGxgwogtMup4=;
	b=wY3REi33knLsSKkKc3OlQ0SoNJ/lw1K8VzZX5x5HjmpwVGeNi6jXC+9vy/+QWZOVFpmA
	 inw/DyE3xYcYCHvo84+HGmBqghoPNJuh9aV2bCRbnNNEcnCmcMwcFjYMi3qn/d9jrU/ja
	 BADo8tAud2y1UO39RscztudzCYeLUMSCtSoMtDKoCgTwcWMtu6lEF+EL3SYa0D41Uspco
	 gBUJm/g9ekQM8rXuGKd10bpHNiJYmPYyhbjdyHZGP/IPgvivSryZkvi8YrdnSdTpP0Kby
	 rYMu35gBjc3BFtuIEcp7jDgM04pSUsM5qAbvdJk8EF4ubhk3aAdvYGFVK/mJIZQyu6Q==
X-ARC-Authentication-Results: i=1; smtp.kernel.org; 
	arc=none smtp.remote-ip=100.80.115.77
X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77])
	(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.kernel.org (Postfix) with ESMTPS id 4612F1F00A07;
	Sat,  5 Dec 2026 10:25:37 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796466337;
	bh=nSWv7A/YoN9w2C7y3vT4cfRfG4LgjCZbGxgwogtMup4=;
	h=From:Date:Subject:To:Cc:Reply-To;
	b=EYE4ECpE2HrogdiIM7mG4KOfIiKwTACZS2crIrK8hWO8phqHbnleQ1iJn+q8pWXTf
	 0CBK2GLg2eoGrPKJDrvxoHygW00i1NNwjBThHrsBeni7tXSLtLwvjdZKhxDZ2As/VC
	 tDbZFl2mT1DUZHeKT6Ue73M/oRIDGwz++MHHcpe39U6+GG0CkJYGHHcLK5U1XRiA7z
	 aZy9FAk0c5LhOcIi2l+2GAyNgRQ/E8gqZHlMLS+wLxvPFQ/yfuRFGwznDoWJZ0ONFb
	 RUTxDmHEu+VXMuwJR5HoMwAxwI7LYCYxs3FRZGu5Z2qyCYiU5no4RheWW6lca3gvly
	 gLYOue2bdibAw==
X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1])
	by lkml.kernel.org (Postfix) with ESMTP id CE98A5026D;
	Sat,  5 Dec 2026 10:25:36 +0000 (UTC)
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-B4-Tracking: v=1; b=H4sIAMjlE2sC/yWM0QrCMBAEf6Xcs4EmVkF/RXy4JKs9kaTkogil/
 26ijzPszkqKIlA6DysVvEUlpwZ2N1CYOd1hJDYmN7qjdePBaJgRTeWlSHaGLU4+Wt5PmKh9loK
 bfH69CyVUuv6lvvwDofZSn3lWGF84hbkrRYo156fpnrbtCxWzRueWAAAA
X-Change-ID: 20261205-sched-taprio2-a1e9bd1a34e4
X-Cc: vinicius.gomes@intel.com, jhs@mojatatu.com, jiri@resnulli.us, 
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, 
 pabeni@redhat.com, willemb@google.com, horms@kernel.org, 
 vedang.patel@intel.com
X-Mailer: b4 0.16.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1796466120; l=2882;
 i=dickson.wu@certik.com; s=dickson-b4; h=from:subject:message-id;
 bh=h0bki+YXa1Zf/sebrIZBidEvykQn62wscKICGl2rAPk=;
 b=7hJieCNjv6Utq0Ro1TGqWrEPWzityC7Tjl59kT2b5ACAW58wS4C6aiNYsqnoif2pDjVQEQWxF
 jNr/wH9W8KCBAEmjUb8xjxZSs+xtTdBzwQQ1YUvXb/SH1WFDIr4oVsx
X-Developer-Key: i=dickson.wu@certik.com; a=ed25519;
 pk=fxH7FS4FdojeJSGLJzgKdfO51Rvr4EW30yinj2mc1vg=
X-Endpoint-Received: by B4 Relay for dickson.wu@certik.com/dickson-b4 with
 auth_id=1647
X-Original-From: Dickson Wu <dickson.wu@certik.com>
X-Reply-To: dickson.wu@certik.com