sanitizers: Stabilize AddressSanitizer and LeakSanitizer for the Tier 1 targets#123617
sanitizers: Stabilize AddressSanitizer and LeakSanitizer for the Tier 1 targets#123617rcvalle wants to merge 3 commits intorust-lang:mainfrom
Conversation
|
rustbot has assigned @compiler-errors. Use |
|
Some changes occurred in src/tools/compiletest cc @jieyouxu These commits modify compiler targets. |
|
r? @davidtwco |
This comment has been minimized.
This comment has been minimized.
compiler-errors
left a comment
There was a problem hiding this comment.
I'd like to see tests that exercise things like -Csanitizer=non-existent and -Zsanitizer=non-existent, and also -Zsanitizer=stable-sanitizer1 (e.g. an x86_64-unknown-linux-gnu test for a stable sanitizer) and -Csanitizer=unstable-sanitizer (I believe you can add a run-make test with a custom target that has no sanitizers enabled for it?)
Footnotes
-
What do we do if we pass
-Zsanitizerwith a stable sanitizer? Should we error? Presumably not, but I would assume we'd want to at least warn the users that the sanitizer has been stabilized and they should be using-C, just like we do for feature gates. ↩
|
Documentation will need an update. Is something like |
|
This is unusable to most stable Rust users, right? It requires either |
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
cec660e to
17eff53
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
17eff53 to
f81f25d
Compare
This comment has been minimized.
This comment has been minimized.
f81f25d to
2cfed6e
Compare
|
We ended up discussing this further today in the lang/RfL call. There, a couple of points were made. One was that the kernel doesn't actually use Two was that, even if one did need to turn off a sanitizer (e.g. for this reason), one would generally want to do it at the level of a compilation unit rather than at the level of an item. Based on that, perhaps it would be better to just pull the attribute out of this stabilization entirely. Then, if there is some residual motivation for this, that can be presented and we can consider that, and the design of the attribute, separately. CC @rcvalle @Darksonn, who might have additional details they could fill in here. |
I think that was referring to the formatting-related fix that happened in |
I think I was unclear here. The one use of
To clarify, this is referring to the case where you are implementing the sanitizer runtime in Rust, since the sanitizer runtime itself is usually not sanitized. The use case that Rust had for So to summarize, I meant to say that if you had a case where calling from non-sanitized into sanitized code was a problem, then you would probably be in a situation where you're turning it off the entire compilation unit anyway. |
|
☔ The latest upstream changes (presumably #141243) made this pull request unmergeable. Please resolve the merge conflicts. |
Yes, this summarizes well what we discussed there. For this PR, we could:
We would choose (1) if there are any concerns left we would like to discuss before implementing it. Otherwise, I think we could choose (2). |
|
@1c3t3a Just implemented what was as discussed in the Zulip thread above in #142681 (we chatted and decided it was better to be submitted as a separated PR). Thank you very much for your time and work on this, @1c3t3a! Much appreciated. I'll resolve the merge conflicts on this PR and remove the commit that would stabilize the |
This comment has been minimized.
This comment has been minimized.
|
I've resolved the merge conflicts on this PR and removed the commit that would stabilize the no_sanitize attribute in favor of #142681. @traviscross @wesleywiser whenever you have time, let me know if these PRs look good to you and/or if there are any pending concerns. |
|
@rustbot ready |
|
☔ The latest upstream changes (presumably #143337) made this pull request unmergeable. Please resolve the merge conflicts. |
| ## Disclaimer | ||
|
|
||
| The quality of the Sanitizers implementation and support varies across operating |
There was a problem hiding this comment.
Do we want to say something about the stability of these sanitizers? For example, I assume we want to have the flexibility to ship a future version of Rust where they were removed?
There was a problem hiding this comment.
Question (forcing inline comment): cf #143561 what's the intended sanitizer support under cross-compile scenarios? As far as I can tell, on {i686,x86_64}-pc-windows-msvc, ASAN requires Microsoft-provided runtimes that bootstrap tries to detect based on a cl.exe directory traversal. Implementation assumptions aside, what's intended to happen if a user tries to target {i686,x86_64}-pc-windows-msvc on say x86_64-unknown-linux-gnu host with e.g. ASAN enabled? I assume cross-compile is not a generally supported use case, right? I assume for LLVM-supported ASAN we could ship those too for the target, so cross-compile might work.
|
Checking status here, I think there are some open questions to be addressed @rustbot author |
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add suppport for specifying stable sanitizers in addition to the existing supported sanitizers.
Stabilize AddressSanitizer and LeakSanitizer for the Tier 1 targets that support them.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #151716) made this pull request unmergeable. Please resolve the merge conflicts. |
Add support for specifying stable sanitizers in addition to the existing supported sanitizers, remove the
-Zsanitizerunstable option and have only the-Csanitizecodegen option, requiring the-Zunstable-optionsto be passed for using unstable sanitizers, add AddressSanitizer and LeakSanitizer for the Tier 1 targets that support them, and also stabilize theno_sanitizeattribute so stable sanitizers can also be selectively disabled for annotated functions.. The tracking issue for stabilizing the sanitizers is #123615. This is part of our work to stabilize support for sanitizers in the Rust compiler. (See our roadmap at https://hackmd.io/@rcvalle/S1Ou9K6H6.)Stabilization Report
Summary
We would like to propose stabilizing AddressSanitizer and LeakSanitizer for the Tier 1 targets that support them, and stabilize the
no_sanitizeattribute so stable sanitizers can also be selectively disabled for annotated functions.. This will be done by-Zsanitizerunstable option and having only the-Csanitizecodegen option, and requiring the-Zunstable-optionsto be passed for using unstable sanitizers.no_sanitizeattribute.After stabilizing these sanitizers, the supported sanitizers will look like this:
The tracking issue for stabilizing the sanitizers is #123615. This is part of our work to stabilize support for sanitizers in the Rust compiler. (See our roadmap at https://hackmd.io/@rcvalle/S1Ou9K6H6.)
Documentation
Documentation will be updated by adding documentation for the
-Csanitizercodegen option to the Codegen Options in the The rustc book.Tests
You may find current and will find additional test cases for the sanitizers in:
Unresolved questions
We will prioritize stabilizing sanitizers that provide incremental value without requiring rebuilding the Rust Standard Library (i.e., Cargo build-std feature). We're also working on Partial compilation using MIR-only rlibs compiler-team#738, which should help with
-Zbuild-std.