Skip to content

Commit e1c91d3

Browse files
committed
Merge #169: delete_nonreduced_fuzz_inputs: llvm 18, afl-cmin
56730ca delete_nonreduced_fuzz_inputs: also reduce with afl-cmin (dergoegge) 75c040f delete_nonreduced_fuzz_inputs: use llvm 18 (dergoegge) Pull request description: * Use llvm 18 * Minimize corpora with both afl++ and libfuzzer (#167) ACKs for top commit: maflcko: tested ACK 56730ca Tree-SHA512: d3b6b4a40b55ee012392f21fe68776b1c101b4820fac5b49db1d1cb292ac87e474acd96f35bb4de3dc6e821042726e067e5261d89ed30b79ccb014741360b3fd
2 parents f9b8456 + 56730ca commit e1c91d3

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

delete_nonreduced_fuzz_inputs.sh

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ apt install -y \
2020
git \
2121
build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 \
2222
libsqlite3-dev libevent-dev libboost-dev \
23-
clang llvm
23+
lsb-release wget software-properties-common gnupg
24+
25+
export LLVM_VERSION=18
26+
wget https://apt.llvm.org/llvm.sh && chmod +x ./llvm.sh
27+
./llvm.sh $LLVM_VERSION all
28+
ln -s $(which llvm-symbolizer-$LLVM_VERSION) /usr/bin/llvm-symbolizer
29+
30+
git clone --branch stable https://github.com/AFLplusplus/AFLplusplus
31+
make -C AFLplusplus LLVM_CONFIG=llvm-config-$LLVM_VERSION PERFORMANCE=1 install -j$(nproc)
2432

2533
git clone --depth=1 https://github.com/bitcoin-core/qa-assets.git
2634
(
@@ -37,10 +45,34 @@ git clone --depth=1 https://github.com/bitcoin/bitcoin.git
3745

3846
./autogen.sh
3947

48+
echo "Adding reduced seeds with afl-cmin"
49+
50+
./configure LDFLAGS="-fuse-ld=lld" CC=afl-clang-fast CXX=afl-clang-fast++ --enable-fuzz
51+
make clean
52+
make -j $(nproc)
53+
54+
WRITE_ALL_FUZZ_TARGETS_AND_ABORT="/tmp/a" "./src/test/fuzz/fuzz" || true
55+
readarray FUZZ_TARGETS < "/tmp/a"
56+
for fuzz_target in ${FUZZ_TARGETS[@]}; do
57+
if [ -d "../all_inputs/$fuzz_target" ]; then
58+
mkdir --parents ../qa-assets/"${FUZZ_INPUTS_DIR}"/$fuzz_target
59+
# Allow timeouts and crashes with "-A", "-T all" to use all available cores
60+
FUZZ=$fuzz_target afl-cmin -T all -A -i ../all_inputs/$fuzz_target -o ../qa-assets/"${FUZZ_INPUTS_DIR}"/$fuzz_target -- ./src/test/fuzz/fuzz
61+
else
62+
echo "No input corpus for $fuzz_target (ignoring)"
63+
fi
64+
done
65+
66+
(
67+
cd ../qa-assets
68+
git add "${FUZZ_INPUTS_DIR}"
69+
git commit -m "Reduced inputs for afl-cmin"
70+
)
71+
4072
for sanitizer in {"fuzzer","fuzzer,address,undefined,integer"}; do
4173
echo "Adding reduced seeds for sanitizer=${sanitizer}"
4274

43-
./configure CC=clang CXX=clang++ --enable-fuzz --with-sanitizers="${sanitizer}"
75+
./configure LDFLAGS="-fuse-ld=lld" CC=clang-$LLVM_VERSION CXX=clang++-$LLVM_VERSION --enable-fuzz --with-sanitizers="${sanitizer}"
4476
make clean
4577
make -j $(nproc)
4678

0 commit comments

Comments
 (0)