Skip to content

Add ASan for honggfuzz & speed-up AFL++ - #185

Merged
vanhauser-thc merged 7 commits into
mainfrom
feat/asan
Aug 28, 2026
Merged

Add ASan for honggfuzz & speed-up AFL++#185
vanhauser-thc merged 7 commits into
mainfrom
feat/asan

Conversation

@chris-srlabs

@chris-srlabs chris-srlabs commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Enable --asan for honggfuzz and remove the opt-level=0 restriction for afl++ (fixes #130).
Restore persistent fuzzing with honggfuzz and read metadata from Cargo.toml allowing to restrict a harness to certain fuzzers only:

[package.metadata.ziggy]
compat = ["afl"]
# compat = ["honggfuzz"]

when no metadata exists, it is assumed to compile for both afl++ and honggfuzz.

Fix some clippy lints on the way. Add semver-checks to CI.
And enable verbose output for cargo afl config (compiling AFL++).
This allows to restrict harnesses to only certain fuzzers by editing
their Cargo.toml:
```toml
[package.metadata.ziggy]
compat = ["afl"]
```
Comment thread src/bin/cargo-ziggy/fuzz.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables optimized ASan fuzzing, restores persistent honggfuzz execution, and adds per-harness fuzzer compatibility metadata.

Changes:

  • Adds honggfuzz ASan support and persistent fuzzing.
  • Enables optimized AFL++ ASan builds and conditionally disables CMPLOG.
  • Adds compatibility metadata handling, tests, and CI updates.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/ci.yml Adds semver checks and pins nightly.
Cargo.lock Refreshes dependency resolutions.
Cargo.toml Adds Tokio feature compatibility.
examples/asan/src/main.rs Preserves the ASan-triggering read.
src/bin/cargo-ziggy/build.rs Enables honggfuzz ASan and optimized AFL++.
src/bin/cargo-ziggy/coverage.rs Simplifies formatting expressions.
src/bin/cargo-ziggy/fuzz.rs Gates CMPLOG and configures honggfuzz ASan.
src/bin/cargo-ziggy/main.rs Adds fuzzer compatibility metadata handling.
src/bin/cargo-ziggy/minimize.rs Simplifies formatting expressions.
src/bin/cargo-ziggy/plot.rs Removes an unnecessary borrow.
src/bin/cargo-ziggy/run.rs Removes forced ASan opt-level zero.
src/bin/cargo-ziggy/triage.rs Simplifies directory checks.
src/lib.rs Restores persistent honggfuzz looping.
tests/asan_fuzz.rs Expands AFL++ and honggfuzz ASan tests.
Suppressed comments (2)

src/bin/cargo-ziggy/main.rs:588

  • This overwrites an explicit --engine choice: when both fuzzers are compatible, requesting AFL-only or honggfuzz-only is changed to All; when only one is compatible, an explicitly incompatible choice is silently switched. Intersect the requested engine with compatibility and reject an empty intersection.
                minimize.engine = match (with_afl, with_honggfuzz) {
                    (true, true) => FuzzingEngines::All,
                    (true, false) => FuzzingEngines::AFLPlusPlus,
                    (false, true) => FuzzingEngines::Honggfuzz,
                    _ => bail!("harness is not compatible with any fuzzer"),

src/bin/cargo-ziggy/main.rs:581

  • These assignments discard explicit --no-afl/--no-honggfuzz options whenever the corresponding engine is listed as compatible. Preserve user exclusions and only add exclusions required by metadata.
                fuzz.no_afl = !with_afl;
                fuzz.no_honggfuzz = !with_honggfuzz;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/bin/cargo-ziggy/main.rs Outdated
Comment on lines +538 to +540
let compat: Vec<_> = meta
.workspace_default_packages()
.first()?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e09a97a makes package selection more robust

Comment thread src/bin/cargo-ziggy/main.rs Outdated
Comment on lines +576 to +577
build.no_afl = !with_afl;
build.no_honggfuzz = !with_honggfuzz;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in e09a97a

@vanhauser-thc

Copy link
Copy Markdown
Collaborator

please see my comment plus the two from copilot. dunno about the workspace one, but the compact I agree.

@vanhauser-thc

Copy link
Copy Markdown
Collaborator

Lgtm, thanks

@vanhauser-thc
vanhauser-thc merged commit 925b320 into main Aug 28, 2026
4 checks passed
@chris-srlabs
chris-srlabs deleted the feat/asan branch August 28, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hongfuzz cannot be built with ASAN. what is the reason for this limitation?

3 participants