From c7910f4561ec23e1aad5ca22e45cb6e671826922 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 30 Aug 2022 17:15:31 +0000 Subject: [PATCH 1/4] Revert "Temporarily disable fuzzing" This reverts commit 720ea29865c64e03a2b0c872e20e0dbf99cf305e. --- .github/workflows/fuzz.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 81ceff81..be1ea6d8 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -1,7 +1,6 @@ name: Fuzz -# Temporarily disable job until someone works out how to fix honggfuzz. -on: [] +on: [push, pull_request] jobs: From 0a32525862b665bd93bc483d1926020c4f2294d9 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 30 Aug 2022 17:19:39 +0000 Subject: [PATCH 2/4] fuzz: disable features in honggfuzz --- .github/workflows/fuzz.yml | 2 +- fuzz/Cargo.toml | 2 +- fuzz/travis-fuzz.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index be1ea6d8..0de9c3e1 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -30,7 +30,7 @@ jobs: toolchain: 1.58 override: true profile: minimal - - run: cargo install honggfuzz + - run: cargo install honggfuzz --no-default-features if: steps.cache-fuzz.outputs.cache-hit != 'true' - run: echo "HFUZZ_RUN_ARGS=\"--run_time 30 --exit_upon_crash -v -f hfuzz_input/${{ matrix.fuzz_target }}/input\"" >> $GITHUB_ENV - name: fuzz diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index b893483b..927a3b37 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -12,7 +12,7 @@ afl_fuzz = ["afl"] honggfuzz_fuzz = ["honggfuzz"] [dependencies] -honggfuzz = { version = "0.5", optional = true } +honggfuzz = { version = "0.5", optional = true, default-features = false } afl = { version = "0.4", optional = true } bitcoin = { path = ".." } diff --git a/fuzz/travis-fuzz.sh b/fuzz/travis-fuzz.sh index 8f699815..662472c0 100755 --- a/fuzz/travis-fuzz.sh +++ b/fuzz/travis-fuzz.sh @@ -9,7 +9,7 @@ if [ ${incorrectFilenames} -gt 0 ]; then fi # Testing -cargo install --force honggfuzz +cargo install --force honggfuzz --no-default-features for TARGET in fuzz_targets/*; do FILENAME=$(basename $TARGET) FILE="${FILENAME%.*}" From 407cbca11124717f6eb7ade942d6e4cb494dfa8b Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 30 Aug 2022 20:04:23 +0000 Subject: [PATCH 3/4] fuzz: remove mysteriously-not-necessary quotes from gh action script --- .github/workflows/fuzz.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 0de9c3e1..48f96c3d 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -32,7 +32,7 @@ jobs: profile: minimal - run: cargo install honggfuzz --no-default-features if: steps.cache-fuzz.outputs.cache-hit != 'true' - - run: echo "HFUZZ_RUN_ARGS=\"--run_time 30 --exit_upon_crash -v -f hfuzz_input/${{ matrix.fuzz_target }}/input\"" >> $GITHUB_ENV + - run: echo "HFUZZ_RUN_ARGS=--run_time 30 --exit_upon_crash -v -f hfuzz_input/${{ matrix.fuzz_target }}/input" >> $GITHUB_ENV - name: fuzz run: cd fuzz && cargo hfuzz run ${{ matrix.fuzz_target }} - run: echo "${{ matrix.fuzz_target }}.rs" >executed_${{ matrix.fuzz_target }} From d25aba8ca0225a560e88e183b0db69dd1bd019a1 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 30 Aug 2022 20:22:47 +0000 Subject: [PATCH 4/4] fuzz: use travis-fuzz.sh in CI --- .github/workflows/fuzz.yml | 7 +------ fuzz/travis-fuzz.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 48f96c3d..d698a68c 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -7,8 +7,6 @@ jobs: fuzz: if: ${{ !github.event.act }} runs-on: ubuntu-20.04 - env: - HFUZZ_BUILD_ARGS: "--features honggfuzz_fuzz" strategy: fail-fast: false matrix: @@ -30,11 +28,8 @@ jobs: toolchain: 1.58 override: true profile: minimal - - run: cargo install honggfuzz --no-default-features - if: steps.cache-fuzz.outputs.cache-hit != 'true' - - run: echo "HFUZZ_RUN_ARGS=--run_time 30 --exit_upon_crash -v -f hfuzz_input/${{ matrix.fuzz_target }}/input" >> $GITHUB_ENV - name: fuzz - run: cd fuzz && cargo hfuzz run ${{ matrix.fuzz_target }} + run: cd fuzz && ./travis-fuzz.sh "${{ matrix.fuzz_target }}" - run: echo "${{ matrix.fuzz_target }}.rs" >executed_${{ matrix.fuzz_target }} - uses: actions/upload-artifact@v2 with: diff --git a/fuzz/travis-fuzz.sh b/fuzz/travis-fuzz.sh index 662472c0..1f75c9c0 100755 --- a/fuzz/travis-fuzz.sh +++ b/fuzz/travis-fuzz.sh @@ -8,9 +8,19 @@ if [ ${incorrectFilenames} -gt 0 ]; then exit 2 fi +if [ "$1" == "" ]; then + TARGETS=fuzz_targets/* +else + TARGETS=fuzz_targets/"$1".rs +fi + +cargo --version +rustc --version + # Testing cargo install --force honggfuzz --no-default-features -for TARGET in fuzz_targets/*; do +for TARGET in $TARGETS; do + echo "Fuzzing target $TARGET" FILENAME=$(basename $TARGET) FILE="${FILENAME%.*}" if [ -d hfuzz_input/$FILE ]; then