-
Notifications
You must be signed in to change notification settings - Fork 13.3k
sanitizers: Stabilize AddressSanitizer and LeakSanitizer for the Tier 1 targets #123617
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
base: master
Are you sure you want to change the base?
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see tests that exercise things like -Csanitizer=non-existent
and -Zsanitizer=non-existent
, and also -Zsanitizer=stable-sanitizer
1 (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
-Zsanitizer
with 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
beb0fb4
to
bc3568e
Compare
Thanks for pointing it out! I've created a Zulip thread for us to discuss the next steps and stabilizing the |
I'll add the comment here as well for completeness, but let's continue the discussion on the Zulip thread I created: My main concern with |
☔ The latest upstream changes (presumably #136954) made this pull request unmergeable. Please resolve the merge conflicts. |
bc3568e
to
5943bdf
Compare
Some changes occurred in compiler/rustc_codegen_ssa |
This comment has been minimized.
This comment has been minimized.
5943bdf
to
89642b1
Compare
|
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #139012) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
Stabilize the `no_sanitize` attribute so stable sanitizers can also be selectively disabled for annotated functions.
Stabilize AddressSanitizer for aarch64-apple-darwin since it was promoted to Tier 1 in rust-lang#128592.
89642b1
to
32b81ee
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
We discussed this in today's @rust-lang/lang meeting. We were generally supportive of That seems like a footgun. And one you're more likely to hit in Rust than in C, because of the wide variety of helper methods like those on We weren't sure what the right footgun-free way to handle turning off sanitizers would be, though. Also, separately from that concern, if we want to support turning off individual sanitizers, the possible syntax In any case, please do include T-lang on any FCP that includes any attributes. (An FCP that just enables sanitizers in the compiler but doesn't add any attributes or other language surface area doesn't need any T-lang approval, of course.) |
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. |
Add support for specifying stable sanitizers in addition to the existing supported sanitizers, remove the
-Zsanitizer
unstable option and have only the-Csanitize
codegen option, requiring the-Zunstable-options
to be passed for using unstable sanitizers, add AddressSanitizer and LeakSanitizer for the Tier 1 targets that support them, and also stabilize theno_sanitize
attribute 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_sanitize
attribute so stable sanitizers can also be selectively disabled for annotated functions.. This will be done by-Zsanitizer
unstable option and having only the-Csanitize
codegen option, and requiring the-Zunstable-options
to be passed for using unstable sanitizers.no_sanitize
attribute.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
-Csanitizer
codegen 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
.