diff --git a/docs/getting-started/new-project-guide/python_lang.md b/docs/getting-started/new-project-guide/python_lang.md index a8d97754a..1ef6d6f5a 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 a97905444..a71d47834 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 5fb7eb2b5..e269e15ed 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 b5fad6c23..fd26de18f 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 51b33a9ff..c785ec6ce 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