-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrun_fuzz_tests.sh
More file actions
executable file
·43 lines (36 loc) · 881 Bytes
/
run_fuzz_tests.sh
File metadata and controls
executable file
·43 lines (36 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
## Copyright Chris Rohlf - 2025
make tests
tests=("mapguard_test" "mapguard_thread_test")
export MG_USE_MAPPING_CACHE=1
while true; do
# Randomize environment variables
env_vars=(
MG_PANIC_ON_VIOLATION
MG_PREVENT_RWX
MG_PREVENT_TRANSITION_FROM_X
MG_PREVENT_TRANSITION_TO_X
MG_PREVENT_STATIC_ADDRESS
MG_ENABLE_GUARD_PAGES
MG_POISON_ON_ALLOCATION
MG_ENABLE_SYSLOG
)
for var in "${env_vars[@]}"; do
export "$var=$((RANDOM % 2))"
done
# Ensure correct library path
export LD_LIBRARY_PATH=build/
# Run each test until we detect a segfault
for t in "${tests[@]}"; do
./build/$t
ret=$?
if [ "$ret" -eq 139 ]; then
echo "Segmentation fault detected in $t. Exiting."
for var in "${env_vars[@]}"; do
env | grep $var
done
echo build/$t
exit 1
fi
done
done