Article View: linux.kernel.netdev
Article #10001Re: [PATCH net v2 3/4] net/sched: sch_teql: reject qdiscs from another network namespace
From: netdev-bot+sashiko
Date: Tue, 03 Nov 2026 00:40
Date: Tue, 03 Nov 2026 00:40
142 lines
13143 bytes
13143 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The fix only enforces the master/slave same-netns rule once,
when a slave attaches.
- [Low] After this patch, tc-testing case 124e ("Try to add teql as a
child qdisc", tools/testing/selftests/tc-testing/tc-…
--
net/sched: sch_teql: reject qdiscs from another network namespace
With this patch, teql_qdisc_init() rejects a teql slave qdisc whose
device is in a different network namespace from the teql master. It
returns -EOPNOTSUPP and sets an extack message. It also moves
skb_queue_head_init() ahead of all validation, so every constructor
failure path sees an initialized queue.
Link: https://lore.kernel.org/netdev/20261022144830.67948-1-shawnq1@163.com/
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v1.r2.20261031160050-3%40mojatatu.com
> diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
> index 70c948a26f809..dc21cd9704a25 100644
> --- a/net/sched/sch_teql.c
> +++ b/net/sched/sch_teql.c
[ ... ]
> @@ -211,9 +213,12 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt,
> return -EOPNOTSUPP;
> }
>
> - q->m = m;
> + if (dev_net(dev) != dev_net(m->dev)) {
> + NL_SET_ERR_MSG_MOD(extack, "teql master is in a different network namespace");
> + return -EOPNOTSUPP;
> + }
[Severity: Medium]
This checks the namespace only once, when the slave attaches. What keeps
the master and its slaves in the same namespace after that?
teql_master_setup() does not set dev->netns_immutable, and sch_teql does
not register a netdevice notifier. So the master can still be moved with
"ip link set teql0 netns X". __dev_change_net_namespace() only refuses
the move when netns_immutable is set, and it only shuts down the device
being moved:
net/core/dev.c:__dev_change_net_namespace() {
...
if (dev->netns_immutable) {
NL_SET_ERR_MSG(extack, "The interface netns is immutable");
goto out;
}
...
dev_shutdown(dev);
...
}
The slave qdiscs sit on other net_devices, so teql_destroy() never runs
for them. m->slaves and NEXT_SLAVE() still point at devices in the old
namespace.
After the move, teql_master_open() takes its MTU and flags from those
slaves and teql_master_mtu() checks against them. teql_master_xmit()
also sends the master's traffic through them:
teql_master_xmit()
struct net_device *slave = qdisc_dev(q);
...
Doesn't that bring back the cross-netns master/slave state this patch
is trying to remove?
There is also a way back into init_net. teql0 has no rtnl_link_ops, so
when its netns is destroyed, default_device_exit_net() moves it back to
init_net:
err = dev_change_net_namespace(dev, &init_net, fb_name);
Suppose root gives teql0 to a container netns B. The container could
attach a slave in B, move teql0 to another netns C that it owns, and
then delete C. teql0 would end up in init_net with a slave on a
container-controlled device in B. That looks like the case the commit
message describes.
The first move out of init_net needs CAP_NET_ADMIN in init_net, so this
patch does close the unprivileged reproducer in the commit message.
Could teql_master_setup() also set dev->netns_immutable = true? Another
option would be to detach the slaves when the master changes netns.
[Severity: Low]
After this change, does tc-testing case 124e ("Try to add teql as a
child qdisc") still test the root-only rule?
124e requires nsPlugin, so $DUMMY is created inside a per-test netns.
teql0 is always in init_net. The root-only check and the new netns
check both return -EOPNOTSUPP. 124e only checks the exit code and an
empty matchJSON:
"cmdUnderTest": "$TC qdisc add dev $DUMMY parent 1:1 handle 2:1 teql0",
"expExitCode": "2",
"verifyCmd": "$TC -s -j qdisc ls dev $DUMMY parent 1:1",
"matchJSON": [],
If the "teql can only be used as root" check were removed or broken,
the netns check would still reject the command with the same exit code.
The test would still pass.
The v2 notes say:
The cross-netns check ran before the "teql can only be used as root"
check, so every case it did not catch was answered by that check, masking
the assertion that tc-testing case 124e makes. The root-parent
validation now runs first and the namespace check second
The new order only changes which check fires first. Either way, 124e
cannot tell the two checks apart.
Could 124e run in init_net instead? It could drop nsPlugin and create
$DUMMY in its setup, as 84a0 does. Alternatively, it could check the
extack message.
>
> - skb_queue_head_init(&q->q);
> + q->m = m;
>
> raw_spin_lock_irqsave(&m->slaves_lock, flags);
> first = rcu_dereference_protected(m->slaves, lockdep_is_held(&m->slaves_lock));
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v2.r0.20261101171325%40mojatatu.com
Technical Details
Message-ID:
<179366641863.488856.17368571591466000274@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355134-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v2.r0.20261101171325-3@mojatatu.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-355134-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 3/4] net/sched: sch_teql: reject qdiscs from another network namespace Date: Tue, 03 Nov 2026 00:40:18 +0000 Organization: Usenet Network Message-ID: <179366641863.488856.17368571591466000274@kernel.org> References: <SER-NSBD.v2.r0.20261101171325-3@mojatatu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3065788"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FpZHVKulWTNHggwpUkuhnFzfFhA= sha256:17hDYdRrkwjWr1OxyLC62HcwLXfxeekfm7pmoQglcz8= sha1:MPHMf+eElyURSt0Au72c9cB1UJw= sha256:oCPpbzuFC/5RQqV7vOCJk8lOSc3KSfeLeXqQo2jqHUA= 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 9F81A1126EA; Tue, 3 Nov 2026 03:40:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 hvQEjO2KETux; Tue, 3 Nov 2026 03:40:38 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355134-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id EAECE1126E1; Tue, 3 Nov 2026 03:40:29 +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 ADF7929DA6; Tue, 3 Nov 2026 00:40:27 +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=1793666427; b=fH+cit9pDZ10oRnQJld2njjzimntsy3M3t5i+Qe6k184j/qWABYmCFTYMuYtf11w7Dwj 6/Xa+xfkehjY2tu4+s5qV4+Qn4KDYHAaiR3Q3grTwCqKDRWJQ9oLSP3rY3EZpWSUF8EbD EMspCK8HoYrksVCZaQ0npd8MJv7bNvGSDlSbwNpF0OSjZkkq1jxX5HtD2/onzIN/GPBCx +8R2gUiszue5ur2vePcBIwlgHyB3rOzQWB0YDAurN8oB0XchccgEP5EfqUNRS800foA6m 62cj2Cl9oJKl0DbUghMW7CMgvsBLJtFITPocoCWe/G/6kRYJagl7NEVdfg7/YVgx8+g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793666427; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=whe/9x+rc26pzbBKiFHALFIMRF+zF1J8ZdVakLWuBL4=; b=IllJRWOEtxIBLuewwUNCvHEQfu/I+mInRn2RSNlucFDLg6hHor7JERus+wUvlDnIl8T6 k0k3TgklUW7Jo8TrUz0odllvmd9hagIlRpth2fiamyyj7GSJycA+32fKZXNEsJqzzM6ZI 0Mljgyxw1qanMCAnF8g+RbhrpZRE06jvdRj33UbLRw0+/K+dOJpRtITA6RpGGQA3t1qY3 NuVlmHvEMGC0XVy96W+r9BHDCZooMur3jWyimRB+YeMRTkDGwtQ2hGb0VQo1pQLuoqKdo y4NzWVRHGYpNctI5KcYM27rZqUZHQMMNyUFk4NLv4qEtRR8DK0XCUqGpvnTcx16Sp7A== 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=OvzmRmgH; 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 5F291606A32E; Tue, 3 Nov 2026 00:40:27 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OvzmRmgH X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793666420; b=GpxRDS78kNZRDt9xXGUAItTIo0yy1nFkhsCkqbM9QS5psSWfgb/qPVAb0sw9kNubeKe/ pW4b5TzDgtyK5a6d9sxpqsP4FUhugBbyltKn1hJjVWWjQXSfXuPQKUFYg7m3ktx5qrriw j1mPBgwRl5J7NFQ61BNzzBjtF2lwhkxDynUlPHgzGoap2iXHQiba/dU+KjLarrF6ZnqC7 j9UeIqqfUvRHn8b0Nzekhj4gHDjEFrA16FwIBNa1DTHlz1s6BbPs91xzOJoWmNR8Y4+sW GsCZxNezl7O5ufe1cP+vMpHhTwhSsri5aFSoSjuANMnbHkiHYZNcyOTtxPOwBvlQxkA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793666420; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=whe/9x+rc26pzbBKiFHALFIMRF+zF1J8ZdVakLWuBL4=; b=YQaOgSw14RbyRRc+PIYUlCZ3veL62rrGJ+XpVvfkmON033xrMiZcHwwQzGzRyfKN9+uk gJ5Sjn69E9VroQHOeftAUPeksRNvFoeILHaiNTzSMmK4AB6igzyJKVybtQh7egrJ935qN nrhJ0kfqnMxH2joakIuMnPDob8nxNOTH8QF1SEQLwi6Frog/bWAyVerDMP+K/MpifRaU8 yTsQW1GZoNOL2MyksBuIIe1QYtZhTBlRPY/qQGoXrf6DjHu7KfYAOIzJHeNHxuvLyg7Xp kYoCXQKeZL6iC5O5soyineMTBl2J2afqnIw0b8uZVXd9Lt25dgPGeCI/OyG+5zOQa8Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OvzmRmgH; arc=none 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 D6092606A324; Tue, 3 Nov 2026 00:40:19 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 194AF1F000C1; Tue, 3 Nov 2026 00:40:19 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793666419; bh=whe/9x+rc26pzbBKiFHALFIMRF+zF1J8ZdVakLWuBL4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=OvzmRmgHAQk7FVrpxi/rbL4/J01oaROSjqRzKLZ+rRb2Pt3Tp0+IoQNg9t4FBphDY HgSmd0PVbq4/bguWqJGCMvjgfzUrMb9TJaZZC4AFJ54OM+/sme1rUMVzKma7ir+jO4 xtgf4eaMvEbJ0P2PtgMvfhi8y7jVDw9353q6iIMD0RnManbZS1GQx6evvew0M2D5rW A4RA6L5q48sjrSft3OndjMUejBx0QYh92xhXQqLj4sFPt+XKbtTZ5oWirlboqNXZp8 Gp1WfGvFxDQsZuChYBomBIJxI2yivDSoMH6eFfxBHSWCX/3+wbdIy7iBVUKKaDLkBG Ppyjww2qZZR7A== X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, shawnq1@163.com, davem@davemloft.net, edumazet@kernel.org, horms@kernel.org, jiri@resnulli.us, kuba@kernel.org, pabeni@redhat.com, victor@mojatatu.com, thomas.goff@boeing.com X-In-Reply-To: <SER-NSBD.v2.r0.20261101171325-3@mojatatu.com> X-sashiko-severity: Medium 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