FAILED: patch "[PATCH] net/sched: Only allow act_ct to bind to clsact/ingress qdiscs" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 11cb63b0d1a0685e0831ae3c77223e002ef18189
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026031222-subway-snowy-9a66@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 11cb63b0d1a0685e0831ae3c77223e002ef18189 Mon Sep 17 00:00:00 2001
From: Victor Nogueira <[email protected]>
Date: Wed, 25 Feb 2026 10:43:48 -0300
Subject: [PATCH] net/sched: Only allow act_ct to bind to clsact/ingress qdiscs
and shared blocks
As Paolo said earlier [1]:
"Since the blamed commit below, classify can return TC_ACT_CONSUMED while the current skb being held by the defragmentation engine. As reported by GangMin Kim, if such packet is that may cause a UaF when the defrag engine later on tries to tuch again such packet."
act_ct was never meant to be used in the egress path, however some users are attaching it to egress today [2]. Attempting to reach a middle ground, we noticed that, while most qdiscs are not handling TC_ACT_CONSUMED, clsact/ingress qdiscs are. With that in mind, we address the issue by only allowing act_ct to bind to clsact/ingress qdiscs and shared blocks. That way it's still possible to attach act_ct to egress (albeit only with clsact).
[1] https://lore.kernel.org/netdev/674b8cbfc385c6f37fb29a1de08d8fe5c2b0fbee.1771321118.git.pabeni@redhat.com/
[2] https://lore.kernel.org/netdev/[email protected]/
include/net/act_api.h +1 -0
@@ -70,6 +70,7 @@ struct tc_action {#define TCA_ACT_FLAGS_REPLACE (1U << (TCA_ACT_FLAGS_USER_BITS + 2))#define TCA_ACT_FLAGS_NO_RTNL (1U << (TCA_ACT_FLAGS_USER_BITS + 3))#define TCA_ACT_FLAGS_AT_INGRESS (1U << (TCA_ACT_FLAGS_USER_BITS + 4)) +#define TCA_ACT_FLAGS_AT_INGRESS_OR_CLSACT (1U << (TCA_ACT_FLAGS_USER_BITS + 5))/* Update lastuse only if needed, to avoid dirtying a cache line. * We use a temp variable to avoid fetching jiffies twice.
net/sched/act_ct.c +6 -0
@@ -1360,6 +1360,12 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,return -EINVAL ; } +if (bind && !(flags &TCA_ACT_FLAGS_AT_INGRESS_OR_CLSACT )) { +NL_SET_ERR_MSG_MOD (extack, +"Attaching ct to a non ingress/clsact qdisc is unsupported" ); +return -EOPNOTSUPP ; + } + err =nla_parse_nested (tb,TCA_CT_MAX , nla, ct_policy, extack);if (err <0 )return err;
net/sched/cls_api.c +7 -0
@@ -2228,6 +2228,11 @@ static bool is_qdisc_ingress(__u32 classid)return (TC_H_MIN (classid) ==TC_H_MIN (TC_H_MIN_INGRESS )); } +static bool is_ingress_or_clsact (struct tcf_block *block,struct Qdisc *q) +{ +return tcf_block_shared (block) || (q && !!(q->flags &TCQ_F_INGRESS )); +} +static int tc_new_tfilter (struct sk_buff *skb,struct nlmsghdr *n,struct netlink_ext_ack *extack) {
@@ -2420,6 +2425,8 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, flags |=TCA_ACT_FLAGS_NO_RTNL ;if (is_qdisc_ingress (parent)) flags |=TCA_ACT_FLAGS_AT_INGRESS ; +if (is_ingress_or_clsact (block, q)) + flags |=TCA_ACT_FLAGS_AT_INGRESS_OR_CLSACT ; err = tp->ops->change (net, skb, tp, cl, t->tcm_handle, tca, &fh, flags, extack);if (err ==0 ) {
Sasha Levin
maintainerPATCH 1/1 net/sched: Only allow act_ct to bind to clsact/ingress qdiscs and shared blocks
From: Victor Nogueira <[email protected]>
[ Upstream commit 11cb63b0d1a0685e0831ae3c77223e002ef18189 ]
As Paolo said earlier [1]:
"Since the blamed commit below, classify can return TC_ACT_CONSUMED while the current skb being held by the defragmentation engine. As reported by GangMin Kim, if such packet is that may cause a UaF when the defrag engine later on tries to tuch again such packet."
act_ct was never meant to be used in the egress path, however some users are attaching it to egress today [2]. Attempting to reach a middle ground, we noticed that, while most qdiscs are not handling TC_ACT_CONSUMED, clsact/ingress qdiscs are. With that in mind, we address the issue by only allowing act_ct to bind to clsact/ingress qdiscs and shared blocks. That way it's still possible to attach act_ct to egress (albeit only with clsact).
[1] https://lore.kernel.org/netdev/674b8cbfc385c6f37fb29a1de08d8fe5c2b0fbee.1771321118.git.pabeni@redhat.com/
[2] https://lore.kernel.org/netdev/[email protected]/
--- include/net/act_api.h | 1 + net/sched/act_ct.c | 6 ++++++ net/sched/cls_api.c | 7 +++++++ 3 files changed, 14 insertions(+)
include/net/act_api.h +1 -0
@@ -65,6 +65,7 @@ struct tc_action {#define TCA_ACT_FLAGS_BIND (1U << (TCA_ACT_FLAGS_USER_BITS + 1))#define TCA_ACT_FLAGS_REPLACE (1U << (TCA_ACT_FLAGS_USER_BITS + 2))#define TCA_ACT_FLAGS_NO_RTNL (1U << (TCA_ACT_FLAGS_USER_BITS + 3)) +#define TCA_ACT_FLAGS_AT_INGRESS_OR_CLSACT (1U << (TCA_ACT_FLAGS_USER_BITS + 4))/* Update lastuse only if needed, to avoid dirtying a cache line. * We use a temp variable to avoid fetching jiffies twice.
net/sched/act_ct.c +6 -0
@@ -1273,6 +1273,12 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,return -EINVAL ; } +if (bind && !(flags &TCA_ACT_FLAGS_AT_INGRESS_OR_CLSACT )) { +NL_SET_ERR_MSG_MOD (extack, +"Attaching ct to a non ingress/clsact qdisc is unsupported" ); +return -EOPNOTSUPP ; + } + err =nla_parse_nested (tb,TCA_CT_MAX , nla, ct_policy, extack);if (err <0 )return err;
net/sched/cls_api.c +7 -0
@@ -1934,6 +1934,11 @@ static void tfilter_put(struct tcf_proto *tp, void *fh) tp->ops->put (tp, fh); } +static bool is_ingress_or_clsact (struct tcf_block *block,struct Qdisc *q) +{ +return tcf_block_shared (block) || (q && !!(q->flags &TCQ_F_INGRESS )); +} +static int tc_new_tfilter (struct sk_buff *skb,struct nlmsghdr *n,struct netlink_ext_ack *extack) {
@@ -2128,6 +2133,8 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, flags |=TCA_ACT_FLAGS_REPLACE ;if (!rtnl_held) flags |=TCA_ACT_FLAGS_NO_RTNL ; +if (is_ingress_or_clsact (block, q)) + flags |=TCA_ACT_FLAGS_AT_INGRESS_OR_CLSACT ; err = tp->ops->change (net, skb, tp, cl, t->tcm_handle, tca, &fh, flags, extack);if (err ==0 ) {
Signature · 1 line
2.51.0