CI: A few updates and fixes (#2023)

* CI: Don't run cargo clean in order to preserve build caches

* CI: run yaml formatter >:)

* CI: try sharing build caches between similar jobs

* CI: it looks like the `ucd-generate` tool is not used anymore

* CI: Sneak in merge queue support :)

* CI: split out `cargo fmt --check` job

* libafl_qemu injections: be more resilient about mapping paths
This commit is contained in:
Mrmaxmeier 2024-04-09 12:55:07 +02:00 committed by GitHub
parent 2cc560e727
commit f252469d86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 336 additions and 334 deletions

View File

@ -2,10 +2,11 @@ name: build and test
on: on:
push: push:
branches: [ main, 'pr/**' ] branches: [main, "pr/**"]
pull_request: pull_request:
branches: [ main ] branches: [main]
workflow_dispatch: workflow_dispatch:
merge_group:
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
concurrency: concurrency:
@ -16,7 +17,7 @@ jobs:
common: common:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Install mimetype - name: Install mimetype
@ -40,6 +41,10 @@ jobs:
crate: mdbook-linkcheck crate: mdbook-linkcheck
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: { shared-key: "ubuntu" }
if: runner.os == 'Linux'
- uses: Swatinem/rust-cache@v2
if: runner.os != 'Linux'
- name: Check for binary blobs - name: Check for binary blobs
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: ./scripts/check_for_blobs.sh run: ./scripts/check_for_blobs.sh
@ -75,6 +80,7 @@ jobs:
toolchain: stable toolchain: stable
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: { shared-key: "llvm-tester" }
- name: Install LLVM and Clang - name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1 uses: KyleMayes/install-llvm-action@v1
with: with:
@ -82,137 +88,126 @@ jobs:
- name: Build and test with llvm-${{ matrix.llvm-version }} - name: Build and test with llvm-${{ matrix.llvm-version }}
run: pwd && ls & cd libafl_cc && cargo build --release run: pwd && ls & cd libafl_cc && cargo build --release
ubuntu-doc: ubuntu-doc:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: ubuntu needs: ubuntu
steps: steps:
- name: Remove Dotnet & Haskell - name: Remove Dotnet & Haskell
run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Remove existing clang and LLVM - name: Remove existing clang and LLVM
run: sudo apt purge llvm* clang* lld* lldb* opt* run: sudo apt purge llvm* clang* lld* lldb* opt*
- name: Install and cache deps - name: Install and cache deps
run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
- name: Add nightly rustfmt and clippy - name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade
- name: Install ucd-generate - uses: actions/checkout@v3
run: cargo install -f ucd-generate - uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3 with: { shared-key: "ubuntu" }
- uses: Swatinem/rust-cache@v2 - name: Install LLVM and Clang
- name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1
uses: KyleMayes/install-llvm-action@v1 with:
with: directory: ${{ runner.temp }}/llvm
directory: ${{ runner.temp }}/llvm version: 17
version: 17 # ---- doc check ----
# ---- doc check ---- - name: Build Docs
- name: Build Docs run: RUSTFLAGS="--cfg docsrs" cargo +nightly doc --all-features
run: RUSTFLAGS="--cfg docsrs" cargo +nightly doc --all-features - name: Test Docs
- name: Test Docs run: RUSTFLAGS="--cfg docsrs" cargo +nightly test --doc --all-features
run: RUSTFLAGS="--cfg docsrs" cargo +nightly test --doc --all-features
ubuntu-miri: ubuntu-miri:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: ubuntu needs: ubuntu
steps: steps:
- name: Remove Dotnet & Haskell - name: Remove Dotnet & Haskell
run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Remove existing clang and LLVM - name: Remove existing clang and LLVM
run: sudo apt purge llvm* clang* lld* lldb* opt* run: sudo apt purge llvm* clang* lld* lldb* opt*
- name: Install and cache deps - name: Install and cache deps
run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
- name: Add nightly rustfmt and clippy - name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade
- name: Install ucd-generate - uses: actions/checkout@v3
run: cargo install -f ucd-generate - uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3 with: { shared-key: "ubuntu" }
- uses: Swatinem/rust-cache@v2 - name: Install LLVM and Clang
- name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1
uses: KyleMayes/install-llvm-action@v1 with:
with: directory: ${{ runner.temp }}/llvm
directory: ${{ runner.temp }}/llvm version: 17
version: 17 # --- miri undefined behavior test --
# --- miri undefined behavior test -- - name: Run miri tests
- name: Run miri tests run: RUST_BACKTRACE=1 MIRIFLAGS="-Zmiri-disable-isolation" cargo +nightly miri test
run: RUST_BACKTRACE=1 MIRIFLAGS="-Zmiri-disable-isolation" cargo +nightly miri test
ubuntu: ubuntu:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Remove Dotnet & Haskell - name: Remove Dotnet & Haskell
run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Remove existing clang and LLVM - name: Remove existing clang and LLVM
run: sudo apt purge llvm* clang* lld* lldb* opt* run: sudo apt purge llvm* clang* lld* lldb* opt*
- name: Install and cache deps - name: Install and cache deps
run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
- name: Add nightly rustfmt and clippy - name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade
- name: Install ucd-generate - uses: actions/checkout@v3
run: cargo install -f ucd-generate - uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3 with: { shared-key: "ubuntu" }
- uses: Swatinem/rust-cache@v2 - name: Install LLVM and Clang
- name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1
uses: KyleMayes/install-llvm-action@v1 with:
with: directory: ${{ runner.temp }}/llvm
directory: ${{ runner.temp }}/llvm version: 17
version: 17 # ---- format check ----
# ---- format check ---- # pcguard edges and pcguard hitcounts are not compatible and we need to build them seperately
# pcguard edges and pcguard hitcounts are not compatible and we need to build them seperately - name: Check pcguard edges
- name: Check pcguard edges run: cargo check --features=sancov_pcguard_edges
run: cargo check --features=sancov_pcguard_edges - name: Run clang-format style check for C/C++ programs.
- name: Format run: clang-format -n -Werror --style=file $(find . -type f \( -name '*.cpp' -o -iname '*.hpp' -o -name '*.cc' -o -name '*.cxx' -o -name '*.cc' -o -name '*.h' \) | grep -v '/target/' | grep -v 'libpng-1\.6\.37' | grep -v 'stb_image\.h' | grep -v 'dlmalloc\.c' | grep -v 'QEMU-Nyx')
run: cargo fmt -- --check - name: run shellcheck
- name: Cleanup run: shellcheck ./scripts/*.sh
run: cargo clean # ---- build normal and examples ----
- name: Run clang-format style check for C/C++ programs. - name: Run a normal build
run: clang-format -n -Werror --style=file $(find . -type f \( -name '*.cpp' -o -iname '*.hpp' -o -name '*.cc' -o -name '*.cxx' -o -name '*.cc' -o -name '*.h' \) | grep -v '/target/' | grep -v 'libpng-1\.6\.37' | grep -v 'stb_image\.h' | grep -v 'dlmalloc\.c' | grep -v 'QEMU-Nyx') run: cargo build --verbose
- name: run shellcheck - name: Build examples
run: shellcheck ./scripts/*.sh run: cargo build --examples --verbose
# ---- build normal and examples ----
- name: Run a normal build
run: cargo build --verbose
- name: Build examples
run: cargo build --examples --verbose
ubuntu-clippy: ubuntu-clippy:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: ubuntu needs: ubuntu
steps: steps:
- name: Remove Dotnet & Haskell - name: Remove Dotnet & Haskell
run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc run: rm -rf /usr/share/dotnet && rm -rf /opt/ghc
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Install and cache deps - name: Install and cache deps
run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
- name: Add nightly rustfmt and clippy - name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component clippy --allow-downgrade && rustup default nightly run: rustup toolchain install nightly --component clippy --allow-downgrade && rustup default nightly
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Install LLVM and Clang with: { shared-key: "ubuntu" }
uses: KyleMayes/install-llvm-action@v1 - name: Install LLVM and Clang
with: uses: KyleMayes/install-llvm-action@v1
directory: ${{ runner.temp }}/llvm with:
version: 17 directory: ${{ runner.temp }}/llvm
- name: Run clippy version: 17
run: ./scripts/clippy.sh - name: Run clippy
run: ./scripts/clippy.sh
# Clean up files to save up disk space
- name: Cleanup
run: cargo clean
# --- test embedding the libafl_libfuzzer_runtime library # --- test embedding the libafl_libfuzzer_runtime library
# Fix me plz # Fix me plz
@ -223,92 +218,105 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: ubuntu needs: ubuntu
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
components: llvm-tools components: llvm-tools
- name: Free Disk Space (Ubuntu) - name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main uses: jlumbroso/free-disk-space@main
with: with:
# this might remove tools that are actually needed, # this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB # if set to "true" but frees about 6 GB
tool-cache: false tool-cache: false
# all of these default to true, but feel free to set to # all of these default to true, but feel free to set to
# "false" if necessary for your workflow # "false" if necessary for your workflow
android: true android: true
dotnet: true dotnet: true
haskell: true haskell: true
large-packages: false large-packages: false
docker-images: true docker-images: true
swap-storage: true swap-storage: true
- name: Remove existing clang and LLVM - name: Remove existing clang and LLVM
run: sudo apt purge llvm* clang* run: sudo apt purge llvm* clang*
- name: Install and cache deps - name: Install and cache deps
run: sudo apt update && sudo apt install ninja-build clang-format shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev run: sudo apt update && sudo apt install ninja-build clang-format shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
- name: Install cargo-hack - name: Install cargo-hack
run: curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin run: curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Install ucd-generate - name: Add nightly
run: cargo install -f ucd-generate run: rustup toolchain install nightly --allow-downgrade
- name: Add nightly - uses: actions/checkout@v3
run: rustup toolchain install nightly --allow-downgrade - uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3 with: { shared-key: "ubuntu" }
- uses: Swatinem/rust-cache@v2 - name: Install LLVM and Clang
- name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1
uses: KyleMayes/install-llvm-action@v1 with:
with: directory: ${{ runner.temp }}/llvm
directory: ${{ runner.temp }}/llvm version: 17
version: 17 # ---- build and feature check ----
# ---- build and feature check ---- # cargo-hack's --feature-powerset would be nice here but libafl has a too many knobs
# cargo-hack's --feature-powerset would be nice here but libafl has a too many knobs - name: Check each feature
- name: Check each feature # Skipping `python` as it has to be built with the `maturin` tool
# Skipping `python` as it has to be built with the `maturin` tool # `agpl`, `nautilus` require nightly
# `agpl`, `nautilus` require nightly # `sancov_pcguard_edges` is tested seperatelyc
# `sancov_pcguard_edges` is tested seperatelyc run: LLVM_CONFIG=llvm-config cargo hack check --workspace --each-feature --clean-per-run --exclude-features=prelude,agpl,nautilus,python,sancov_pcguard_edges,arm,aarch64,i386,be,systemmode,whole_archive --no-dev-deps --exclude libafl_libfuzzer
run: LLVM_CONFIG=llvm-config cargo hack check --workspace --each-feature --clean-per-run --exclude-features=prelude,agpl,nautilus,python,sancov_pcguard_edges,arm,aarch64,i386,be,systemmode,whole_archive --no-dev-deps --exclude libafl_libfuzzer - name: Check nightly features
- name: Check nightly features run: cargo +nightly check --features=agpl && cargo +nightly check --features=nautilus
run: cargo +nightly check --features=agpl && cargo +nightly check --features=nautilus
ubuntu-concolic: ubuntu-concolic:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: ubuntu needs: ubuntu
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Install smoke test deps with: { shared-key: "ubuntu" }
run: sudo ./libafl_concolic/test/smoke_test_ubuntu_deps.sh - name: Install smoke test deps
- name: Run smoke test run: sudo ./libafl_concolic/test/smoke_test_ubuntu_deps.sh
run: ./libafl_concolic/test/smoke_test.sh - name: Run smoke test
run: ./libafl_concolic/test/smoke_test.sh
python-bindings: python-bindings:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Remove existing clang and LLVM - name: Remove existing clang and LLVM
run: sudo apt purge llvm* clang* run: sudo apt purge llvm* clang*
- name: Install LLVM and Clang - name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1 uses: KyleMayes/install-llvm-action@v1
with: with:
directory: ${{ runner.temp }}/llvm directory: ${{ runner.temp }}/llvm
version: 17 version: 17
- name: Install deps - name: Install deps
run: sudo apt-get install -y ninja-build python3-dev python3-pip python3-venv libz3-dev run: sudo apt-get install -y ninja-build python3-dev python3-pip python3-venv libz3-dev
- name: Install maturin - name: Install maturin
run: python3 -m pip install maturin run: python3 -m pip install maturin
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Run a maturin build - name: Run a maturin build
run: export LLVM_CONFIG=llvm-config-16 && cd ./bindings/pylibafl && python3 -m venv .env && . .env/bin/activate && pip install --upgrade --force-reinstall . && ./test.sh run: export LLVM_CONFIG=llvm-config-16 && cd ./bindings/pylibafl && python3 -m venv .env && . .env/bin/activate && pip install --upgrade --force-reinstall . && ./test.sh
- name: Run python test - name: Run python test
run: . ./bindings/pylibafl/.env/bin/activate # && cd ./fuzzers/python_qemu/ && python3 fuzzer.py 2>&1 | grep "Bye" run: . ./bindings/pylibafl/.env/bin/activate # && cd ./fuzzers/python_qemu/ && python3 fuzzer.py 2>&1 | grep "Bye"
cargo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: actions/checkout@v3
- name: Format Check
run: cargo fmt -- --check
fuzzers: fuzzers:
needs: ubuntu needs: ubuntu
@ -388,137 +396,135 @@ jobs:
nostd-build: nostd-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: nightly toolchain: nightly
override: true override: true
components: rustfmt, rust-src components: rustfmt, rust-src
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Add targets - name: Add targets
run: rustup target add arm-linux-androideabi && rustup target add thumbv6m-none-eabi run: rustup target add arm-linux-androideabi && rustup target add thumbv6m-none-eabi
- name: Build aarch64-unknown-none - name: Build aarch64-unknown-none
run: cd ./fuzzers/baby_no_std && cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --release && cd ../.. run: cd ./fuzzers/baby_no_std && cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --release && cd ../..
- name: run x86_64 until panic! - name: run x86_64 until panic!
run: cd ./fuzzers/baby_no_std && cargo +nightly run || test $? -ne 0 || exit 1 run: cd ./fuzzers/baby_no_std && cargo +nightly run || test $? -ne 0 || exit 1
- name: no_std tests - name: no_std tests
run: cd ./libafl && cargo test --no-default-features run: cd ./libafl && cargo test --no-default-features
nostd-clippy: nostd-clippy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: nightly toolchain: nightly
override: true override: true
components: rustfmt, clippy, rust-src components: rustfmt, clippy, rust-src
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Add targets - name: Add targets
run: rustup target add arm-linux-androideabi && rustup target add thumbv6m-none-eabi run: rustup target add arm-linux-androideabi && rustup target add thumbv6m-none-eabi
- name: libafl armv6m-none-eabi (32 bit no_std) clippy - name: libafl armv6m-none-eabi (32 bit no_std) clippy
run: cd ./libafl && cargo clippy --target thumbv6m-none-eabi --no-default-features run: cd ./libafl && cargo clippy --target thumbv6m-none-eabi --no-default-features
- name: Build no_std no_alloc bolts - name: Build no_std no_alloc bolts
run: cd ./libafl_bolts && cargo +nightly build -Zbuild-std=core --target aarch64-unknown-none --no-default-features -v --release && cd ../ run: cd ./libafl_bolts && cargo +nightly build -Zbuild-std=core --target aarch64-unknown-none --no-default-features -v --release && cd ../
build-docker: build-docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build docker - name: Build docker
run: docker build -t libafl . run: docker build -t libafl .
windows: windows:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Windows Build - name: Windows Build
run: cargo build --verbose run: cargo build --verbose
- name: Build docs - name: Build docs
run: cargo doc run: cargo doc
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
- name: Set LIBCLANG_PATH - name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
- name: install cargo-make - name: install cargo-make
run: cargo install --force cargo-make run: cargo install --force cargo-make
- name: install cxx bridge - name: install cxx bridge
run: cargo install cxxbridge-cmd run: cargo install cxxbridge-cmd
- name: Build fuzzers/libfuzzer_stb_image - name: Build fuzzers/libfuzzer_stb_image
run: cd fuzzers/libfuzzer_stb_image && cargo build --release run: cd fuzzers/libfuzzer_stb_image && cargo build --release
- name: Build fuzzers/frida_libpng - name: Build fuzzers/frida_libpng
run: cd fuzzers/frida_libpng/ && cargo make test run: cd fuzzers/frida_libpng/ && cargo make test
- name: Build fuzzers/frida_gdiplus - name: Build fuzzers/frida_gdiplus
run: cd fuzzers/frida_gdiplus/ && cargo make test && cargo make test_cmplog run: cd fuzzers/frida_gdiplus/ && cargo make test && cargo make test_cmplog
- name: Build fuzzers/tinyinst_simple - name: Build fuzzers/tinyinst_simple
run: cd fuzzers/tinyinst_simple/ && cargo make test run: cd fuzzers/tinyinst_simple/ && cargo make test
windows-clippy: windows-clippy:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Run clippy - name: Run clippy
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: clippy command: clippy
macos: macos:
runs-on: macOS-latest runs-on: macOS-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Add nightly rustfmt and clippy - name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade && rustup default nightly run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade && rustup default nightly
- name: Install ucd-generate - name: Install deps
run: cargo install -f ucd-generate run: brew install z3 gtk+3
- name: Install deps - name: Install cxxbridge
run: brew install z3 gtk+3 run: cargo install cxxbridge-cmd
- name: Install cxxbridge - uses: actions/checkout@v3
run: cargo install cxxbridge-cmd - uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3 - name: MacOS Build
- uses: Swatinem/rust-cache@v2 run: cargo build --verbose
- name: MacOS Build - name: Increase map sizes
run: cargo build --verbose run: ./scripts/shmem_limits_macos.sh
- name: Increase map sizes - name: Run Tests
run: ./scripts/shmem_limits_macos.sh run: cargo test
- name: Run Tests
run: cargo test
other_targets: other_targets:
runs-on: macOS-latest runs-on: macOS-latest
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- uses: nttld/setup-ndk@v1 - uses: nttld/setup-ndk@v1
with: with:
ndk-version: r25b ndk-version: r25b
- name: install ios - name: install ios
run: rustup target add aarch64-apple-ios run: rustup target add aarch64-apple-ios
- name: install android - name: install android
run: rustup target add aarch64-linux-android run: rustup target add aarch64-linux-android
- name: install cargo ndk - name: install cargo ndk
run: cargo install cargo-ndk run: cargo install cargo-ndk
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Build iOS - name: Build iOS
run: cargo build --target aarch64-apple-ios && cd libafl_frida && cargo build --target aarch64-apple-ios && cd .. run: cargo build --target aarch64-apple-ios && cd libafl_frida && cargo build --target aarch64-apple-ios && cd ..
- name: Build Android - name: Build Android
run: cargo ndk -t arm64-v8a build --release run: cargo ndk -t arm64-v8a build --release
#run: cargo build --target aarch64-linux-android #run: cargo build --target aarch64-linux-android
# TODO: Figure out how to properly build stuff with clang # TODO: Figure out how to properly build stuff with clang
#- name: Add clang path to $PATH env #- name: Add clang path to $PATH env
@ -533,32 +539,31 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
name: Simple build in FreeBSD name: Simple build in FreeBSD
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Test in FreeBSD - name: Test in FreeBSD
id: test id: test
uses: vmactions/freebsd-vm@v1 uses: vmactions/freebsd-vm@v1
with: with:
usesh: true usesh: true
sync: rsync sync: rsync
copyback: false copyback: false
mem: 2048 mem: 2048
release: 13.2 release: 13.2
prepare: | prepare: |
pkg install -y curl bash sudo llvm16 pkg install -y curl bash sudo llvm16
curl https://sh.rustup.rs -sSf | sh -s -- -y curl https://sh.rustup.rs -sSf | sh -s -- -y
run: | run: |
freebsd-version freebsd-version
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
rustup toolchain install nightly rustup toolchain install nightly
cargo install -f ucd-generate export LLVM_CONFIG=/usr/local/bin/llvm-config16
export LLVM_CONFIG=/usr/local/bin/llvm-config16 pwd
pwd ls -lah
ls -lah echo "local/bin"
echo "local/bin" ls -lah /usr/local/bin/
ls -lah /usr/local/bin/ which llvm-config
which llvm-config chmod +x ./scripts/clippy.sh
chmod +x ./scripts/clippy.sh bash ./scripts/shmem_limits_fbsd.sh
bash ./scripts/shmem_limits_fbsd.sh bash ./scripts/clippy.sh
bash ./scripts/clippy.sh cargo test
cargo test

View File

@ -8,8 +8,7 @@ runs:
submodules: true submodules: true
fetch-depth: 0 fetch-depth: 0
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with: { shared-key: "${{ runner.os }}-shared-fuzzer-cache" }
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
@ -23,9 +22,6 @@ runs:
- name: Add wasm target - name: Add wasm target
shell: bash shell: bash
run: rustup target add wasm32-unknown-unknown run: rustup target add wasm32-unknown-unknown
- name: Install ucd-generate
shell: bash
run: cargo install -f ucd-generate
- name: Remove obsolete llvm (Linux) - name: Remove obsolete llvm (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
shell: bash shell: bash

View File

@ -78,7 +78,7 @@ fn main() {
assert!( assert!(
command.status().map_or(false, |s| s.success()), command.status().map_or(false, |s| s.success()),
"Couldn't build runtime crate! Did you remember to use nightly? (`rustup default nightly` to install) Or, did you remember to install ucd-generate? (`cargo install ucd-generate` to install)" "Couldn't build runtime crate! Did you remember to use nightly? (`rustup default nightly` to install)"
); );
let mut archive_path = custom_lib_dir.join(std::env::var_os("TARGET").unwrap()); let mut archive_path = custom_lib_dir.join(std::env::var_os("TARGET").unwrap());

View File

@ -272,7 +272,8 @@ where
for region in qemu.mappings() { for region in qemu.mappings() {
if let Some(path) = region.path().map(ToOwned::to_owned) { if let Some(path) = region.path().map(ToOwned::to_owned) {
if !path.is_empty() { // skip [heap], [vdso] and friends
if !path.is_empty() && !path.starts_with('[') {
LibInfo::add_unique( LibInfo::add_unique(
&mut libs, &mut libs,
LibInfo { LibInfo {