From 527b892c1ddcc83207faaa71591e7f33a1a806a7 Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Sat, 6 Apr 2024 21:01:57 +0200 Subject: [PATCH] Separate fuzzer test in CI (#2010) * ci * ci * ci * aa * aa * a * a * a * fix * no fail fast * system * what is this lint... * a * clp * disk * ok no fastfail * no qemu for now, reenable monday --- .github/workflows/build_and_test.yml | 434 +++--------------- .../fuzzer-tester-prepare/action.yml | 66 +++ libafl/src/lib.rs | 3 +- libafl_bolts/src/lib.rs | 3 +- libafl_bolts/src/tuples.rs | 15 +- libafl_cc/src/lib.rs | 3 +- libafl_frida/src/alloc.rs | 2 +- libafl_frida/src/lib.rs | 3 +- libafl_qemu/src/lib.rs | 1 + libafl_targets/src/lib.rs | 3 +- scripts/test_all_fuzzers.sh | 27 +- 11 files changed, 162 insertions(+), 398 deletions(-) create mode 100644 .github/workflows/fuzzer-tester-prepare/action.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 5b038c4006..54ee7d3346 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -232,374 +232,76 @@ jobs: fuzzers: strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest] + fuzzer: + - ./fuzzers/fuzzbench_fork_qemu + - ./fuzzers/libfuzzer_stb_image_sugar + - ./fuzzers/nyx_libxml2_standalone + - ./fuzzers/baby_fuzzer_gramatron + - ./fuzzers/tinyinst_simple + - ./fuzzers/baby_fuzzer_with_forkexecutor + - ./fuzzers/baby_no_std + - ./fuzzers/baby_fuzzer_swap_differential + - ./fuzzers/baby_fuzzer_grimoire + - ./fuzzers/baby_fuzzer + - ./fuzzers/libfuzzer_libpng_launcher + - ./fuzzers/libfuzzer_libpng_accounting + - ./fuzzers/forkserver_libafl_cc + - ./fuzzers/libfuzzer_libpng_tcp_manager + - ./fuzzers/backtrace_baby_fuzzers + - ./fuzzers/fuzzbench_qemu + - ./fuzzers/nyx_libxml2_parallel + - ./fuzzers/qemu_launcher + - ./fuzzers/frida_gdiplus + - ./fuzzers/libfuzzer_stb_image_concolic + - ./fuzzers/nautilus_sync + # - ./fuzzers/qemu_cmin + # - ./fuzzers/qemu_systemmode + - ./fuzzers/push_harness + - ./fuzzers/libfuzzer_libpng_centralized + - ./fuzzers/baby_fuzzer_nautilus + - ./fuzzers/fuzzbench_text + - ./fuzzers/libfuzzer_libpng_cmin + - ./fuzzers/forkserver_simple + - ./fuzzers/baby_fuzzer_unicode + - ./fuzzers/libfuzzer_libpng_norestart + - ./fuzzers/baby_fuzzer_multi + - ./fuzzers/libafl_atheris + - ./fuzzers/frida_libpng + - ./fuzzers/fuzzbench_ctx + - ./fuzzers/fuzzbench_forkserver_cmplog + - ./fuzzers/push_stage_harness + - ./fuzzers/libfuzzer_libmozjpeg + - ./fuzzers/libfuzzer_libpng_aflpp_ui + - ./fuzzers/libfuzzer_libpng + - ./fuzzers/baby_fuzzer_wasm + - ./fuzzers/fuzzbench + - ./fuzzers/libfuzzer_stb_image + - ./fuzzers/fuzzbench_forkserver + - ./fuzzers/libfuzzer_windows_asan + - ./fuzzers/baby_fuzzer_minimizing + # - ./fuzzers/qemu_coverage + - ./fuzzers/frida_executable_libpng + - ./fuzzers/tutorial + - ./fuzzers/baby_fuzzer_tokens + - ./fuzzers/backtrace_baby_fuzzers/rust_code_with_inprocess_executor + - ./fuzzers/backtrace_baby_fuzzers/c_code_with_fork_executor + - ./fuzzers/backtrace_baby_fuzzers/command_executor + - ./fuzzers/backtrace_baby_fuzzers/forkserver_executor + - ./fuzzers/backtrace_baby_fuzzers/c_code_with_inprocess_executor + - ./fuzzers/backtrace_baby_fuzzers/rust_code_with_fork_executor runs-on: ${{ matrix.os }} steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # if set to "true" but frees about 6 GB - tool-cache: false - - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: true - - name: Add nightly rustfmt and clippy - run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade - - name: Add no_std toolchain - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - name: Add wasm target - run: rustup target add wasm32-unknown-unknown - - name: Install ucd-generate - run: cargo install -f ucd-generate - - name: Remove obsolete llvm (Linux) - run: sudo apt purge llvm* clang* - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - directory: ${{ runner.temp }}/llvm - version: 17 - - name: Install deps - run: sudo apt update && sudo apt install nasm ninja-build gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-i386-cross libc6-dev libc6-dev-i386 lib32gcc-11-dev lib32stdc++-11-dev libgtk-3-dev pax-utils libz3-dev - - name: pip install - run: python3 -m pip install msgpack jinja2 find_libpython - # Note that nproc needs to have coreutils installed on macOS, so the order of CI commands matters. - - name: enable mult-thread for `make` - run: export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" - - name: install cargo-make - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cargo-make - - name: install wasm-pack - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: wasm-pack - - name: install cxxbridge-cmd - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cxxbridge-cmd - - name: install chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: stable - - uses: actions/checkout@v3 - with: - submodules: true # recursively checkout submodules - fetch-depth: 0 # to diff with origin/main - - uses: Swatinem/rust-cache@v2 - - name: Symlink Headers - if: runner.os == 'Linux' - # We can't install gcc-multilib which would usually do this for us due to collisions with other packages - run: sudo ln -s /usr/include/asm-generic /usr/include/asm - - name: Build and run example fuzzers (Linux) - if: runner.os == 'Linux' - run: RUN_ON_CI=1 LLVM_CONFIG=llvm-config ./scripts/test_all_fuzzers.sh - - qemu_fuzzers: - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - name: Free Disk Space (Ubuntu) - if: runner.os == 'Linux' - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # if set to "true" but frees about 6 GB - tool-cache: false - - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: true - - name: Add nightly rustfmt and clippy - run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade - - name: Add no_std toolchain - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - name: Add wasm target - run: rustup target add wasm32-unknown-unknown - - name: Install ucd-generate - run: cargo install -f ucd-generate - - name: Remove obsolete llvm (Linux) - if: runner.os == 'Linux' - run: sudo apt purge llvm* clang* - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - directory: ${{ runner.temp }}/llvm - version: 17 - - name: Install deps - run: sudo apt update && sudo apt install nasm ninja-build gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-i386-cross libc6-dev libc6-dev-i386 lib32gcc-11-dev lib32stdc++-11-dev libgtk-3-dev pax-utils libz3-dev qemu-utils - - name: pip install - run: python3 -m pip install msgpack jinja2 find_libpython - # Note that nproc needs to have coreutils installed on macOS, so the order of CI commands matters. - - name: enable mult-thread for `make` - run: export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" - - name: install cargo-make - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cargo-make - - name: install wasm-pack - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: wasm-pack - - name: install chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: stable - - uses: actions/checkout@v3 - with: - submodules: true # recursively checkout submodules - fetch-depth: 0 # to diff with origin/main - - uses: Swatinem/rust-cache@v2 - - name: Symlink Headers - if: runner.os == 'Linux' - # We can't install gcc-multilib which would usually do this for us due to collisions with other packages - run: sudo ln -s /usr/include/asm-generic /usr/include/asm - - name: Build and run example fuzzers (Linux) - if: runner.os == 'Linux' - run: RUN_ON_CI=1 RUN_QEMU_FUZZER=1 LLVM_CONFIG=llvm-config ./scripts/test_all_fuzzers.sh - - baby_fuzzers: - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - name: Free Disk Space (Ubuntu) - if: runner.os == 'Linux' - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # if set to "true" but frees about 6 GB - tool-cache: false - - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: true - - name: Add nightly rustfmt and clippy - run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade - - name: Add no_std toolchain - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - name: Add wasm target - run: rustup target add wasm32-unknown-unknown - - name: Install ucd-generate - run: cargo install -f ucd-generate - - name: Remove obsolete llvm (Linux) - if: runner.os == 'Linux' - run: sudo apt purge llvm* clang* - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - directory: ${{ runner.temp }}/llvm - version: 17 - - name: Install deps - run: sudo apt update && sudo apt install nasm ninja-build gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-i386-cross libc6-dev libc6-dev-i386 lib32gcc-11-dev lib32stdc++-11-dev libgtk-3-dev pax-utils libz3-dev - - name: pip install - run: python3 -m pip install msgpack jinja2 find_libpython - # Note that nproc needs to have coreutils installed on macOS, so the order of CI commands matters. - - name: enable mult-thread for `make` - run: export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" - - name: install cargo-make - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cargo-make - - name: install wasm-pack - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: wasm-pack - - name: install chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: stable - - uses: actions/checkout@v3 - with: - submodules: true # recursively checkout submodules - fetch-depth: 0 # to diff with origin/main - - uses: Swatinem/rust-cache@v2 - - name: Symlink Headers - if: runner.os == 'Linux' - # We can't install gcc-multilib which would usually do this for us due to collisions with other packages - run: sudo ln -s /usr/include/asm-generic /usr/include/asm - - name: Build and run example fuzzers (Linux) - if: runner.os == 'Linux' - run: RUN_ON_CI=1 RUN_BABY_FUZZER=1 LLVM_CONFIG=llvm-config ./scripts/test_all_fuzzers.sh - - libpng_fuzzers: - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - name: Free Disk Space (Ubuntu) - if: runner.os == 'Linux' - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # if set to "true" but frees about 6 GB - tool-cache: false - - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: true - - name: Add nightly rustfmt and clippy - run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade - - name: Add no_std toolchain - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - name: Add wasm target - run: rustup target add wasm32-unknown-unknown - - name: Install ucd-generate - run: cargo install -f ucd-generate - - name: Remove obsolete llvm (Linux) - if: runner.os == 'Linux' - run: sudo apt purge llvm* clang* - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - directory: ${{ runner.temp }}/llvm - version: 17 - - name: Install deps - run: sudo apt update && sudo apt install nasm ninja-build gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-i386-cross libc6-dev libc6-dev-i386 lib32gcc-11-dev lib32stdc++-11-dev libgtk-3-dev pax-utils libz3-dev - - name: pip install - run: python3 -m pip install msgpack jinja2 find_libpython - # Note that nproc needs to have coreutils installed on macOS, so the order of CI commands matters. - - name: enable mult-thread for `make` - run: export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" - - name: install cargo-make - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cargo-make - - name: install wasm-pack - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: wasm-pack - - name: install chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: stable - - uses: actions/checkout@v3 - with: - submodules: true # recursively checkout submodules - fetch-depth: 0 # to diff with origin/main - - uses: Swatinem/rust-cache@v2 - - name: Symlink Headers - if: runner.os == 'Linux' - # We can't install gcc-multilib which would usually do this for us due to collisions with other packages - run: sudo ln -s /usr/include/asm-generic /usr/include/asm - - name: Build and run example fuzzers (Linux) - if: runner.os == 'Linux' - run: RUN_ON_CI=1 RUN_LIBPNG_FUZZER=1 LLVM_CONFIG=llvm-config ./scripts/test_all_fuzzers.sh - - fuzzbench_fuzzers: - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - name: Free Disk Space (Ubuntu) - if: runner.os == 'Linux' - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # if set to "true" but frees about 6 GB - tool-cache: false - - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: true - - name: Add nightly rustfmt and clippy - run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade - - name: Add no_std toolchain - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - name: Add wasm target - run: rustup target add wasm32-unknown-unknown - - name: Install ucd-generate - run: cargo install -f ucd-generate - - name: Remove obsolete llvm (Linux) - if: runner.os == 'Linux' - run: sudo apt purge llvm* clang* - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - directory: ${{ runner.temp }}/llvm - version: 17 - - name: Install deps - run: sudo apt update && sudo apt install nasm ninja-build gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-i386-cross libc6-dev libc6-dev-i386 lib32gcc-11-dev lib32stdc++-11-dev libgtk-3-dev pax-utils libz3-dev - - name: pip install - run: python3 -m pip install msgpack jinja2 find_libpython - # Note that nproc needs to have coreutils installed on macOS, so the order of CI commands matters. - - name: enable mult-thread for `make` - run: export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" - - name: install cargo-make - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cargo-make - - name: install wasm-pack - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: wasm-pack - - name: install chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: stable - - uses: actions/checkout@v3 - with: - submodules: true # recursively checkout submodules - fetch-depth: 0 # to diff with origin/main - - uses: Swatinem/rust-cache@v2 - - name: Symlink Headers - if: runner.os == 'Linux' - # We can't install gcc-multilib which would usually do this for us due to collisions with other packages - run: sudo ln -s /usr/include/asm-generic /usr/include/asm - - name: Build and run example fuzzers (Linux) - if: runner.os == 'Linux' - run: RUN_ON_CI=1 RUN_FUZZBENCH_FUZZER=1 LLVM_CONFIG=llvm-config ./scripts/test_all_fuzzers.sh + - uses: actions/checkout@v3 + - uses: ./.github/workflows/fuzzer-tester-prepare + - name: Symlink Headers + if: runner.os == 'Linux' + shell: bash + run: sudo ln -s /usr/include/asm-generic /usr/include/asm + - name: Build and run example fuzzers (Linux) + if: runner.os == 'Linux' + shell: bash + run: RUN_ON_CI=1 LLVM_CONFIG=llvm-config ./scripts/test_all_fuzzers.sh ${{ matrix.fuzzer }} nostd-build: runs-on: ubuntu-latest diff --git a/.github/workflows/fuzzer-tester-prepare/action.yml b/.github/workflows/fuzzer-tester-prepare/action.yml new file mode 100644 index 0000000000..8a1fe05f10 --- /dev/null +++ b/.github/workflows/fuzzer-tester-prepare/action.yml @@ -0,0 +1,66 @@ +name: Setup Rust Environment +description: Sets up the Rust environment for the CI workflow +runs: + using: composite + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: Add nightly rustfmt and clippy + shell: bash + run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade + - name: Add no_std toolchain + shell: bash + run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu + - name: Add wasm target + shell: bash + run: rustup target add wasm32-unknown-unknown + - name: Install ucd-generate + shell: bash + run: cargo install -f ucd-generate + - name: Remove obsolete llvm (Linux) + if: runner.os == 'Linux' + shell: bash + run: sudo apt purge llvm* clang* + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + directory: ${{ runner.temp }}/llvm + version: 17 + - name: Install deps + shell: bash + run: sudo apt update && sudo apt install nasm ninja-build gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-i386-cross libc6-dev libc6-dev-i386 lib32gcc-11-dev lib32stdc++-11-dev libgtk-3-dev pax-utils libz3-dev + - name: pip install + shell: bash + run: python3 -m pip install msgpack jinja2 find_libpython + - name: enable mult-thread for `make` + shell: bash + run: export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" + - name: install cargo-make + uses: baptiste0928/cargo-install@v1.3.0 + with: + crate: cargo-make + - name: install wasm-pack + uses: baptiste0928/cargo-install@v1.3.0 + with: + crate: wasm-pack + - name: install cxxbridge-cmd + uses: baptiste0928/cargo-install@v1.3.0 + with: + crate: cxxbridge-cmd + - name: install chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: stable + - name: Symlink Headers + if: runner.os == 'Linux' + shell: bash + run: sudo ln -s /usr/include/asm-generic /usr/include/asm \ No newline at end of file diff --git a/libafl/src/lib.rs b/libafl/src/lib.rs index 019acd0594..2d7388a5f6 100644 --- a/libafl/src/lib.rs +++ b/libafl/src/lib.rs @@ -29,7 +29,8 @@ Welcome to `LibAFL` clippy::ptr_cast_constness, clippy::unsafe_derive_deserialize, clippy::similar_names, - clippy::too_many_lines + clippy::too_many_lines, + clippy::missing_transmute_annotations )] #![cfg_attr(not(test), warn( missing_debug_implementations, diff --git a/libafl_bolts/src/lib.rs b/libafl_bolts/src/lib.rs index 9501095a5d..564ca345d5 100644 --- a/libafl_bolts/src/lib.rs +++ b/libafl_bolts/src/lib.rs @@ -30,7 +30,8 @@ clippy::module_name_repetitions, clippy::ptr_cast_constness, clippy::negative_feature_names, - clippy::too_many_lines + clippy::too_many_lines, + clippy::missing_transmute_annotations )] #![cfg_attr(not(test), warn( missing_debug_implementations, diff --git a/libafl_bolts/src/tuples.rs b/libafl_bolts/src/tuples.rs index 57de864c72..f37bf3c0ea 100644 --- a/libafl_bolts/src/tuples.rs +++ b/libafl_bolts/src/tuples.rs @@ -272,7 +272,10 @@ where fn take<'a, T: 'static>(mut self) -> (Option<&'a T>, Self) { if TypeId::of::() == TypeId::of::() { let r = self.0.take(); - (unsafe { core::mem::transmute(r) }, self) + ( + unsafe { core::mem::transmute::, Option<&T>>(r) }, + self, + ) } else { let (r, tail) = self.1.take::(); (r, (self.0, tail)) @@ -288,7 +291,10 @@ where fn take<'a, T: 'static>(mut self) -> (Option<&'a T>, Self) { if TypeId::of::() == TypeId::of::() { let r = self.0.take(); - (unsafe { core::mem::transmute(r) }, self) + ( + unsafe { core::mem::transmute::, Option<&T>>(r) }, + self, + ) } else { let (r, tail) = self.1.take::(); (r, (self.0, tail)) @@ -316,7 +322,10 @@ where fn take<'a, T: 'static>(mut self) -> (Option<&'a mut T>, Self) { if TypeId::of::() == TypeId::of::() { let r = self.0.take(); - (unsafe { core::mem::transmute(r) }, self) + ( + unsafe { core::mem::transmute::, Option<&mut T>>(r) }, + self, + ) } else { let (r, tail) = self.1.take::(); (r, (self.0, tail)) diff --git a/libafl_cc/src/lib.rs b/libafl_cc/src/lib.rs index d81e038721..448963c446 100644 --- a/libafl_cc/src/lib.rs +++ b/libafl_cc/src/lib.rs @@ -13,7 +13,8 @@ clippy::missing_panics_doc, clippy::missing_docs_in_private_items, clippy::module_name_repetitions, - clippy::unreadable_literal + clippy::unreadable_literal, + clippy::missing_transmute_annotations )] #![cfg_attr(not(test), warn( missing_debug_implementations, diff --git a/libafl_frida/src/alloc.rs b/libafl_frida/src/alloc.rs index 0f8fca910b..6ce806ba60 100644 --- a/libafl_frida/src/alloc.rs +++ b/libafl_frida/src/alloc.rs @@ -276,7 +276,7 @@ impl Allocator { ) -> Option<&mut AllocationMetadata> { let mut metadatas: Vec<&mut AllocationMetadata> = self.allocations.values_mut().collect(); metadatas.sort_by(|a, b| a.address.cmp(&b.address)); - let mut offset_to_closest = i64::max_value(); + let mut offset_to_closest = i64::MAX; let mut closest = None; let ptr: i64 = ptr.try_into().unwrap(); for metadata in metadatas { diff --git a/libafl_frida/src/lib.rs b/libafl_frida/src/lib.rs index 738e0a56d3..c9b3eef569 100644 --- a/libafl_frida/src/lib.rs +++ b/libafl_frida/src/lib.rs @@ -20,7 +20,8 @@ Additional documentation is available in [the `LibAFL` book](https://aflplus.plu clippy::module_name_repetitions, clippy::unreadable_literal, clippy::ptr_cast_constness, - clippy::must_use_candidate + clippy::must_use_candidate, + clippy::missing_transmute_annotations )] #![cfg_attr(not(test), warn( missing_debug_implementations, diff --git a/libafl_qemu/src/lib.rs b/libafl_qemu/src/lib.rs index b42b35a954..ac4927bd0a 100644 --- a/libafl_qemu/src/lib.rs +++ b/libafl_qemu/src/lib.rs @@ -18,6 +18,7 @@ #![allow(clippy::transmute_ptr_to_ptr)] #![allow(clippy::ptr_cast_constness)] #![allow(clippy::too_many_arguments)] +#![allow(clippy::missing_transmute_annotations)] // Till they fix this buggy lint in clippy #![allow(clippy::borrow_as_ptr)] #![allow(clippy::borrow_deref_ref)] diff --git a/libafl_targets/src/lib.rs b/libafl_targets/src/lib.rs index b2fe9e294a..3cf7253649 100644 --- a/libafl_targets/src/lib.rs +++ b/libafl_targets/src/lib.rs @@ -14,7 +14,8 @@ clippy::missing_panics_doc, clippy::missing_docs_in_private_items, clippy::module_name_repetitions, - clippy::pub_underscore_fields + clippy::pub_underscore_fields, + clippy::missing_transmute_annotations )] #![cfg_attr(not(test), warn( missing_debug_implementations, diff --git a/scripts/test_all_fuzzers.sh b/scripts/test_all_fuzzers.sh index 4d561e544a..94ecf2cfc5 100755 --- a/scripts/test_all_fuzzers.sh +++ b/scripts/test_all_fuzzers.sh @@ -6,35 +6,16 @@ cd "$SCRIPT_DIR/.." || exit 1 if [[ -z "${RUN_ON_CI}" ]]; then - fuzzers=$(find ./fuzzers -mindepth 1 -maxdepth 1 -type d) - backtrace_fuzzers=$(find ./fuzzers/backtrace_baby_fuzzers -mindepth 1 -maxdepth 1 -type d) + fuzzer_to_test="$1" else - cargo build -p build_and_test_fuzzers - fuzzers=$(cargo run -p build_and_test_fuzzers -- "remotes/origin/main" "HEAD^") - backtrace_fuzzers="" + fuzzer_to_test="$1" export PROFILE=dev export PROFILE_DIR=debug fi -if [[ -n "${RUN_FUZZBENCH_FUZZER}" ]]; then - fuzzers=$(echo "$fuzzers" | tr ' ' '\n' | grep "fuzzbench") - backtrace_fuzzers=$(echo "$backtrace_fuzzers" | tr ' ' '\n' | grep "fuzzbench") -elif [[ -n "${RUN_QEMU_FUZZER}" ]]; then - fuzzers=$(echo "$fuzzers" | tr ' ' '\n' | grep "qemu") - backtrace_fuzzers=$(echo "$backtrace_fuzzers" | tr ' ' '\n' | grep "qemu") -elif [[ -n "${RUN_BABY_FUZZER}" ]]; then - fuzzers=$(echo "$fuzzers" | tr ' ' '\n' | grep "baby") - backtrace_fuzzers=$(echo "$backtrace_fuzzers" | tr ' ' '\n' | grep "baby") -elif [[ -n "${RUN_LIBPNG_FUZZER}" ]]; then - fuzzers=$(echo "$fuzzers" | tr ' ' '\n' | grep "libpng") - backtrace_fuzzers=$(echo "$backtrace_fuzzers" | tr ' ' '\n' | grep "libpng") -else - fuzzers=$(echo "$fuzzers" | tr ' ' '\n' | grep -v "qemu" | grep -v "baby" | grep -v "libpng" | grep -v "fuzzbench") - backtrace_fuzzers=$(echo "$backtrace_fuzzers" | tr ' ' '\n' | grep -v "qemu" | grep -v "baby" | grep -v "libpng" | grep - v "fuzzbench") -fi - libafl=$(pwd) +echo "Testing" "$fuzzer_to_test" # build with a shared target dir for all fuzzers. this should speed up # compilation a bit, and allows for easier artifact management (caching and # cargo clean). @@ -57,7 +38,7 @@ do done # shellcheck disable=SC2116 -for fuzzer in $(echo "$fuzzers" "$backtrace_fuzzers"); +for fuzzer in $(echo "$fuzzer_to_test"); do # skip nyx test on non-linux platforms if [[ $fuzzer == *"nyx_"* ]] && [[ $(uname -s) != "Linux" ]]; then