From e98480cee7870d82c1a16e3dfff469fea6b6a7c2 Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Wed, 17 Jun 2026 17:39:22 +0100 Subject: [PATCH] Correctly restore unstable encoding corpus and create tokio runtime only once per process Signed-off-by: Robert Kruszewski --- .github/workflows/run-fuzzer.yml | 3 ++- fuzz/fuzz_targets/compress_gpu.rs | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-fuzzer.yml b/.github/workflows/run-fuzzer.yml index a3a41a1a53e..8ed37d8482f 100644 --- a/.github/workflows/run-fuzzer.yml +++ b/.github/workflows/run-fuzzer.yml @@ -116,6 +116,7 @@ jobs: - name: Run fuzzing target id: fuzz run: | + CORPUS_DIR="fuzz/corpus/${FUZZ_NAME}" FEATURES_FLAG="" if [ -n "${{ inputs.extra_features }}" ]; then FEATURES_FLAG="--features ${{ inputs.extra_features }}" @@ -127,7 +128,7 @@ jobs: ${{ inputs.extra_env }} RUST_BACKTRACE=1 \ cargo +$NIGHTLY_TOOLCHAIN fuzz run --release --debug-assertions \ $FEATURES_FLAG \ - ${{ inputs.fuzz_target }} -- \ + ${{ inputs.fuzz_target }} "$CORPUS_DIR" -- \ $FORK_FLAG -max_total_time=${{ inputs.max_time }} -rss_limit_mb=0 \ 2>&1 | tee fuzz_output.log continue-on-error: true diff --git a/fuzz/fuzz_targets/compress_gpu.rs b/fuzz/fuzz_targets/compress_gpu.rs index f88df52d2d5..91d7e9b9f9d 100644 --- a/fuzz/fuzz_targets/compress_gpu.rs +++ b/fuzz/fuzz_targets/compress_gpu.rs @@ -4,20 +4,21 @@ #![no_main] #![expect(clippy::unwrap_used)] +use std::sync::LazyLock; + use libfuzzer_sys::Corpus; use libfuzzer_sys::fuzz_target; +use tokio::runtime::Builder; +use tokio::runtime::Runtime; use vortex_error::vortex_panic; use vortex_fuzz::FuzzCompressGpu; use vortex_fuzz::run_compress_gpu; -fuzz_target!(|fuzz: FuzzCompressGpu| -> Corpus { - // Use tokio runtime to run async GPU fuzzer - let rt = tokio::runtime::Builder::new_current_thread() - .enable_all() - .build() - .unwrap(); +static RUNTIME: LazyLock = + LazyLock::new(|| Builder::new_current_thread().enable_all().build().unwrap()); - match rt.block_on(run_compress_gpu(fuzz)) { +fuzz_target!(|fuzz: FuzzCompressGpu| -> Corpus { + match RUNTIME.block_on(run_compress_gpu(fuzz)) { Ok(true) => Corpus::Keep, Ok(false) => Corpus::Reject, Err(e) => {