-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfuzz.sh
executable file
·54 lines (43 loc) · 1.02 KB
/
fuzz.sh
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
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
rootdir=$(realpath $(dirname $0))
builddir=$rootdir/afl-build
afldir=$rootdir/afl
flavour=sma
#flavour=sel
target=slmc-test-simcyn-sim${flavour}
core=${builddir}/src/tests/${target}
mkdir -p $builddir
cd $builddir || exit 1
cmake .. \
-DCMAKE_C_COMPILER=afl-cc \
-DWITH_SYSTEMD=ON \
-DWITH_SMACK=ON \
-DWITH_SELINUX=ON \
-DSIMULATE_CYNAGORA=ON \
-DSIMULATE_SMACK=ON \
-DSIMULATE_SELINUX=ON \
-DFORTIFY=ON \
-DCOMPILE_TEST=ON \
-DDEBUG=ON
build() {
local ext=$1
shift
[[ $# -gt 0 ]] && export "$@"
make -B ${target}
mv src/tests/${target} src/tests/${target}.$ext
}
( build std )
( build asan AFL_USE_ASAN=1 )
#export AFL_USE_MSAN=1
( build ubsan AFL_USE_UBSAN=1 )
#export AFL_USE_CFISAN=1
#export AFL_USE_TSAN=1
#export AFL_USE_LSAN=1
cd $afldir
prog=$builddir/src/tests/${target}
cat << EOC
cd $afldir
afl-fuzz -P explore -M std -i INPUTS -o OUTPUTS -- $prog.std @@
afl-fuzz -P explore -S asan -i INPUTS -o OUTPUTS -- $prog.asan @@
afl-fuzz -P explore -S ubsan -i INPUTS -o OUTPUTS -- $prog.ubsan @@
EOC