aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/base-images
diff options
context:
space:
mode:
authorGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2021-01-25 09:14:11 -0800
committerGravatar GitHub <noreply@github.com>2021-01-25 09:14:11 -0800
commit665e4898215c25a47dd29139f46c4f47f8139417 (patch)
treed90f9a8c530086678b6f9aa04e36aff9e0bb116c /infra/base-images
parent0ac841a1a40c7ef9def6b65834cf823c7f298e23 (diff)
[afl++] Use AFL++ instead of AFL for fuzzing. (#5046)
Diffstat (limited to 'infra/base-images')
-rw-r--r--infra/base-images/base-builder/Dockerfile4
-rwxr-xr-xinfra/base-images/base-builder/compile_afl14
2 files changed, 14 insertions, 4 deletions
diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile
index 5a894ce1..2874a0e6 100644
--- a/infra/base-images/base-builder/Dockerfile
+++ b/infra/base-images/base-builder/Dockerfile
@@ -149,6 +149,10 @@ WORKDIR $SRC
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
+
RUN cd $SRC && \
curl -L -O https://github.com/google/honggfuzz/archive/oss-fuzz.tar.gz && \
mkdir honggfuzz && \
diff --git a/infra/base-images/base-builder/compile_afl b/infra/base-images/base-builder/compile_afl
index a428bee5..945aa1ca 100755
--- a/infra/base-images/base-builder/compile_afl
+++ b/infra/base-images/base-builder/compile_afl
@@ -29,8 +29,8 @@ ar r $LIB_FUZZING_ENGINE $WORK/afl/*.o
popd > /dev/null
rm -rf $WORK/afl
-# Build and copy afl tools necessary for fuzzing.
-pushd $SRC/afl > /dev/null
+# Build and copy afl++ tools necessary for fuzzing.
+pushd $SRC/aflplusplus > /dev/null
# Unset CFLAGS and CXXFLAGS while building AFL since we don't want to slow it
# down with sanitizers.
@@ -38,11 +38,17 @@ INITIAL_CXXFLAGS=$CXXFLAGS
INITIAL_CFLAGS=$CFLAGS
unset CXXFLAGS
unset CFLAGS
-make clean && AFL_NO_X86=1 make
+
+make clean
+AFL_NO_X86=1 PYTHON_INCLUDE=/ make
+make -C utils/aflpp_driver
+
CFLAGS=$INITIAL_CFLAGS
CXXFLAGS=$INITIAL_CXXFLAGS
-find . -name 'afl-*' -executable -type f | xargs cp -t $OUT
+# 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
popd > /dev/null
echo " done."