Netdev List
 help / color / mirror / Atom feed
* [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup
@ 2026-11-30  0:42 Dave Seddon
  2026-11-30  0:42 ` [PATCH net 1/3] net/sched: cls_matchall: return the new filter from mall_change() Dave Seddon
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dave Seddon @ 2026-11-30  0:42 UTC (permalink / raw)
  To: netdev
  Cc: Dave Seddon, Jamal Hadi Salim, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Yotam Gigi, Thomas Graf, Shuah Khan,
	linux-kselftest

mall_change() and cls_cgroup_change() do not return the new filter to
their caller, so the notification for a matchall or cgroup add has no
handle and no options. Patches 1 and 2 are the one-line fixes; patch 3
adds two tdc tests that fail without them.

The other classifiers already return the new filter.

Dave Seddon (3):
  net/sched: cls_matchall: return the new filter from mall_change()
  net/sched: cls_cgroup: return the new filter from cls_cgroup_change()
  selftests: tc-testing: check the echoed matchall and cgroup add

 net/sched/cls_cgroup.c                        |  1 +
 net/sched/cls_matchall.c                      |  2 +-
 .../tc-testing/tc-tests/filters/cgroup.json   | 22 +++++++++++++++++++
 .../tc-testing/tc-tests/filters/matchall.json | 22 +++++++++++++++++++
 4 files changed, 46 insertions(+), 1 deletion(-)


base-commit: 28a371228d4eb4857cc31eeb1a0d7d01e9c3ea2f
-- 
2.56.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/3] net/sched: cls_matchall: return the new filter from mall_change()
  2026-11-30  0:42 [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup Dave Seddon
@ 2026-11-30  0:42 ` Dave Seddon
  2026-11-30  0:42 ` [PATCH net 2/3] net/sched: cls_cgroup: return the new filter from cls_cgroup_change() Dave Seddon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Dave Seddon @ 2026-11-30  0:42 UTC (permalink / raw)
  To: netdev
  Cc: Dave Seddon, Jamal Hadi Salim, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Yotam Gigi, Thomas Graf, Shuah Khan,
	linux-kselftest

Return the new filter through *arg, as the other classifiers do. head
is always NULL at that point, so the RTM_NEWTFILTER notification for a
matchall add has handle 0 and no TCA_OPTIONS:

  # tc monitor &
  # tc filter add dev d0 ingress pref 10 protocol ip matchall action pass
  added filter dev d0 ingress protocol ip pref 10 matchall chain 0

With this patch it carries handle 0x1, the flags and the action.

Fixes: fd62d9f5c575 ("net/sched: matchall: Fix configuration race")
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 net/sched/cls_matchall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index 6ece63b82775..52be7660b682 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -230,7 +230,7 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,
 
 	tcf_proto_update_usesw(tp, new->flags);
 
-	*arg = head;
+	*arg = new;
 	rcu_assign_pointer(tp->root, new);
 	return 0;
 
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/3] net/sched: cls_cgroup: return the new filter from cls_cgroup_change()
  2026-11-30  0:42 [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup Dave Seddon
  2026-11-30  0:42 ` [PATCH net 1/3] net/sched: cls_matchall: return the new filter from mall_change() Dave Seddon
@ 2026-11-30  0:42 ` Dave Seddon
  2026-11-30  0:42 ` [PATCH net 3/3] selftests: tc-testing: check the echoed matchall and cgroup add Dave Seddon
  2026-11-30  0:48 ` [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup netdev-bot+sinfo
  3 siblings, 0 replies; 6+ messages in thread
From: Dave Seddon @ 2026-11-30  0:42 UTC (permalink / raw)
  To: netdev
  Cc: Dave Seddon, Jamal Hadi Salim, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Yotam Gigi, Thomas Graf, Shuah Khan,
	linux-kselftest

Return the new filter through *arg, as the other classifiers do.
cls_cgroup_change() never sets it, so the RTM_NEWTFILTER notification
for a cgroup add or replace has handle 0 and no TCA_OPTIONS:

  # tc -echo filter add dev d0 ingress handle 7 pref 1 cgroup action ok
  added filter dev d0 ingress protocol all pref 1 cgroup chain 0

With this patch it carries handle 0x7 and the action.

Fixes: f400923735ec ("pkt_sched: Control group classifier")
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 net/sched/cls_cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 28701d3916b8..521901d8538c 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -119,6 +119,7 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
 	if (err < 0)
 		goto errout;
 
+	*arg = new;
 	rcu_assign_pointer(tp->root, new);
 	if (head) {
 		tcf_exts_get_net(&head->exts);
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 3/3] selftests: tc-testing: check the echoed matchall and cgroup add
  2026-11-30  0:42 [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup Dave Seddon
  2026-11-30  0:42 ` [PATCH net 1/3] net/sched: cls_matchall: return the new filter from mall_change() Dave Seddon
  2026-11-30  0:42 ` [PATCH net 2/3] net/sched: cls_cgroup: return the new filter from cls_cgroup_change() Dave Seddon
@ 2026-11-30  0:42 ` Dave Seddon
  2026-11-30  0:48 ` [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup netdev-bot+sinfo
  3 siblings, 0 replies; 6+ messages in thread
From: Dave Seddon @ 2026-11-30  0:42 UTC (permalink / raw)
  To: netdev
  Cc: Dave Seddon, Jamal Hadi Salim, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Yotam Gigi, Thomas Graf, Shuah Khan,
	linux-kselftest

Add a matchall and a cgroup filter with "tc -echo" and check that the
echoed notification carries the filter handle. Both tests fail without
the previous two patches.

Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 .../tc-testing/tc-tests/filters/cgroup.json   | 22 +++++++++++++++++++
 .../tc-testing/tc-tests/filters/matchall.json | 22 +++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/cgroup.json b/tools/testing/selftests/tc-testing/tc-tests/filters/cgroup.json
index 35c9a7dbe1c4..9bbbb6b08e2d 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/filters/cgroup.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/filters/cgroup.json
@@ -1232,5 +1232,27 @@
         "teardown": [
             "$TC qdisc del dev $DEV1 ingress"
         ]
+    },
+    {
+        "id": "b9d4",
+        "name": "Add cgroup filter and check the echoed notification",
+        "category": [
+            "filter",
+            "cgroup"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$TC qdisc add dev $DUMMY ingress"
+        ],
+        "cmdUnderTest": "bash -c '$TC -echo filter add dev $DUMMY parent ffff: handle 0x7 prio 1 protocol ip cgroup action ok | grep \"cgroup.*handle 0x7\"'",
+        "expExitCode": "0",
+        "verifyCmd": "$TC filter show dev $DUMMY ingress",
+        "matchPattern": "cgroup.*handle 0x7",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY ingress"
+        ]
     }
 ]
diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json b/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json
index 6b3eea401fc8..c4689cb62f3e 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json
@@ -574,5 +574,27 @@
         "teardown": [
             "$TC qdisc del dev $DEV1 clsact"
         ]
+    },
+    {
+        "id": "e3c7",
+        "name": "Add ingress matchall filter and check the echoed notification",
+        "category": [
+            "filter",
+            "matchall"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$TC qdisc add dev $DUMMY ingress"
+        ],
+        "cmdUnderTest": "bash -c '$TC -echo filter add dev $DUMMY parent ffff: handle 0x7 prio 1 protocol ip matchall action ok | grep \"matchall.*handle 0x7\"'",
+        "expExitCode": "0",
+        "verifyCmd": "$TC filter show dev $DUMMY ingress",
+        "matchPattern": "matchall.*handle 0x7",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY ingress"
+        ]
     }
 ]
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup
  2026-11-30  0:42 [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup Dave Seddon
                   ` (2 preceding siblings ...)
  2026-11-30  0:42 ` [PATCH net 3/3] selftests: tc-testing: check the echoed matchall and cgroup add Dave Seddon
@ 2026-11-30  0:48 ` netdev-bot+sinfo
  2026-11-30  1:00   ` dave seddon
  3 siblings, 1 reply; 6+ messages in thread
From: netdev-bot+sinfo @ 2026-11-30  0:48 UTC (permalink / raw)
  To: Dave Seddon
  Cc: netdev, Jamal Hadi Salim, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Yotam Gigi, Thomas Graf, Shuah Khan,
	linux-kselftest

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup
  2026-11-30  0:48 ` [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup netdev-bot+sinfo
@ 2026-11-30  1:00   ` dave seddon
  0 siblings, 0 replies; 6+ messages in thread
From: dave seddon @ 2026-11-30  1:00 UTC (permalink / raw)
  To: netdev-bot+sinfo
  Cc: netdev, Jamal Hadi Salim, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Yotam Gigi, Thomas Graf, Shuah Khan,
	linux-kselftest

G'day,

I discovered these by porting parts of tc to Go. I was running tc
commands in a namespace, capturing the netlink traffic with nlmon, and
comparing the output against my port, which highlighted that these
notifications were missing handles and options.

Thanks,
Dave

On Sun, Nov 29, 2026 at 4:49 PM <netdev-bot+sinfo@kernel.org> wrote:
>
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
>  - How the issue was discovered, e.g. hit in production, hit during
>    development, syzbot report, manual code inspection, LLM or static
>    analysis tool scan.
>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
>
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> --
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.



-- 
Regards,
Dave Seddon
+1 415 857 5102

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-30  1:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  0:42 [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup Dave Seddon
2026-11-30  0:42 ` [PATCH net 1/3] net/sched: cls_matchall: return the new filter from mall_change() Dave Seddon
2026-11-30  0:42 ` [PATCH net 2/3] net/sched: cls_cgroup: return the new filter from cls_cgroup_change() Dave Seddon
2026-11-30  0:42 ` [PATCH net 3/3] selftests: tc-testing: check the echoed matchall and cgroup add Dave Seddon
2026-11-30  0:48 ` [PATCH net 0/3] net/sched: fix the add notification of matchall and cgroup netdev-bot+sinfo
2026-11-30  1:00   ` dave seddon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox