Skip to content

Conversation

@RAprogramm
Copy link
Owner

Closes #45

Problem

Fuzzing workflow failed with error:

error: sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`

error[E0463]: can't find crate for `std`
  = note: the `x86_64-unknown-linux-musl` target may not be installed

Root cause: cargo-fuzz automatically selects x86_64-unknown-linux-musl target which uses static libc linking, incompatible with ASAN sanitizer (-Zsanitizer=address).

Failed run: https://github.com/RAprogramm/cstring-array/actions/runs/18640282197

Solution

Use x86_64-unknown-linux-gnu target instead of musl.

Changes

Added to workflow:

  1. Install gnu target step
  2. Explicit --target x86_64-unknown-linux-gnu flag in cargo fuzz command

Before:

- name: Install cargo-fuzz
  uses: taiki-e/install-action@v2
  with:
    tool: cargo-fuzz

- name: Run fuzzer
  run: cargo fuzz run ${{ matrix.target }} -- -max_total_time=300

After:

- name: Install cargo-fuzz
  uses: taiki-e/install-action@v2
  with:
    tool: cargo-fuzz

- name: Add gnu target
  run: rustup target add x86_64-unknown-linux-gnu

- name: Run fuzzer
  run: cargo fuzz run ${{ matrix.target }} --target x86_64-unknown-linux-gnu -- -max_total_time=300

Benefits

  • Fuzzing works with ASAN sanitizer
  • Better memory safety testing
  • CI passes successfully

Testing

  • Tested locally with cargo +nightly fuzz run fuzz_new_from_strings --target x86_64-unknown-linux-gnu -- -max_total_time=10
  • No sanitizer errors
  • Fuzzing completes successfully
  • Will be validated by CI workflow run

- Add x86_64-unknown-linux-gnu target installation step
- Use --target flag in cargo fuzz run command
- Fixes ASAN sanitizer incompatibility with musl static libc

Problem:
- cargo-fuzz auto-selected x86_64-unknown-linux-musl target
- MUSL uses static libc linking incompatible with ASAN sanitizer
- Fuzzing workflow failed with sanitizer error

Solution:
- Install x86_64-unknown-linux-gnu target
- Explicitly specify target in cargo fuzz command
- ASAN sanitizer works with gnu dynamic libc

Related: Closes #45
@RAprogramm RAprogramm merged commit b349a7c into main Oct 20, 2025
3 checks passed
@RAprogramm RAprogramm deleted the 45 branch October 20, 2025 03:38
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.

Fix fuzzing workflow: ASAN sanitizer incompatible with musl target

1 participant