From d50b5a8aabdfd2ad6ce9730d7eebe08d5aabe428 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sat, 27 May 2023 12:31:49 +1000 Subject: [PATCH 1/3] Run fuzz/generate-files.sh No manual changes, just run the script so we are in a "clean" state. --- .github/workflows/fuzz.yml | 2 +- fuzz/Cargo.toml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 41deb44c..5471517d 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -16,8 +16,8 @@ jobs: fail-fast: false matrix: fuzz_target: [ -simple_http, minreq_http, +simple_http, ] steps: - name: Install test dependencies diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index e162c065..759926cb 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -12,10 +12,10 @@ cargo-fuzz = true honggfuzz = { version = "0.5.55", default-features = false } jsonrpc = { path = "..", features = ["minreq_http"] } -[[bin]] -name = "simple_http" -path = "fuzz_targets/simple_http.rs" - [[bin]] name = "minreq_http" path = "fuzz_targets/minreq_http.rs" + +[[bin]] +name = "simple_http" +path = "fuzz_targets/simple_http.rs" From 89930cc4b8c63cf8454f0f08f552da3c2d5a2235 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sat, 27 May 2023 12:33:15 +1000 Subject: [PATCH 2/3] fuzz: Use correct cfg flags The `generate-files.sh` script was copied from `rust-bitcoin`, looks like who ever copied it forgot to read it (*cough* Tobin) ;) Use yaml pipe syntax to write multiline shell code; use the correct cfg flags, echoing them before running the fuzz script. --- .github/workflows/fuzz.yml | 6 ++++-- fuzz/generate-files.sh | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 5471517d..b323df67 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -37,8 +37,10 @@ simple_http, override: true profile: minimal - name: fuzz - run: if [[ "${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then export RUSTFLAGS='--cfg=hashes_fuzz --cfg=secp256k1_fuzz'; fi - run: cd fuzz && ./fuzz.sh "${{ matrix.fuzz_target }}" + run: | + export RUSTFLAGS='--cfg=jsonrpc_fuzz' + echo "Using RUSTFLAGS $RUSTFLAGS" + cd fuzz && ./fuzz.sh "${{ matrix.fuzz_target }}" - run: echo "${{ matrix.fuzz_target }}" >executed_${{ matrix.fuzz_target }} - uses: actions/upload-artifact@v2 with: diff --git a/fuzz/generate-files.sh b/fuzz/generate-files.sh index 279002d6..6567b5d0 100755 --- a/fuzz/generate-files.sh +++ b/fuzz/generate-files.sh @@ -74,8 +74,10 @@ $(for name in $(listTargetNames); do echo "$name,"; done) override: true profile: minimal - name: fuzz - run: if [[ "\${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then export RUSTFLAGS='--cfg=hashes_fuzz --cfg=secp256k1_fuzz'; fi - run: cd fuzz && ./fuzz.sh "\${{ matrix.fuzz_target }}" + run: | + export RUSTFLAGS='--cfg=jsonrpc_fuzz' + echo "Using RUSTFLAGS \$RUSTFLAGS" + cd fuzz && ./fuzz.sh "\${{ matrix.fuzz_target }}" - run: echo "\${{ matrix.fuzz_target }}" >executed_\${{ matrix.fuzz_target }} - uses: actions/upload-artifact@v2 with: From 87338f3677364ca377a887c53673fcdb2513a445 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sun, 28 May 2023 12:51:47 +1000 Subject: [PATCH 3/3] Use Rust 1.69 to run the fuzzer Rust 1.58 doesn't like usage of `Mutex`, switching to Rust 1.69 for fuzzing resolves the issue. Do not use `stable` because it has broken in the past with `hongfuzz`. --- .github/workflows/fuzz.yml | 2 +- fuzz/generate-files.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index b323df67..0610aecf 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -33,7 +33,7 @@ simple_http, key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - uses: actions-rs/toolchain@v1 with: - toolchain: 1.58 + toolchain: 1.69 override: true profile: minimal - name: fuzz diff --git a/fuzz/generate-files.sh b/fuzz/generate-files.sh index 6567b5d0..a93b5d05 100755 --- a/fuzz/generate-files.sh +++ b/fuzz/generate-files.sh @@ -70,7 +70,7 @@ $(for name in $(listTargetNames); do echo "$name,"; done) key: cache-\${{ matrix.target }}-\${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - uses: actions-rs/toolchain@v1 with: - toolchain: 1.58 + toolchain: 1.69 override: true profile: minimal - name: fuzz