Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust has no ASAN support for catalyst ABI (x86_64-apple-ios-macabi) #113935

Closed
danakj opened this issue Jul 21, 2023 · 2 comments · Fixed by #115644
Closed

Rust has no ASAN support for catalyst ABI (x86_64-apple-ios-macabi) #113935

danakj opened this issue Jul 21, 2023 · 2 comments · Fixed by #115644
Labels
A-sanitizers Area: Sanitizers for correctness and code quality. C-bug Category: This is a bug. O-ios Operating system: iOS O-macos Operating system: macOS O-x86_64 Target: x86-64 processors (like x86_64-*)

Comments

@danakj
Copy link
Contributor

danakj commented Jul 21, 2023

Building for x86_64-apple-ios-macabi with ASAN enabled produces this error:

 FAILED: local_rustc_sysroot/lib/rustlib/x86_64-apple-ios-macabi/lib/libcore.rlib 
 "python3" "../../build/rust/rustc_wrapper.py" --rustc=../../third_party/rust-toolchain/bin/rustc --depfile=local_rustc_sysroot/lib/rustlib/x86_64-apple-ios-macabi/lib/libcore.rlib.d --rsp=local_rustc_sysroot/lib/rustlib/x86_64-apple-ios-macabi/lib/libcore.rlib.rsp -- -Clinker="../../third_party/llvm-build/Release+Asserts/bin/clang++" --crate-name core ../../third_party/rust-toolchain/lib/rustlib/src/rust/library/core/src/lib.rs --crate-type rlib -Zforce-unstable-if-unmarked --edition=2021 -Coverflow-checks=on -Cdefault-linker-libraries -Zdep-info-omit-d-target -Zmacro-backtrace -Zremap-cwd-prefix=. --color=always --target=x86_64-apple-ios-macabi -Cembed-bitcode=no -Cpanic=abort -Zpanic_abort_tests --cfg cr_rustc_revision=\"006a26c0b546abc0fbef59a773639582b641e500-6-llvmorg-17-init-16420-g0c545a44\" -Zdwarf-version=4 -Cdebuginfo=1 -Zsanitizer=address --cap-lints=allow -Dunsafe_op_in_unsafe_fn --sysroot=local_rustc_sysroot   --emit=dep-info=local_rustc_sysroot/lib/rustlib/x86_64-apple-ios-macabi/lib/libcore.rlib.d,link -o local_rustc_sysroot/lib/rustlib/x86_64-apple-ios-macabi/lib/libcore.rlib LDFLAGS RUSTENV OUT_DIR=../../../../../../../../../out/Debug/gen/build/rust/std/rules/core CARGO_PKG_VERSION=0.0.0 CARGO_PKG_NAME=core CARGO_PKG_DESCRIPTION=The\ Rust\ Core\ Library
 error: address sanitizer is not supported for this target

The aarch64-apple-ios-macabi target gives the same compiler error.

Catalyst is a useful ABI for ASAN support because Chromium's iOS code is fuzzed on Catalyst, and ASAN is important to find bugs with fuzzers. This prevents us from having Rust code that is visible to Chrome's IOS product at all, or requires us to disable ASAN in the fuzzers.

Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1466967

For someone coming in without background in Rust's sanitizer support, what would be needed to bring up ASAN support for this ABI? Consider that we don't need a runtime from the stdlib at all, as we're using Clang's ASAN runtime.

@danakj danakj added the C-bug Category: This is a bug. label Jul 21, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 21, 2023
@Urgau
Copy link
Contributor

Urgau commented Jul 22, 2023

I don't know anything about Apple targets, but to answer your question:

For someone coming in without background in Rust's sanitizer support, what would be needed to bring up ASAN support for this ABI?

Doing something similar as aacf321 for the targets your interested (and verifying that it works) should do it.

@Jules-Bertholet
Copy link
Contributor

Jules-Bertholet commented Jul 22, 2023

@rustbot label A-sanitizers O-macos O-x86_64

@rustbot rustbot added O-macos Operating system: macOS O-x86_64 Target: x86-64 processors (like x86_64-*) A-sanitizers Area: Sanitizers for correctness and code quality. labels Jul 22, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 22, 2023
@workingjubilee workingjubilee added the O-ios Operating system: iOS label Jul 28, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 17, 2023
Enable ASAN/LSAN/TSAN for *-apple-ios-macabi

The -macabi targets are iOS running on MacOS, and they use the runtime libraries for MacOS, thus they have the same sanitizers available as the *-apple-darwin targets.

This is based on the work of rust-lang@aacf321.

Closes rust-lang#113935.
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 18, 2023
Enable ASAN/LSAN/TSAN for *-apple-ios-macabi

The -macabi targets are iOS running on MacOS, and they use the runtime libraries for MacOS, thus they have the same sanitizers available as the *-apple-darwin targets.

This is based on the work of rust-lang@aacf321.

Closes rust-lang#113935.
@bors bors closed this as completed in 19dd953 Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sanitizers Area: Sanitizers for correctness and code quality. C-bug Category: This is a bug. O-ios Operating system: iOS O-macos Operating system: macOS O-x86_64 Target: x86-64 processors (like x86_64-*)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants