Add check_build for Honggfuzz targets, enable in travis. (#3596)

This commit is contained in:
Abhishek Arya 2020-04-08 14:24:34 -07:00 committed by GitHub
parent 2efc17a17e
commit f4878b30fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -60,7 +60,7 @@ then
fi
# Verify that the given fuzz target is corectly built to run with a particular
# Verify that the given fuzz target is correctly built to run with a particular
# engine.
function check_engine {
local FUZZER=$1
@ -98,6 +98,14 @@ function check_engine {
cat $FUZZER_OUTPUT
return 1
fi
elif [[ "$FUZZING_ENGINE" == honggfuzz ]]; then
timeout --preserve-status -s INT 20s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
CHECK_PASSED=$(egrep "^Sz:[0-9]+ Tm:[0-9]+" -c $FUZZER_OUTPUT)
if (( $CHECK_PASSED == 0 )); then
echo "BAD BUILD: fuzzing $FUZZER with honggfuzz failed."
cat $FUZZER_OUTPUT
return 1
fi
elif [[ "$FUZZING_ENGINE" == dataflow ]]; then
$FUZZER &> $FUZZER_OUTPUT
local NUMBER_OF_FUNCTIONS=$(grep -Po "INFO:\s+\K[[:digit:]]+(?=\s+instrumented function.*)" $FUZZER_OUTPUT)

View File

@ -60,9 +60,6 @@ for FUZZER_BINARY in $(find $TMP_FUZZER_DIR -maxdepth 1 -executable -type f); do
if [[ "$FUZZER" == afl-* ]]; then
continue
fi
if [[ "$FUZZER" == honggfuzz ]]; then
continue
fi
echo "INFO: performing bad build checks for $FUZZER_BINARY."

View File

@ -104,7 +104,8 @@ def main(): # pylint: disable=too-many-branches,too-many-return-statements,too-
check_build_parser = subparsers.add_parser(
'check_build', help='Checks that fuzzers execute without errors.')
_add_architecture_args(check_build_parser)
_add_engine_args(check_build_parser, choices=['libfuzzer', 'afl', 'dataflow'])
_add_engine_args(check_build_parser,
choices=['libfuzzer', 'afl', 'honggfuzz', 'dataflow'])
_add_sanitizer_args(check_build_parser,
choices=['address', 'memory', 'undefined', 'dataflow'])
_add_environment_args(check_build_parser)

View File

@ -126,9 +126,7 @@ def build_project(project):
print('Building project', project)
build_fuzzers(project, engine, sanitizer, architecture)
# TODO(https://github.com/google/oss-fuzz/issues/3592): Re-enable after
# Honggfuzz is supported in check_build.
if engine not in ['none', 'honggfuzz']:
if engine != 'none':
check_build(project, engine, sanitizer, architecture)