diff options
author | Abhishek Arya <inferno@chromium.org> | 2020-12-11 11:38:43 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 11:38:43 -0800 |
commit | 0dd7aaca327b68c0cb69fdc10092b6290ba797b6 (patch) | |
tree | 5a6078f332827ae808991ee5d1463807715c3114 | |
parent | 25988ca5f165f0a8fc803ebc73e144f0ff3c4bee (diff) |
Fix atheris integration. (#4824)
-rw-r--r-- | docs/getting-started/new-project-guide/python_lang.md | 2 | ||||
-rwxr-xr-x | infra/base-images/base-builder/compile | 8 | ||||
-rwxr-xr-x | projects/ujson/build.sh | 2 | ||||
-rwxr-xr-x | projects/ujson/json_differential_fuzzer.py | 2 | ||||
-rwxr-xr-x | projects/ujson/ujson_fuzzer.py | 2 |
5 files changed, 11 insertions, 5 deletions
diff --git a/docs/getting-started/new-project-guide/python_lang.md b/docs/getting-started/new-project-guide/python_lang.md index a8d97754..1ef6d6f5 100644 --- a/docs/getting-started/new-project-guide/python_lang.md +++ b/docs/getting-started/new-project-guide/python_lang.md @@ -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 diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile index a9790544..a71d4783 100755 --- a/infra/base-images/base-builder/compile +++ b/infra/base-images/base-builder/compile @@ -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" diff --git a/projects/ujson/build.sh b/projects/ujson/build.sh index 5fb7eb2b..e269e15e 100755 --- a/projects/ujson/build.sh +++ b/projects/ujson/build.sh @@ -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 diff --git a/projects/ujson/json_differential_fuzzer.py b/projects/ujson/json_differential_fuzzer.py index b5fad6c2..fd26de18 100755 --- a/projects/ujson/json_differential_fuzzer.py +++ b/projects/ujson/json_differential_fuzzer.py @@ -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 diff --git a/projects/ujson/ujson_fuzzer.py b/projects/ujson/ujson_fuzzer.py index 51b33a9f..c785ec6c 100755 --- a/projects/ujson/ujson_fuzzer.py +++ b/projects/ujson/ujson_fuzzer.py @@ -29,7 +29,7 @@ coverage. """ import sys -import atheris +import atheris_no_libfuzzer as atheris import ujson |