Description
openedon Dec 7, 2023
Proposal
Address Sanitizer (aka ASAN) requires a "runtime library" to provide various functions used to inspect memory accesses. The code for this library is in LLVM, and Rust provides a custom build of the library for MacOS and Linux, but not Windows. Similarly, Microsoft provides a build of the library for use with its own compilers: https://learn.microsoft.com/en-us/cpp/sanitizers/asan-runtime?view=msvc-170
I am proposing that Rust also uses the Microsoft provided ASAN runtime library when building for MSVC.
Benefits:
- Allows the use of ASAN on Windows (since LLVM's ASAN does not yet officially support Windows).
- Simplifies the deployment of ASAN on Windows, as the Microsoft ASAN runtime library can be installed by a developer when installing the rest of the MSVC toolchain.
Drawbacks:
- Does not enable ASAN on Windows when using the GNU or GNULLVM targets.
- Does not allow Rust to customize how ASAN works for Windows.
- The Microsoft ASAN library is deployed as a DLL, requiring it to be copied alongside the final binary or be on the
PATH
. - The interface between a compiler and an ASAN runtime is not guaranteed to be stable between versions, so future changes to LLVM or Microsoft's ASAN library may break this feature.
I have a prototype of this change working by utilizing the MSVC linker's /INFERASANLIBS
option: rust-lang/rust#118521
Mentors or Reviewers
Mentor: @wesleywiser
Process
The main points of the Major Change Process are as follows:
- File an issue describing the proposal.
- A compiler team member or contributor who is knowledgeable in the area can second by writing
@rustbot second
.- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
-C flag
, then full team check-off is required. - Compiler team members can initiate a check-off via
@rfcbot fcp merge
on either the MCP or the PR.
- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
- Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.
You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.