Fix atheris integration. (#4824)

This commit is contained in:
Abhishek Arya 2020-12-11 11:38:43 -08:00 committed by GitHub
parent 25988ca5f1
commit 0dd7aaca32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 5 deletions

View File

@ -92,7 +92,7 @@ for fuzzer in $(find $SRC -name '*_fuzzer.py'); do
# library is not required and can lead to unexpected startup crashes.
echo "#!/bin/sh
# LLVMFuzzerTestOneInput for fuzzer detection.
LD_PRELOAD=\$(dirname "\$0")/libclang_rt.asan-x86_64.so \
LD_PRELOAD=\$(dirname "\$0")/sanitizer_with_fuzzer.so \
ASAN_OPTIONS=\$ASAN_OPTIONS:symbolize=1:detect_leaks=0 \
\$(dirname "\$0")/$fuzzer_package \$@" > $OUT/$fuzzer_basename
chmod u+x $OUT/$fuzzer_basename

View File

@ -97,7 +97,13 @@ export CFLAGS="$CFLAGS $SANITIZER_FLAGS $COVERAGE_FLAGS"
export CXXFLAGS="$CFLAGS $CXXFLAGS_EXTRA"
if [ "$FUZZING_LANGUAGE" = "python" ]; then
cp $(find $(llvm-config --libdir) -name "libclang_rt.asan-x86_64.so") $OUT/
sanitizer_with_fuzzer_lib_dir=`python3 -c "import atheris; import os; print(os.path.dirname(atheris.path()))"`
sanitizer_with_fuzzer_output_lib=$OUT/sanitizer_with_fuzzer.so
if [ "$SANITIZER" = "address" ]; then
cp $sanitizer_with_fuzzer_lib_dir/asan_with_fuzzer.so $sanitizer_with_fuzzer_output_lib
elif [ "$SANITIZER" = "undefined" ]; then
cp $sanitizer_with_fuzzer_lib_dir/ubsan_cxx_with_fuzzer.so $sanitizer_with_fuzzer_output_lib
fi
# Disable leak checking as it is unsupported.
export CFLAGS="$CFLAGS -fno-sanitize=leak"

View File

@ -27,7 +27,7 @@ for fuzzer in $(find $SRC -name '*_fuzzer.py'); do
# Create execution wrapper.
echo "#!/bin/sh
# LLVMFuzzerTestOneInput for fuzzer detection.
LD_PRELOAD=\$(dirname "\$0")/libclang_rt.asan-x86_64.so \
LD_PRELOAD=\$(dirname "\$0")/sanitizer_with_fuzzer.so \
ASAN_OPTIONS=\$ASAN_OPTIONS:symbolize=1:detect_leaks=0 \
\$(dirname "\$0")/$fuzzer_package \$@" > $OUT/$fuzzer_basename
chmod u+x $OUT/$fuzzer_basename

View File

@ -37,7 +37,7 @@ values that are too big or too small is techincally fine; however,
misinterpreting them is not.
"""
import atheris
import atheris_no_libfuzzer as atheris
import json
import ujson
import sys

View File

@ -29,7 +29,7 @@ coverage.
"""
import sys
import atheris
import atheris_no_libfuzzer as atheris
import ujson