diff options
author | 2020-11-19 22:41:12 -0800 | |
---|---|---|
committer | 2020-11-19 22:41:12 -0800 | |
commit | 5e3f47dba6323aef4a85796a188ddf4fc0e445e2 (patch) | |
tree | 0b3e2fb97b7d2d593200988e537e92740f58ab03 /infra | |
parent | e81d27e287007d9bb490349ed492ce430e31badc (diff) |
Fix ujson python fuzzing. (#4667)
* Fix ujson python fuzzing.
* Fix.
* Improve integration.
* Remove preload, stick with wrapper with /bin/sh.
* Update build.sh
Diffstat (limited to 'infra')
-rwxr-xr-x | infra/base-images/base-builder/compile | 19 | ||||
-rwxr-xr-x | infra/base-images/base-runner/test_all | 6 |
2 files changed, 23 insertions, 2 deletions
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile index cdbbfe0a..8dcee8ca 100755 --- a/infra/base-images/base-builder/compile +++ b/infra/base-images/base-builder/compile @@ -22,6 +22,21 @@ if [ "$SANITIZER" = "dataflow" ] && [ "$FUZZING_ENGINE" != "dataflow" ]; then exit 1 fi +if [ "$FUZZING_LANGUAGE" = "python" ]; then + if [ "$FUZZING_ENGINE" != "libfuzzer" ]; then + echo "ERROR: Python projects can be fuzzed with libFuzzer engine only." + exit 1 + fi + if [ "$SANITIZER" != "address" ]; then + echo "ERROR: Python projects can be fuzzed with AddressSanitizer only." + exit 1 + fi + if [ "$ARCHITECTURE" != "x86_64" ]; then + echo "ERROR: Python projects can be fuzzed on x86_64 architecture only." + exit 1 + fi +fi + if [ -z "${SANITIZER_FLAGS-}" ]; then FLAGS_VAR="SANITIZER_FLAGS_${SANITIZER}" export SANITIZER_FLAGS=${!FLAGS_VAR-} @@ -90,6 +105,10 @@ echo "---------------------------------------------------------------" BUILD_CMD="bash -eux $SRC/build.sh" +if [ "$FUZZING_LANGUAGE" = "python" ]; then + cp $(find $(llvm-config --libdir) -name "libclang_rt.asan-x86_64.so") $OUT/ +fi + # We need to preserve source code files for generating a code coverage report. # We need exact files that were compiled, so copy both $SRC and $WORK dirs. COPY_SOURCES_CMD="cp -rL --parents $SRC $WORK /usr/include /usr/local/include $GOPATH $OUT" diff --git a/infra/base-images/base-runner/test_all b/infra/base-images/base-runner/test_all index d2ddea66..a4fb58cd 100755 --- a/infra/base-images/base-runner/test_all +++ b/infra/base-images/base-runner/test_all @@ -47,8 +47,10 @@ export OUT=$TMP_FUZZER_DIR # Main loop that iterates through all fuzz targets and runs the check. for FUZZER_BINARY in $(find $TMP_FUZZER_DIR -maxdepth 1 -executable -type f); do - if file "$FUZZER_BINARY" | grep -v ELF > /dev/null 2>&1; then - continue + if [ "$FUZZING_LANGUAGE" != "python" ]; then + if file "$FUZZER_BINARY" | grep -v ELF > /dev/null 2>&1; then + continue + fi fi # Continue if not a fuzz target. |