Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
@ 2026-09-22 16:33 ` Jamal Hadi Salim
  2026-09-24 17:32   ` Jakub Kicinski
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jamal Hadi Salim @ 2026-09-22 16:33 UTC (permalink / raw)
  To: netdev
  Cc: Jamal Hadi Salim, Jiri Pirko, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
	linux-kselftest, Victor Nogueira, hybris, sashiko-bot

tca_action_gd() takes one reference per nested TCA_ACT_TAB entry while
tcf_action_delete() consumes two per slot, so three duplicate
TCA_ACT_INDEX entries in one RTM_DELACTION free the action mid-walk and
the next slot dereferences it.  Assert a duplicate batch is rejected and
the action survives.

Conditions to recreate the bug:
  tc actions add action pass index 1
  tc actions delete action gact index 1 action gact index 1 \
                     action gact index 1

Testing:
  Case 8135 fails on the unfixed kernel (tdc_8135_unfixed.log) and passes
  with the fix, alongside the batch-delete family (tdc_8135_fixed.log).

Tested-by: hybris <hybris@mojatatu.ai>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 .../tc-tests/actions/batch-delete.json        | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json b/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
index ef7ca4a6775b..7620e927ae2c 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
@@ -111,5 +111,38 @@
                 255
             ]
         ]
+    },
+    {
+        "id": "8135",
+        "name": "Reject duplicate action in a delete batch",
+        "category": [
+            "actions",
+            "gact"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gact",
+                0,
+                1,
+                255
+            ],
+            "$TC actions add action pass index 1"
+        ],
+        "cmdUnderTest": "$TC actions del action gact index 1 action gact index 1 action gact index 1",
+        "expExitCode": "255",
+        "verifyCmd": "$TC actions ls action gact",
+        "matchPattern": "total acts 1\\b.*index 1 ref 1 bind 0\\b",
+        "matchCount": "1",
+        "teardown": [
+            [
+                "$TC actions flush action gact",
+                0,
+                1,
+                255
+            ]
+        ]
     }
 ]
-- 
2.43.0


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

* Re: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
  2026-09-22 16:33 ` [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test Jamal Hadi Salim
@ 2026-09-24 17:32   ` Jakub Kicinski
  2026-09-24 20:09     ` Jamal Hadi Salim
  2026-09-25  8:22   ` [PATCH net 2/2 repost] " Jamal Hadi Salim
  2026-10-03  9:54   ` [PATCH net 2/2 repost2] " Jamal Hadi Salim
  2 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2026-09-24 17:32 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: netdev, Jiri Pirko, David S . Miller, Eric Dumazet, Paolo Abeni,
	Simon Horman, Shuah Khan, linux-kselftest, Victor Nogueira,
	hybris, sashiko-bot

On Tue, 22 Sep 2026 12:33:59 -0400 Jamal Hadi Salim wrote:
> Subject: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test

ah, here's the 2/2 patch. Patchwork did not figure it out either :(

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

* Re: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
  2026-09-24 17:32   ` Jakub Kicinski
@ 2026-09-24 20:09     ` Jamal Hadi Salim
  2026-09-24 20:42       ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Jamal Hadi Salim @ 2026-09-24 20:09 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Jamal Hadi Salim, netdev, Jiri Pirko, David S . Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan,
	linux-kselftest, Victor Nogueira, hybris, sashiko-bot

On Thu, Sep 24, 2026 at 1:32 PM 'Jakub Kicinski' via Hyper-Yielding
Back-end Review & Insight System <hybris@mojatatu.com> wrote:
>
> On Tue, 22 Sep 2026 12:33:59 -0400 Jamal Hadi Salim wrote:
> > Subject: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
>
> ah, here's the 2/2 patch. Patchwork did not figure it out either :(

repost? (2/2 was stuck on some ether).

cheers,
jamal

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

* Re: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
  2026-09-24 20:09     ` Jamal Hadi Salim
@ 2026-09-24 20:42       ` Jakub Kicinski
  2026-09-25  8:15         ` Jamal Hadi Salim
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2026-09-24 20:42 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: Jamal Hadi Salim, netdev, Jiri Pirko, David S . Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan,
	linux-kselftest, Victor Nogueira, hybris, sashiko-bot

On Thu, 24 Sep 2026 16:09:16 -0400 Jamal Hadi Salim wrote:
> On Thu, Sep 24, 2026 at 1:32 PM 'Jakub Kicinski' via Hyper-Yielding
> Back-end Review & Insight System <hybris@mojatatu.com> wrote:
> >
> > On Tue, 22 Sep 2026 12:33:59 -0400 Jamal Hadi Salim wrote:  
> > > Subject: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test  
> >
> > ah, here's the 2/2 patch. Patchwork did not figure it out either :(  
> 
> repost? (2/2 was stuck on some ether).

Yes, please, repost

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

* Re: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
  2026-09-24 20:42       ` Jakub Kicinski
@ 2026-09-25  8:15         ` Jamal Hadi Salim
  2026-09-28 23:40           ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Jamal Hadi Salim @ 2026-09-25  8:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Jamal Hadi Salim, netdev, Jiri Pirko, David S . Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan,
	linux-kselftest, Victor Nogueira, hybris, sashiko-bot

On Thu, Sep 24, 2026 at 4:42 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 24 Sep 2026 16:09:16 -0400 Jamal Hadi Salim wrote:
> > On Thu, Sep 24, 2026 at 1:32 PM 'Jakub Kicinski' via Hyper-Yielding
> > Back-end Review & Insight System <hybris@mojatatu.com> wrote:
> > >
> > > On Tue, 22 Sep 2026 12:33:59 -0400 Jamal Hadi Salim wrote:
> > > > Subject: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
> > >
> > > ah, here's the 2/2 patch. Patchwork did not figure it out either :(
> >
> > repost? (2/2 was stuck on some ether).
>
> Yes, please, repost

pw-bot: cr

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

* [PATCH net 2/2 repost] selftests: tc-testing: add duplicate action delete batch test
  2026-09-22 16:33 ` [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test Jamal Hadi Salim
  2026-09-24 17:32   ` Jakub Kicinski
@ 2026-09-25  8:22   ` Jamal Hadi Salim
  2026-10-03  9:54   ` [PATCH net 2/2 repost2] " Jamal Hadi Salim
  2 siblings, 0 replies; 8+ messages in thread
From: Jamal Hadi Salim @ 2026-09-25  8:22 UTC (permalink / raw)
  To: netdev
  Cc: Jamal Hadi Salim, Jiri Pirko, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Victor Nogueira,
	Shuah Khan, linux-kselftest, hybris, sashiko-bot

tca_action_gd() takes one reference per nested TCA_ACT_TAB entry while
tcf_action_delete() consumes two per slot, so three duplicate
TCA_ACT_INDEX entries in one RTM_DELACTION free the action mid-walk and
the next slot dereferences it.  Assert a duplicate batch is rejected and
the action survives.

Conditions to recreate the bug:
  tc actions add action pass index 1
  tc actions delete action gact index 1 action gact index 1 \
                     action gact index 1

Testing:
  Case 8135 fails on the unfixed kernel (tdc_8135_unfixed.log) and passes
  with the fix, alongside the batch-delete family (tdc_8135_fixed.log).

Tested-by: hybris <hybris@mojatatu.ai>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 .../tc-tests/actions/batch-delete.json        | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json b/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
index ef7ca4a6775b..7620e927ae2c 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
@@ -111,5 +111,38 @@
                 255
             ]
         ]
+    },
+    {
+        "id": "8135",
+        "name": "Reject duplicate action in a delete batch",
+        "category": [
+            "actions",
+            "gact"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gact",
+                0,
+                1,
+                255
+            ],
+            "$TC actions add action pass index 1"
+        ],
+        "cmdUnderTest": "$TC actions del action gact index 1 action gact index 1 action gact index 1",
+        "expExitCode": "255",
+        "verifyCmd": "$TC actions ls action gact",
+        "matchPattern": "total acts 1\\b.*index 1 ref 1 bind 0\\b",
+        "matchCount": "1",
+        "teardown": [
+            [
+                "$TC actions flush action gact",
+                0,
+                1,
+                255
+            ]
+        ]
     }
 ]
-- 
2.43.0


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

* Re: [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test
  2026-09-25  8:15         ` Jamal Hadi Salim
@ 2026-09-28 23:40           ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2026-09-28 23:40 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: Jamal Hadi Salim, netdev, Jiri Pirko, David S . Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan,
	linux-kselftest, Victor Nogueira, hybris, sashiko-bot

On Fri, 25 Sep 2026 04:15:00 -0400 Jamal Hadi Salim wrote:
> On Thu, Sep 24, 2026 at 4:42 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Thu, 24 Sep 2026 16:09:16 -0400 Jamal Hadi Salim wrote:  
> > > On Thu, Sep 24, 2026 at 1:32 PM 'Jakub Kicinski' via Hyper-Yielding
> > > Back-end Review & Insight System <hybris@mojatatu.com> wrote:  
> > > 
> > > repost? (2/2 was stuck on some ether).  
> >
> > Yes, please, repost  
> 
> pw-bot: cr

Quoting documentation:

  Updating patch status
  ~~~~~~~~~~~~~~~~~~~~~
  [...]

  No email should ever be sent to the list with the main purpose
  of communicating with the bot, the bot commands should be seen as metadata.

  [...]
  
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#updating-patch-status

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

* [PATCH net 2/2 repost2] selftests: tc-testing: add duplicate action delete batch test
  2026-09-22 16:33 ` [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test Jamal Hadi Salim
  2026-09-24 17:32   ` Jakub Kicinski
  2026-09-25  8:22   ` [PATCH net 2/2 repost] " Jamal Hadi Salim
@ 2026-10-03  9:54   ` Jamal Hadi Salim
  2 siblings, 0 replies; 8+ messages in thread
From: Jamal Hadi Salim @ 2026-10-03  9:54 UTC (permalink / raw)
  To: netdev
  Cc: Jamal Hadi Salim, Jiri Pirko, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Victor Nogueira,
	Shuah Khan, linux-kselftest, hybris, sashiko-bot

tca_action_gd() takes one reference per nested TCA_ACT_TAB entry while
tcf_action_delete() consumes two per slot, so three duplicate
TCA_ACT_INDEX entries in one RTM_DELACTION free the action mid-walk and
the next slot dereferences it.  Assert a duplicate batch is rejected and
the action survives.

Conditions to recreate the bug:
  tc actions add action pass index 1
  tc actions delete action gact index 1 action gact index 1 \
                     action gact index 1

Testing:
  Case 8135 fails on the unfixed kernel (tdc_8135_unfixed.log) and passes
  with the fix, alongside the batch-delete family (tdc_8135_fixed.log).

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 .../tc-tests/actions/batch-delete.json        | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json b/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
index ef7ca4a6775b..7620e927ae2c 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/batch-delete.json
@@ -111,5 +111,38 @@
                 255
             ]
         ]
+    },
+    {
+        "id": "8135",
+        "name": "Reject duplicate action in a delete batch",
+        "category": [
+            "actions",
+            "gact"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gact",
+                0,
+                1,
+                255
+            ],
+            "$TC actions add action pass index 1"
+        ],
+        "cmdUnderTest": "$TC actions del action gact index 1 action gact index 1 action gact index 1",
+        "expExitCode": "255",
+        "verifyCmd": "$TC actions ls action gact",
+        "matchPattern": "total acts 1\\b.*index 1 ref 1 bind 0\\b",
+        "matchCount": "1",
+        "teardown": [
+            [
+                "$TC actions flush action gact",
+                0,
+                1,
+                255
+            ]
+        ]
     }
 ]
-- 
2.43.0


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

end of thread, other threads:[~2026-10-03  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <QDISC-K1TH.v1.20260922072206@mojatatu.com>
2026-09-22 16:33 ` [PATCH net 2/2] selftests: tc-testing: add duplicate action delete batch test Jamal Hadi Salim
2026-09-24 17:32   ` Jakub Kicinski
2026-09-24 20:09     ` Jamal Hadi Salim
2026-09-24 20:42       ` Jakub Kicinski
2026-09-25  8:15         ` Jamal Hadi Salim
2026-09-28 23:40           ` Jakub Kicinski
2026-09-25  8:22   ` [PATCH net 2/2 repost] " Jamal Hadi Salim
2026-10-03  9:54   ` [PATCH net 2/2 repost2] " Jamal Hadi Salim

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