Skip to contentSkip to conversation

tests: shell: add test case for interval set with timeout and aborted transaction

PATCH In review Florian Westphal 1 participant 2 messages Jan 29 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 tests: shell: add test case for interval set with timeout and aborted transaction

Add a regression test for rbtree+bsearch getting out-of-sync in nf-next kernel.

This covers the syzkaller reproducer from
https://syzkaller.appspot.com/bug?extid=d417922a3e7935517ef6
which triggers abort with earlier gc at insert time and additional corner cases where transaction passes without recording a relevant change in the set (and thus no call to either abort or commit).

---
 .../dumps/rbtree_timeout_no_commit.json-nft   | 34 ++++++++++
 .../sets/dumps/rbtree_timeout_no_commit.nft   |  7 +++
 .../testcases/sets/rbtree_timeout_no_commit   | 63 +++++++++++++++++++
 3 files changed, 104 insertions(+)
 create mode 100644 tests/shell/testcases/sets/dumps/rbtree_timeout_no_commit.json-nft
 create mode 100644 tests/shell/testcases/sets/dumps/rbtree_timeout_no_commit.nft
 create mode 100755 tests/shell/testcases/sets/rbtree_timeout_no_commit
tests/shell/testcases/sets/dumps/rbtree_timeout_no_commit.json-nft new file +34 -0
new file mode 100644
index 000000000000..3cf22678e179
@@ -0,0 +1,34 @@
+{
+  "nftables": [
+    {
+      "metainfo": {
+        "version": "VERSION",
+        "release_name": "RELEASE_NAME",
+        "json_schema_version": 1
+      }
+    },
+    {
+      "table": {
+        "family": "ip",
+        "name": "t",
+        "handle": 0
+      }
+    },
+    {
+      "set": {
+        "family": "ip",
+        "name": "s",
+        "table": "t",
+        "type": "ipv4_addr",
+        "handle": 0,
+        "flags": [
+          "interval",
+          "timeout"
+        ],
+        "elem": [
+          "10.0.0.1"
+        ]
+      }
+    }
+  ]
+}
tests/shell/testcases/sets/dumps/rbtree_timeout_no_commit.nft new file +7 -0
new file mode 100644
index 000000000000..df0be9af386b
@@ -0,0 +1,7 @@
+table ip t {
+	set s {
+		type ipv4_addr
+		flags interval,timeout
+		elements = { 10.0.0.1 }
+	}
+}
tests/shell/testcases/sets/rbtree_timeout_no_commit new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#1 lore raw

tests/shell/testcases/sets/rbtree_timeout_no_commit line 33

Quoted 6 lines · Florian Westphal
tests/shell/testcases/sets/rbtree_timeout_no_commit new file +6 -0
+		elements = { 10.0.0.1, 10.0.1.2-10.1.2.4 timeout 1s }
+	}
+}
+EOF
+
+sleep 2

Argh, I keep forgetting I can use sub-ms timeout :-)

I'll push an amended test that completes a bit faster.