Article View: linux.kernel.netdev
Article #27287[PATCH net] net/sched: reject goto-chain actions bound across blocks
From: Dickson Wu via B4 Relay
Date: Sat, 05 Dec 2026 05:52
Date: Sat, 05 Dec 2026 05:52
64 lines
12867 bytes
12867 bytes
From: Dickson Wu <dickson.wu@certik.com>
A goto-chain action resolves its target in the block of the filter
that creates it. A filter in a different block can bind the same
action by index. The action init path returns ACT_P_BOUND before
checking the control action, so the second filter executes the
foreign block's classifiers. Classful qdiscs then interpret a
foreign class pointer as one of their own.
An unprivileged user in a user and network namespace can trigger
a kernel crash or a use-after-free write when the qdiscs are removed.
Reject a bound action whose goto chain belongs to another block and
release the attempted bind. The check covers every action kind that
can carry a goto chain.
A reproducer is available on request.
Fixes: db50514f9a9c ("net: sched: add termination action to allow goto chain")
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:
- base: the cross-block DRR-to-HTB bind panics in htb_enqueue(), and
DRR-to-DRR reports list_del corruption with DEBUG_LIST and
slub_debug. Patched: tc rejects both binds with the extack message.
- a same-block goto-chain bind works on both kernels.
- tdc gact, HTB and DRR tests: 43 passes on both kernels.
- W=1 build of act_api.o (x86_64 and allmodconfig), no warnings.
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/act_api.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index e142d33dc5ef..2183c6b03d87 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1465,6 +1465,22 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
}
if (err < 0)
goto err_out;
+ if (err == ACT_P_BOUND && tp) {
+ struct tcf_chain *goto_ch;
+ bool foreign;
+
+ rcu_read_lock();
+ goto_ch = rcu_dereference(a->goto_chain);
+ foreign = goto_ch && goto_ch->block != tp->chain->block;
+ rcu_read_unlock();
+ if (foreign) {
+ NL_SET_ERR_MSG(extack,
+ "Action's goto chain belongs to another block");
+ tcf_idr_release(a, true);
+ err = -EINVAL;
+ goto err_out;
+ }
+ }
*init_res = err;
if (!police && tb[TCA_ACT_COOKIE])
Technical Details
Message-ID:
<20261205-sched-gotochain-v1-1-8dfa711bdb93@certik.com>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377875-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377875-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: reject goto-chain actions bound across blocks Date: Sat, 05 Dec 2026 05:52:41 +0000 Organization: Usenet Network Message-ID: <20261205-sched-gotochain-v1-1-8dfa711bdb93@certik.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2983127"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OJUJMj0QTSrzOxdUVA5YZ4K9R6A= sha256:GjDdc/pGRnLH9uhSFLC3pnDz0kk+mQI1bc/49wl6VBw= sha1:595kRQ3E70aYfHv8PYTD9PyDUNo= sha256:dwgwid93lW4dJuFo385LFA7u7o7MPYzoG5UsRn7+kvI= 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 1ACFC117D4A; Sat, 5 Dec 2026 11:12:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.542 X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31 tests=[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 W8mocPB94aNy; Sat, 5 Dec 2026 11:12:00 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377875-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 0EE4B117D7C; Sat, 5 Dec 2026 11:11:51 +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 4CB553331F; Sat, 5 Dec 2026 08:11:48 +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=1796458308; b=QJT3hWz+ky2iYJ/JdD0zikDwfkuXpIdtAeWbRBhQfJKX1tCPR8sZQVGKRvK9JHyR68U9 0d+0nLEeQPdn4aBkQp26Hu80UrTFoWt9sLSVDF+hhz4TlsNDrhuoyXb7d4PzqA3Zhv5zz nMT/9jnHKfG0tiJVWWoFbTjfLjvnmaADJS1GRcvL02gboWSyP6V1s1EsIQqkyzXE5inzw 2k3CEyfm5eXagmmbvz0dYNl7gyLrPZF0qkYjZv062ncT8MM8mYzbL2JUOHFmoBa6929ko UB6ILYhVP7Q2pMVohDnEKN9CsZO7ubmH0Wzcrnvuh7OpPRkE6RHSiwOaxgjSfuu2JUA== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796458308; 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=CAxd67pifDW2+icQJ2LD7znyaXV9O7y4Nv4HpLh8law=; b=UIsYvY4O/Of5lbKPdAaKaD1ZMSfDX8U7vWbNsSPhWR7wy4PxDqYupbsKaVx98U9gNIPB TiOqR1+HglGJ36rxOzu7TM7zVtl2Q3xsUqaioSjn7Wsrie0Ink9ItW1WKHgeaLwnBfEPV GLMjOEApTjqOwytp7kKCNC0bkTRF+xoCDNgxVUIBwXXcrAhzybuVuULzbC6h3kNbDY7QD vY7KLTMgj+FiJgyiuyEKC+514+5kRc5hPm91lqUUq2x24tOOD60tDKZPa/BAWzaGF4+aq pVvIQKkvaAHvnHivwWxNpEg5QuDXe0ZqR0s7jaqp/w5ysOwZaY/tvopiCIo3TdWgf8A== 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=TCI+AmR4; 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 1DAAA606A335; Sat, 5 Dec 2026 08:11:48 +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=TCI+AmR4 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=1796458307; b=GDUgu0sbtJxQ5/6fFK7fbg742TZRSdmzQwnG9ntCvXBgGLejvvBpQ6h2rgox4I1Iz9gY UNuLYlIU80cjYXo2lOd2hX26OB9otMeDgIQYw/sF20jSBdJ13MVZvo/Gr88vHNjpYqr83 gjU6qo/iCgseLMgqU1M5EzkIU2rq5Y2noRfpXaqF5GkaRe7F6+w2AlcQ4mMh5r2J9fYk+ P/8Hib5WKGqZ7la2v0K1aBD9n06L2hKAOwc0/jbnjCqx3mpBfWb3ZZFv9WlUcqSb1U9R9 SL5e5RMshLT1CsKcPrGyTKAWZuW/UiUYNiIo7gSymsuDDxS5K2OF/uSoSLLgVoqKmbA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796458307; 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=CAxd67pifDW2+icQJ2LD7znyaXV9O7y4Nv4HpLh8law=; b=3wcu4o3TfADEVYwNQqmprFrj9QdXO14ugy3NTo7YHsLA+s/XwKhw/9nB/aCsAqCrPmPm NQvsFaCn2zSWAJiKvhTy0N8bjgpA5tNoQ7I3AL4bJAekAS99a7409xR7dPh6/zFk7UNrc PfxQFFZz+bLKjgmFTyAhJxVHTZAEpnGAuvWZQ7T0lifcBHB/2qdlakXwrnxFg7+mGui2Z 6B7fJwH8e44CGtjjIfZNPSrhlpuTTFmt5syaVbdlf1zsuMuadaC8jknZ5zPW7LuOYSCuS b+u7CGlJuJujGwCehiBUYy4OtJHsKMjVs18z1sirASvCKJCklUR/RvQJetsJSPnLnzQ== 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=TCI+AmR4; 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 38E82606A322 for <netdev@vger.kernel.org>; Sat, 5 Dec 2026 08:11:47 +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=1796458306; b=KOUJAi+Om0tKOBhFRR8OfCinutkJWtCacQrgnCqoUDWwvs/jfRijLUXyOoOWEj3Q/vFm xlMxUJDmJ5zR5GLjXEFNucuI15eGPShFFhTh7YC/1SA3n/Yky1hcsuJCRAiV99UxXeC59 Y2Gnvdk5LeWuBh5yeRQG8lWo3XQRTDmERR62k5QJnaKBl8rEAY4F8Fmc0CdiWgf/n+z65 8yTdlehPL26Js3EQ/hevQ9Cq0doHccbqMwEgPX7Z30rDFc/vHu7K+y07jxCuhRs7FdSBN dk7/QCd/dpKujNV7BfSPTRBHyXqIaJk15MUgAo+L3wTyn5ZbP0CcMkFykn/vQctWICg== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796458306; 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=CAxd67pifDW2+icQJ2LD7znyaXV9O7y4Nv4HpLh8law=; b=AiPP60DVDAXHrcyCJW/dHOgKXDbWLCtmxSSOvZIU0Zbzer6MgDHzwhtJfdBM7i6rY0c9 tQXAih9GnT0lcMgCcZBPSSvtrQXI//KMvISDqJHoijICvABv+hOhp/JjtOnki8PkoHtJc 1Q3/2ZjKXY29Z067RzXZvQKm0xvM5jVWSuLlKXF80j8W6dNlOlCiaRQUpMyPTbV91twRY 4Q+DlxrQlR+mbzduk3BixuyPRHcTZDudqwk1zvUCYfr4a9TnZ6SgTdmOD1b++7YvJ16Vb 0MVItntLYD9mTCDg6dYK8FAFbq9BWacyvVzepiEwi8IuE0Pieol1ollDvJHk6pRfrSg== 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 6E2AB1F00936; Sat, 5 Dec 2026 08:11:46 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796458306; bh=CAxd67pifDW2+icQJ2LD7znyaXV9O7y4Nv4HpLh8law=; h=From:Date:Subject:To:Cc:Reply-To; b=TCI+AmR4A0ikMl1znkfjWHDEC+PcJoXDC+zT28p9kDgV5hiH3ALXHPgn9zbUTFI2a CA6sARNPoxANZMHG8q4JZiXeyDvRtGx0ovMsWukAu1O344W97nMqnwsE+R1QyNffqY nDgddaFnHbqp0ySl0pe/2lkxRDZLWkiSMiaWZvFSDCfGeDtRuly956WwOW4iQlGPKg C2HAWT5hq3ObE1zxMtKhp5aajrPNw7yRw+jsljSHm4Ybbq9BjNaLLKqFU6cM60U404 ZEI2t3qxgOWcdLeXqWYGt0TC+lznR10jpbYw91mJYudtBLUGVYXT8NoiRlPzEkF1ql DAgpr7dS+9QPQ== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 00E9950137; Sat, 5 Dec 2026 08:11:46 +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=H4sIAH7DE2sC/yWMwQrCMBBEf6Xs2YUkYin+inhokm2zIhvJpiKU/ ruJHufNzNtBqTApXIcdCr1ZOUsL9jRASLOshBxbBmfcaJ25oIZEEddcc+tZ8EzTEqOZ7OgJ2ut VaOHPz3gDoQr3P9TNPyjU7uozPyuhL7OE1JGSxJrzEzuH4/gCLm5LhJgAAAA= X-Change-ID: 20261205-sched-gotochain-3e8fdd0816be X-Cc: jhs@mojatatu.com, jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796457342; l=2354; i=dickson.wu@certik.com; s=dickson-b4; h=from:subject:message-id; bh=Z27XTZICRwMboDLJI9FBcQtnFzIvgYuxiDmF4/ydZXI=; b=RK013noKp4qspmB1DFfibhBrbofoWiwVkZpMh7jLBprYhj+uRVvSvdDbV3quoDz3lTtPDmH+k G5G511By+S3C0Wt4fsA3p86nb8geCE7ZFD39EIF2HNdeFLMyS5qwmCj 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