cargo xtask fuzz fails on aarch64 — LSE target feature dropped by cargo-fuzz RUSTFLAGS
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.9k
- Forks
- 238
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 100
Description
cargo xtask fuzz run fails to compile on aarch64 (e.g. aarch64 WSL) because cargo-fuzz overrides .cargo/config.toml target features via its own RUSTFLAGS env var.
Symptoms
error: instruction requires: lse
--> <inline asm>:2:1
|
2 | casalb w21, w8, [x10]
| ^
Root cause
.cargo/config.toml sets -Ctarget-feature=+lse,+neon for aarch64 targets. trycopy's inline asm depends on this — it uses casalb (an ARMv8.1 LSE atomic) for fault-recovering compare-and-swap.
cargo-fuzz constructs its own RUSTFLAGS (ASAN, coverage instrumentation) and sets it as an env var. Per Cargo's precedence rules, the env var completely overrides [target.*.rustflags] from config, silently dropping +lse. LLVM then rejects the LSE instructions.
Workaround
RUSTFLAGS="-Ctarget-feature=+lse,+neon" cargo xtask fuzz run fuzz_ide
cargo-fuzz prepends the user's RUSTFLAGS to its own, so the features are preserved.
Proposed fix
Detect aarch64 in xtask/src/tasks/fuzz/cargo_fuzz.rs and inject -Ctarget-feature=+lse,+neon into the environment before invoking cargo fuzz. This makes it automatic for all fuzz targets.
An alternative: make trycopy's LSE asm conditional on cfg!(target_feature = "lse") with an LL/SC fallback — but that's significantly more work.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in xtask/src/tasks/fuzz/cargo_fuzz.rs and trace how cargo xtask fuzz run invokes cargo-fuzz and constructs its environment. Reproduce the failure on an aarch64 target with cargo xtask fuzz run fuzz_ide, then verify that the LSE and NEON features are preserved and the fuzz target compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100