aboutsummaryrefslogtreecommitdiff
path: root/infra/base-images/base-builder
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-02-02 01:20:18 +0100
committerGitHub <noreply@github.com>2021-02-01 16:20:18 -0800
commit05cac485d3f82263f551bea4cba977fee8627536 (patch)
treed9f1999256890a54dfc9d569333693268b58fadf /infra/base-images/base-builder
parent95d3905ec9079ab42052a9e96b33de6aade77257 (diff)
downloadoss-fuzz-05cac485d3f82263f551bea4cba977fee8627536.tar.gz
Fixes afl++ installation (#5087)
* fix afl++ installation * update to experimental afl++ checkout, setting afl-clang-fast * update afl++ commit id to prevent unnecessary compile warnings * Remove dictionary links addition. Co-authored-by: Abhishek Arya <inferno@chromium.org>
Diffstat (limited to 'infra/base-images/base-builder')
-rw-r--r--infra/base-images/base-builder/Dockerfile2
-rw-r--r--[-rwxr-xr-x]infra/base-images/base-builder/compile_afl31
2 files changed, 13 insertions, 20 deletions
diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile
index 2874a0e67..0b0639658 100644
--- a/infra/base-images/base-builder/Dockerfile
+++ b/infra/base-images/base-builder/Dockerfile
@@ -151,7 +151,7 @@ RUN git clone -b stable https://github.com/google/AFL.git afl
RUN git clone -b stable https://github.com/AFLplusplus/AFLplusplus.git aflplusplus && \
cd aflplusplus && \
- git checkout 068bef5eab942df0a133c92522f2ab81b28ac636
+ git checkout 654f389e73c9fd5b7e141b33ea28ab0fdda3178f
RUN cd $SRC && \
curl -L -O https://github.com/google/honggfuzz/archive/oss-fuzz.tar.gz && \
diff --git a/infra/base-images/base-builder/compile_afl b/infra/base-images/base-builder/compile_afl
index feba5a0fc..2ea2c1dd7 100755..100644
--- a/infra/base-images/base-builder/compile_afl
+++ b/infra/base-images/base-builder/compile_afl
@@ -15,20 +15,6 @@
#
################################################################################
-echo "Compiling afl driver to $LIB_FUZZING_ENGINE"
-
-# afl needs its special coverage flags
-export COVERAGE_FLAGS="-fsanitize-coverage=trace-pc-guard"
-
-mkdir -p $WORK/afl
-pushd $WORK/afl > /dev/null
-# Add -Wno-pointer-sign to silence warning (AFL is compiled this way).
-$CC $CFLAGS -Wno-pointer-sign -c $SRC/afl/llvm_mode/afl-llvm-rt.o.c
-$CXX $CXXFLAGS -std=c++11 -O2 -c $SRC/libfuzzer/afl/*.cpp -I$SRC/libfuzzer
-ar r $LIB_FUZZING_ENGINE $WORK/afl/*.o
-popd > /dev/null
-rm -rf $WORK/afl
-
echo "Compiling afl++"
# Build and copy afl++ tools necessary for fuzzing.
@@ -40,17 +26,24 @@ INITIAL_CXXFLAGS=$CXXFLAGS
INITIAL_CFLAGS=$CFLAGS
unset CXXFLAGS
unset CFLAGS
-
make clean
AFL_NO_X86=1 PYTHON_INCLUDE=/ make
-make -C utils/aflpp_driver
+# ensure no coverage or fuzzer sanitizers are set
+CFLAGS=$(echo " $INITIAL_CFLAGS"|sed 's/-fsanitize=fuzz[a-z-]*//'|sed 's/-fsanitize-coverage=[a-z-]*//')
+CXXFLAGS=$(echo " $INITIAL_CXXFLAGS"|sed 's/-fsanitize=fuzz[a-z-]*//'|sed 's/-fsanitize-coverage=[a-z-]*//')
+export CFLAGS
+export CXXFLAGS
-CFLAGS=$INITIAL_CFLAGS
-CXXFLAGS=$INITIAL_CXXFLAGS
+# Build afl++ driver with existing CFLAGS, CXXFLAGS.
+make -C utils/aflpp_driver
+cp libAFLDriver.a $LIB_FUZZING_ENGINE
# Some important projects include libraries, copy those even when they don't
# start with "afl-". Use "sort -u" to avoid a warning about duplicates.
-ls afl-* *.a *.o *.so | sort -u | xargs cp -t $OUT
+ls afl-* *.txt *.a *.o *.so | sort -u | xargs cp -t $OUT
popd > /dev/null
+export CC="$SRC/aflplusplus/afl-clang-fast"
+export CXX="$SRC/aflplusplus/afl-clang-fast++"
+
echo " done."