From b8e6390bdd2b1351ffd67f2e5e4797f05baf5a59 Mon Sep 17 00:00:00 2001 From: Paul Dreik Date: Thu, 25 Aug 2022 10:04:32 +0200 Subject: [PATCH] add script for building with afl --- tests/fuzzers/afl/build-afl.sh | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 tests/fuzzers/afl/build-afl.sh diff --git a/tests/fuzzers/afl/build-afl.sh b/tests/fuzzers/afl/build-afl.sh new file mode 100755 index 00000000..b6f7c41a --- /dev/null +++ b/tests/fuzzers/afl/build-afl.sh @@ -0,0 +1,56 @@ +#/bin/sh +# +# this creates builds which can be used to fuzz with afl +# +# by Paul Dreik 20220825 + +set -eux + +here=$(dirname $0) +gitroot=$(git -C $here rev-parse --show-toplevel) + + +################################### +# afl clang +export AFL_USE_ASAN=1 +export AFL_USE_UBSAN=1 + +target=$here/build-afl-clang + +cmake \ +-DCMAKE_C_COMPILER=afl-clang-fast \ +-S $gitroot -B $target + +cmake --build $target -j $(nproc) + +################################### +# afl clang, with asserts disabled + +target=$here/build-afl-clang-ndebug + +cmake \ +-DCMAKE_C_COMPILER=afl-clang-fast \ +-DCMAKE_C_FLAGS="-g -DNDEBUG" \ +-S $gitroot -B $target + +cmake --build $target -j $(nproc) + +################################### +# sanitizer build with asserts disabled +target=$here/build-clang-release-replay +cmake \ +-DCMAKE_C_COMPILER=clang-14 \ +-DCMAKE_C_FLAGS="-g -fsanitize=address,undefined -O3 -DNDEBUG" \ +-S $gitroot -B $target + +cmake --build $target -j $(nproc) + +################################### +# sanitizer build with asserts enabled +target=$here/build-clang-debug-replay +cmake \ +-DCMAKE_C_COMPILER=clang-14 \ +-DCMAKE_C_FLAGS="-g -fsanitize=address,undefined -O3" \ +-S $gitroot -B $target + +cmake --build $target -j $(nproc)