Building with address sanitizer on darwin aarch64
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried to build my project with address sanitizer. But it fails during compilation. I have reduced it to a single dependency example.
The code is here:
https://github.com/NickeZ/rust-crypto-utils/blob/asan-bug-repro/zeroize/examples/user.rs
Build it like this:
RUSTFLAGS=-Zsanitizer=address cargo build -Zbuild-std --example user --release --all-features
I get the following error message:
$ RUSTFLAGS=-Zsanitizer=address cargo build -Zbuild-std --example user --release --all-features
Compiling proc-macro2 v1.0.80
Compiling unicode-ident v1.0.12
Compiling serde v1.0.197
Compiling quote v1.0.35
Compiling syn v2.0.59
Compiling zeroize_derive v1.4.2 (/Users/niklasdusenlund/projects/niklas/utils/zeroize_derive)
Compiling zeroize v1.8.1 (/Users/niklasdusenlund/projects/niklas/utils/zeroize)
==49331==ERROR: Interceptors are not working. This may be because AddressSanitizer is loaded too late (e.g. via dlopen). Please launch the executable with:
DYLD_INSERT_LIBRARIES=/Users/niklasdusenlund/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc-nightly_rt.asan.dylib
"interceptors not installed" && 0
error: could not compile `zeroize` (lib)
Caused by:
process didn't exit successfully: `/Users/niklasdusenlund/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name zeroize --edition=2021 zeroize/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=362 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="aarch64"' --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="serde"' --cfg 'feature="simd"' --cfg 'feature="std"' --cfg 'feature="zeroize_derive"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("aarch64", "alloc", "default", "derive", "serde", "simd", "std", "zeroize_derive"))' -C metadata=5acf091688190a6f -C extra-filename=-9e0bd4a7bb5aa069 --out-dir /Users/niklasdusenlund/projects/niklas/utils/target/release/deps -C strip=debuginfo -L dependency=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps --extern 'noprelude:alloc=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/liballoc-029ead176416b385.rmeta' --extern 'noprelude:compiler_builtins=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libcompiler_builtins-533a23172473f48c.rmeta' --extern 'noprelude:core=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libcore-904393f36cca07a7.rmeta' --extern 'noprelude:panic_unwind=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libpanic_unwind-e3b8f964641dc917.rmeta' --extern 'noprelude:proc_macro=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libproc_macro-bfc448f60f4dd39a.rmeta' --extern serde=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libserde-22b5716bcaf394ec.rmeta --extern 'noprelude:std=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libstd-b7dda9e17692af7a.rmeta' --extern zeroize_derive=/Users/niklasdusenlund/projects/niklas/utils/target/release/deps/libzeroize_derive-9b119d6a78dd6de9.dylib -Z unstable-options -Zsanitizer=address` (signal: 6, SIGABRT: process abort signal)
If I remove --all-features it builds and works. I assume this is because the derive feature is a macro that is loaded by rustc?
Contributor guide
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
Reproduce the failure using zeroize/examples/user.rs from the linked asan-bug-repro branch and the provided nightly cargo build command on Darwin aarch64. Compare the build with and without --all-features, focusing on the zeroize_derive proc-macro compilation and the AddressSanitizer error. Done means the all-features build completes successfully under AddressSanitizer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100