File tree 3 files changed +9
-46
lines changed
3 files changed +9
-46
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# Continuosly cycle over fuzz targets running each for 1 hour.
4
4
# It uses chrt SCHED_IDLE so that other process takes priority.
5
- #
6
- # For hfuzz options see https://github.com/google/honggfuzz/blob/master/docs/USAGE.md
7
5
8
- set -e
6
+ set -o errexit # exit immediately if any command fails
7
+ set -o xtrace # print trace of executed commands
8
+
9
9
REPO_DIR=$( git rev-parse --show-toplevel)
10
10
# shellcheck source=./fuzz-util.sh
11
11
source " $REPO_DIR /fuzz/fuzz-util.sh"
@@ -14,12 +14,11 @@ while :
14
14
do
15
15
for targetFile in $( listTargetFiles) ; do
16
16
targetName=$( targetFileToName " $targetFile " )
17
- echo " Fuzzing target $targetName ($targetFile )"
18
17
19
18
# fuzz for one hour
20
- HFUZZ_RUN_ARGS= ' --run_time 3600 ' chrt -i 0 cargo hfuzz run " $targetName "
19
+ chrt -i 0 cargo-fuzz run " $targetName " -- -max_total_time=3600
21
20
# minimize the corpus
22
- HFUZZ_RUN_ARGS= " -i hfuzz_workspace/ $targetName /input/ -P -M " chrt -i 0 cargo hfuzz run " $targetName "
21
+ cargo-fuzz cmin " $targetName "
23
22
done
24
23
done
25
24
Original file line number Diff line number Diff line change @@ -15,14 +15,6 @@ targetFileToName() {
15
15
| sed ' s/\//_/g'
16
16
}
17
17
18
- targetFileToHFuzzInputArg () {
19
- baseName=$( basename " $1 " )
20
- dirName=" ${baseName% .* } "
21
- if [ -d " hfuzz_input/$dirName " ]; then
22
- echo " HFUZZ_INPUT_ARGS=\" -f hfuzz_input/$FILE /input\" "
23
- fi
24
- }
25
-
26
18
listTargetNames () {
27
19
for target in $( listTargetFiles) ; do
28
20
targetFileToName " $target "
@@ -37,23 +29,3 @@ checkWindowsFiles() {
37
29
exit 2
38
30
fi
39
31
}
40
-
41
- # Checks whether a fuzz case output some report, and dumps it in hex
42
- getReport () {
43
- reportFile=" hfuzz_workspace/$1 /HONGGFUZZ.REPORT.TXT"
44
- if [ -f " $reportFile " ]; then
45
- cat " $reportFile "
46
- for CASE in " hfuzz_workspace/$1 /SIG" * ; do
47
- xxd -p -c10000 < " $CASE "
48
- done
49
- return 1
50
- fi
51
- return 0
52
- }
53
-
54
- # Check for reports and exit if there are any
55
- checkReport () {
56
- if ! getReport " $1 " ; then
57
- exit 1
58
- fi
59
- }
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
- set -ex
2
+ set -o errexit # exit immediately if any command fails
3
+ set -o xtrace # print trace of executed commands
3
4
4
5
REPO_DIR=$( git rev-parse --show-toplevel)
5
6
18
19
cargo --version
19
20
rustc --version
20
21
21
- # Testing
22
- cargo install --force honggfuzz --no-default-features
22
+ # Run fuzz target
23
23
for targetFile in $targetFiles ; do
24
24
targetName=$( targetFileToName " $targetFile " )
25
- echo " Fuzzing target $targetName ($targetFile )"
26
- if [ -d " hfuzz_input/$targetName " ]; then
27
- HFUZZ_INPUT_ARGS=" -f hfuzz_input/$targetName /input\" "
28
- else
29
- HFUZZ_INPUT_ARGS=" "
30
- fi
31
- HFUZZ_RUN_ARGS=" --run_time 30 --exit_upon_crash -v $HFUZZ_INPUT_ARGS " cargo hfuzz run " $targetName "
32
-
33
- checkReport " $targetName "
25
+ cargo-fuzz run " $targetName " -- -max_total_time=30
34
26
done
You can’t perform that action at this time.
0 commit comments