|
|
252916 |
From cc6c59e683c503b461b4a80526f4bc9cbb0660bf Mon Sep 17 00:00:00 2001
|
|
|
252916 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
252916 |
Date: Fri, 5 Nov 2021 16:06:45 +0100
|
|
|
252916 |
Subject: [PATCH] tests: cover baecd1cf2685 ("segtree: Fix segfault when
|
|
|
252916 |
restoring a huge interval set")
|
|
|
252916 |
MIME-Version: 1.0
|
|
|
252916 |
Content-Type: text/plain; charset=UTF-8
|
|
|
252916 |
Content-Transfer-Encoding: 8bit
|
|
|
252916 |
|
|
|
252916 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1908127
|
|
|
252916 |
Upstream Status: nftables commit d8ccad2a2b73c
|
|
|
252916 |
|
|
|
252916 |
commit d8ccad2a2b73c4189934eb5fd0e3d096699b5043
|
|
|
252916 |
Author: Štěpán Němec <snemec@redhat.com>
|
|
|
252916 |
Date: Wed Oct 20 14:42:20 2021 +0200
|
|
|
252916 |
|
|
|
252916 |
tests: cover baecd1cf2685 ("segtree: Fix segfault when restoring a huge interval set")
|
|
|
252916 |
|
|
|
252916 |
Test inspired by [1] with both the set and stack size reduced by the
|
|
|
252916 |
same power of 2, to preserve the (pre-baecd1cf2685) segfault on one
|
|
|
252916 |
hand, and make the test successfully complete (post-baecd1cf2685) in a
|
|
|
252916 |
few seconds even on weaker hardware on the other.
|
|
|
252916 |
|
|
|
252916 |
(The reason I stopped at 128kB stack size is that with 64kB I was
|
|
|
252916 |
getting segfaults even with baecd1cf2685 applied.)
|
|
|
252916 |
|
|
|
252916 |
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1908127
|
|
|
252916 |
|
|
|
252916 |
Signed-off-by: Štěpán Němec <snemec@redhat.com>
|
|
|
252916 |
Helped-by: Phil Sutter <phil@nwl.cc>
|
|
|
252916 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
252916 |
---
|
|
|
252916 |
.../sets/0068interval_stack_overflow_0 | 29 +++++++++++++++++++
|
|
|
252916 |
1 file changed, 29 insertions(+)
|
|
|
252916 |
create mode 100755 tests/shell/testcases/sets/0068interval_stack_overflow_0
|
|
|
252916 |
|
|
|
252916 |
diff --git a/tests/shell/testcases/sets/0068interval_stack_overflow_0 b/tests/shell/testcases/sets/0068interval_stack_overflow_0
|
|
|
252916 |
new file mode 100755
|
|
|
252916 |
index 0000000..134282d
|
|
|
252916 |
--- /dev/null
|
|
|
252916 |
+++ b/tests/shell/testcases/sets/0068interval_stack_overflow_0
|
|
|
252916 |
@@ -0,0 +1,29 @@
|
|
|
252916 |
+#!/bin/bash
|
|
|
252916 |
+
|
|
|
252916 |
+set -e
|
|
|
252916 |
+
|
|
|
252916 |
+ruleset_file=$(mktemp)
|
|
|
252916 |
+
|
|
|
252916 |
+trap 'rm -f "$ruleset_file"' EXIT
|
|
|
252916 |
+
|
|
|
252916 |
+{
|
|
|
252916 |
+ echo 'define big_set = {'
|
|
|
252916 |
+ for ((i = 1; i < 255; i++)); do
|
|
|
252916 |
+ for ((j = 1; j < 80; j++)); do
|
|
|
252916 |
+ echo "10.0.$i.$j,"
|
|
|
252916 |
+ done
|
|
|
252916 |
+ done
|
|
|
252916 |
+ echo '10.1.0.0/24 }'
|
|
|
252916 |
+} >"$ruleset_file"
|
|
|
252916 |
+
|
|
|
252916 |
+cat >>"$ruleset_file" <<\EOF
|
|
|
252916 |
+table inet test68_table {
|
|
|
252916 |
+ set test68_set {
|
|
|
252916 |
+ type ipv4_addr
|
|
|
252916 |
+ flags interval
|
|
|
252916 |
+ elements = { $big_set }
|
|
|
252916 |
+ }
|
|
|
252916 |
+}
|
|
|
252916 |
+EOF
|
|
|
252916 |
+
|
|
|
252916 |
+( ulimit -s 128 && "$NFT" -f "$ruleset_file" )
|
|
|
252916 |
--
|
|
|
252916 |
2.31.1
|
|
|
252916 |
|