- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Add LLVM realtime sanitizer #147935
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?
Add LLVM realtime sanitizer #147935
Conversation
| 
 Some changes occurred in tests/ui/sanitizer cc @rcvalle Some changes occurred in src/tools/compiletest cc @jieyouxu Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_hir/src/attrs These commits modify compiler targets. Some changes occurred in src/doc/unstable-book/src/compiler-flags/sanitizer.md cc @rust-lang/project-exploit-mitigations, @rcvalle Some changes occurred in compiler/rustc_attr_parsing This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. cc @BoxyUwU, @jieyouxu, @Kobzol, @tshepang Some changes occurred in compiler/rustc_passes/src/check_attr.rs | 
| rustbot has assigned @petrochenkov. Use  | 
| Looks ok from attr parsing pov :) | 
      
        
              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.
      
        
              This comment was marked as outdated.
        
        
      
    
  This comment was marked as outdated.
| This change has a lang component (marking functions a blocking or non-blocking), so I'll send this to lang team first, before reviewing the implementation in detail. | 
| Thanks for checking with us. We talked about this in the lang meeting today. We were OK with this going forward experimentally in nightly. We talked about how, ahead of stabilization, we'd like to see the feature flags for the individual sanitizers be separate to facilitate our review, as we're likely to want to stabilize these incrementally. | 
| @bors ping | 
| 😪 I'm awake I'm awake | 
| @bors retry | 
Add LLVM realtime sanitizer This is a new attempt at adding the [LLVM real-time sanitizer](https://clang.llvm.org/docs/RealtimeSanitizer.html) to rust. Previously this was attempted in rust-lang/rfcs#3766. Since then the `sanitize` attribute was introduced in rust-lang#142681 and it is a lot more flexible than the old `no_santize` attribute. This allows adding real-time sanitizer without the need for a new attribute, like it was proposed in the RFC. Because i only add a new value to a existing command line flag and to a attribute i don't think an MCP is necessary. Currently real-time santizer is usable in rust code with the [rtsan-standalone](https://crates.io/crates/rtsan-standalone) crate. This downloads or builds the sanitizer runtime and then links it into the rust binary. The first commit adds support for more detailed sanitizer information. The second commit then actually adds real-time sanitizer. The third adds a warning against using real-time sanitizer with async functions, cloures and blocks because it doesn't behave as expected when used with async functions. I am not sure if this is actually wanted, so i kept it in a seperate commit. The fourth commit adds the documentation for real-time sanitizer.
Rollup of 9 pull requests Successful merges: - #138217 (Turn `Cow::is_borrowed,is_owned` into associated functions.) - #147858 (Micro-optimization attempt in coroutine layout computation) - #147923 (Simplify rustc_public context handling) - #147935 (Add LLVM realtime sanitizer) - #148115 (rustdoc: Rename unstable option `--nocapture` to `--no-capture` in accordance with `libtest`) - #148137 (Couple of changes for Redox OS) - #148176 ([rustdoc] Include attribute and derive macros when filtering on "macros") - #148193 (Remove `QPath::LangItem`) - #148253 (Handle default features and -Ctarget-features in the dummy backend) r? `@ghost` `@rustbot` modify labels: rollup
Add LLVM realtime sanitizer This is a new attempt at adding the [LLVM real-time sanitizer](https://clang.llvm.org/docs/RealtimeSanitizer.html) to rust. Previously this was attempted in rust-lang/rfcs#3766. Since then the `sanitize` attribute was introduced in #142681 and it is a lot more flexible than the old `no_santize` attribute. This allows adding real-time sanitizer without the need for a new attribute, like it was proposed in the RFC. Because i only add a new value to a existing command line flag and to a attribute i don't think an MCP is necessary. Currently real-time santizer is usable in rust code with the [rtsan-standalone](https://crates.io/crates/rtsan-standalone) crate. This downloads or builds the sanitizer runtime and then links it into the rust binary. The first commit adds support for more detailed sanitizer information. The second commit then actually adds real-time sanitizer. The third adds a warning against using real-time sanitizer with async functions, cloures and blocks because it doesn't behave as expected when used with async functions. I am not sure if this is actually wanted, so i kept it in a seperate commit. The fourth commit adds the documentation for real-time sanitizer.
| I don't understand the CI failure in #148276. Locally i also sometimes got this error, but it wasn't consistent. I don't understand why the compiler that runs the doctests doesn't know the attribute syntax i just added. Especially since the attribute is also used in regular tests and there it works fine. | 
| Can i do this? It doesn't need to try CI again. | 
| Or do i need to use | 
| @bors r- retry | 
| I can now reproduce the failure locally reliably with @rustbot label +S-waiting-on-author -S-waiting-on-bors | 
This is a new attempt at adding the LLVM real-time sanitizer to rust.
Previously this was attempted in rust-lang/rfcs#3766.
Since then the
sanitizeattribute was introduced in #142681 and it is a lot more flexible than the oldno_santizeattribute. This allows adding real-time sanitizer without the need for a new attribute, like it was proposed in the RFC. Because i only add a new value to a existing command line flag and to a attribute i don't think an MCP is necessary.Currently real-time santizer is usable in rust code with the rtsan-standalone crate. This downloads or builds the sanitizer runtime and then links it into the rust binary.
The first commit adds support for more detailed sanitizer information.
The second commit then actually adds real-time sanitizer.
The third adds a warning against using real-time sanitizer with async functions, cloures and blocks because it doesn't behave as expected when used with async functions. I am not sure if this is actually wanted, so i kept it in a seperate commit.
The fourth commit adds the documentation for real-time sanitizer.