]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD regtest: add checks for required kernel modules and sysctl
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 23 Nov 2025 20:07:12 +0000 (21:07 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 23 Nov 2025 20:09:07 +0000 (21:09 +0100)
memcheck/tests/descr_belowsp requires a sysctl
memcheck/tests/freebsd/scalar requires a kenrnel module

neither of trhe above are cleard/loaded by default.

memcheck/tests/Makefile.am
memcheck/tests/descr_belowsp.vgtest
memcheck/tests/freebsd/scalar.vgtest
memcheck/tests/freebsd/sctp.vgtest
memcheck/tests/run_descr_belowsp_test [new file with mode: 0755]

index 1cf97fc82e2bfddd937508bf0a74cce280e8efed..39974c18db11fd85cbb93557c5bb8372a3eff78c 100644 (file)
@@ -96,7 +96,8 @@ dist_noinst_SCRIPTS = \
        filter_stanza.awk \
        filter_used_supp \
        filter_stanza_and_size_t \
-       filter_malloc_zone
+       filter_malloc_zone \
+       run_descr_belowsp_test
 
 noinst_SCRIPTS = \
        filter_dw4 \
index 9fa8191f5c8dbacb1f5bd5115a0c666065a99926..47de7d715fb6d54041e9c04eae9cbe94c07edaf3 100644 (file)
@@ -1,2 +1,3 @@
+prereq: ./run_descr_belowsp_test
 prog: descr_belowsp
 vgopts: -q
index 2f433038c784fb6dd05a52efdbfc1998cbe5400d..f2440924f1f9beef2be37403fb7a2537da4a9f82 100644 (file)
@@ -1,3 +1,4 @@
+prereq: kldstat -m mqueuefs > /dev/null 2>&1
 prog: scalar
 vgopts: -q --error-limit=no --suppressions=scalar.supp
 stderr_filter: filter_scalar
index a96b5c1054cc0657481376b87937b7fafd9fd1f0..ccffdc8bd33c68e020687d1d0ded8143a576ee29 100644 (file)
@@ -1,3 +1,3 @@
-prereq: kldstat -m sctp > /dev/null
+prereq: kldstat -m sctp > /dev/null 2>&1
 vgopts: -q --trace-children=yes
 prog: sctp
diff --git a/memcheck/tests/run_descr_belowsp_test b/memcheck/tests/run_descr_belowsp_test
new file mode 100755 (executable)
index 0000000..7740363
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# FreeBSD has a (rather iffy if you ask me) belt and braces
+# approach to stack guards. When a stack gets dreated the
+# kernel adds a gurad page. Fair enough. When a pthread
+# is created, the pthread library also creates a stack
+# guard. Can't be too careful, eh?
+
+# From a Valgrind perspectve this is bad news. We use a heuristic
+# that uses VG_(am_find_nsegment) to determine whether an address
+# is part of a stack (including guard page) then
+# find_tid_with_stack_containing() with the address rounded
+# up to the nearest page. That doesn't work when there are
+# two guard pages.
+
+# There is a sysctl to turn off the kernel guard page,
+# but that requires root privileges
+
+if [ "$(uname)" = FreeBSD ]; then
+
+  sysctl security.bsd.stack_guard_page | grep 0 > /dev/null
+  exit $?
+
+fi