From 01d8c0015ee93dadb3d0d0e359c1a1fb5332e1e8 Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Mon, 13 Feb 2023 17:44:50 +0100 Subject: [PATCH] ci: add afl fuzz stage fuzz for 1 min to quickly detect e.g. incorrect asserts --- .github/workflows/ci.yml | 15 +++++++++++++++ Makefile | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0476aed..e9eb01f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,3 +63,18 @@ jobs: rustup component add clippy - name: "Check linting" run: make lint + fuzz: + name: Fuzz + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v3 + - name: "Setup toolchain" + run: | + rustup update nightly + rustup default nightly + cargo install afl + - name: "Fuzz" + run: | + echo core | sudo tee /proc/sys/kernel/core_pattern + make afl_quick diff --git a/Makefile b/Makefile index f8fc966..0054e16 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,13 @@ afl: trap - EXIT;\ cat) # keep process alive for trap +afl_quick: + rm -rf tests/afl/out + (cd tests/afl && \ + cargo afl build --release --config profile.release.debug-assertions=true && \ + AFL_NO_UI=1 AFL_BENCH_UNTIL_CRASH=1 \ + cargo afl fuzz -i in -o out -V 60 target/release/${AFL_TARGET}) + afl_crash: set +e; \ for f in $$(find tests/afl/out -path '*/${AFL_TARGET_CRASH}/id*'); do \