Skip to content

Conversation

@luca3s
Copy link
Contributor

@luca3s luca3s commented Oct 21, 2025

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 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 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.

@rustbot
Copy link
Collaborator

rustbot commented Oct 21, 2025

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

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

cc @WaffleLapkin

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann

These commits modify compiler targets.
(See the Target Tier Policy.)

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

cc @jdonszelmann

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

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 21, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 21, 2025

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@jdonszelmann
Copy link
Contributor

Looks ok from attr parsing pov :)

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@luca3s

This comment was marked as outdated.

@petrochenkov
Copy link
Contributor

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.

@petrochenkov petrochenkov added S-waiting-on-t-lang Status: Awaiting decision from T-lang T-lang Relevant to the language team I-lang-nominated Nominated for discussion during a lang team meeting. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 21, 2025
@traviscross traviscross added the P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang label Oct 22, 2025
@traviscross
Copy link
Contributor

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.

@traviscross traviscross removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Oct 22, 2025
@bors
Copy link
Collaborator

bors commented Nov 7, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 7, 2025
@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
spellchecking files
building external tool typos from package typos-cli@1.38.1
finished building tool typos
npm WARN deprecated puppeteer@22.15.0: < 24.10.2 is no longer supported
npm ERR! code 127
npm ERR! git dep preparation failed
npm ERR! command /node/bin/node /node/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/user/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm ERR! npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm ERR! npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm ERR! npm WARN deprecated readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
npm ERR! npm WARN deprecated debuglog@1.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm ERR! npm WARN deprecated read-package-json@2.1.2: This package is no longer supported. Please use @npmcli/package-json instead.
npm ERR! npm WARN deprecated read-installed@4.0.3: This package is no longer supported.
npm ERR! npm ERR! code 127
npm ERR! npm ERR! path /home/user/.npm/_cacache/tmp/git-cloneXXXXXXzG4sOI/node_modules/rollup
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c patch-package
npm ERR! npm ERR! sh: 1: patch-package: not found
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2025-11-07T17_36_46_440Z-debug-0.log

npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2025-11-07T17_36_39_674Z-debug-0.log
npm install did not exit successfully
tidy [extra_checks]: IO error: npm install returned exit code exit status: 127
tidy [extra_checks]: FAIL
tidy: The following check failed: extra_checks
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/npm --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1549:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1279:29

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:02:56
  local time: Fri Nov  7 17:37:16 UTC 2025
  network time: Fri, 07 Nov 2025 17:37:16 GMT
##[error]Process completed with exit code 1.

@saethlin

This comment was marked as outdated.

@luca3s
Copy link
Contributor Author

luca3s commented Nov 7, 2025

CI issues seem to be resolved. Could i get a bors retry?

@saethlin
Copy link
Member

saethlin commented Nov 7, 2025

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 7, 2025
@bors
Copy link
Collaborator

bors commented Nov 8, 2025

⌛ Testing commit 9d671a8 with merge 87f9dcd...

@bors
Copy link
Collaborator

bors commented Nov 8, 2025

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 87f9dcd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 8, 2025
@bors bors merged commit 87f9dcd into rust-lang:master Nov 8, 2025
12 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing bbb6f68 (parent) -> 87f9dcd (this PR)

Test differences

Show 591 test diffs

Stage 1

  • [ui] tests/ui/sanitizer/realtime-alloc.rs: [missing] -> ignore (ignored on targets without sanitizers support) (J4)
  • [ui] tests/ui/sanitizer/realtime-blocking.rs: [missing] -> ignore (ignored on targets without sanitizers support) (J4)
  • [ui] tests/ui/sanitizer/realtime-caller.rs: [missing] -> ignore (ignored on targets without sanitizers support) (J4)

Stage 2

  • [ui] tests/ui/sanitizer/realtime-alloc.rs: [missing] -> ignore (gcc backend is marked as ignore) (J0)
  • [ui] tests/ui/sanitizer/realtime-blocking.rs: [missing] -> ignore (gcc backend is marked as ignore) (J0)
  • [ui] tests/ui/sanitizer/realtime-caller.rs: [missing] -> ignore (gcc backend is marked as ignore) (J0)
  • [ui] tests/ui/sanitizer/realtime-alloc.rs: [missing] -> ignore (ignored on targets without sanitizers support) (J1)
  • [ui] tests/ui/sanitizer/realtime-blocking.rs: [missing] -> ignore (ignored on targets without sanitizers support) (J1)
  • [ui] tests/ui/sanitizer/realtime-caller.rs: [missing] -> ignore (ignored on targets without sanitizers support) (J1)
  • [ui] tests/ui/sanitizer/realtime-alloc.rs: [missing] -> pass (J2)
  • [ui] tests/ui/sanitizer/realtime-blocking.rs: [missing] -> pass (J2)
  • [ui] tests/ui/sanitizer/realtime-caller.rs: [missing] -> pass (J2)
  • [run-make] tests/run-make/compressed-debuginfo-zstd: pass -> ignore (ignored if LLVM wasn't build with zstd for ELF section compression or LLVM is not the default codegen backend) (J3)
  • [ui] tests/ui/sanitizer/realtime-alloc.rs: [missing] -> ignore (ignored on targets without realtime sanitizer) (J5)
  • [ui] tests/ui/sanitizer/realtime-blocking.rs: [missing] -> ignore (ignored on targets without realtime sanitizer) (J5)
  • [ui] tests/ui/sanitizer/realtime-caller.rs: [missing] -> ignore (ignored on targets without realtime sanitizer) (J5)

Additionally, 575 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 87f9dcd5e28a301fce81515bd4bea792444dcf29 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. pr-check-1: 1733.7s -> 2441.7s (+40.8%)
  2. x86_64-rust-for-linux: 3011.6s -> 4115.1s (+36.6%)
  3. pr-check-2: 2549.9s -> 3225.8s (+26.5%)
  4. armhf-gnu: 5192.1s -> 6445.9s (+24.1%)
  5. x86_64-gnu-miri: 4534.0s -> 5576.4s (+23.0%)
  6. x86_64-gnu-tools: 3685.0s -> 4462.6s (+21.1%)
  7. test-various: 6851.5s -> 8239.4s (+20.3%)
  8. x86_64-gnu-aux: 6489.0s -> 7790.0s (+20.0%)
  9. x86_64-gnu-nopt: 7261.0s -> 8663.2s (+19.3%)
  10. x86_64-gnu-gcc: 3700.9s -> 4410.7s (+19.2%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (87f9dcd): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 5
Improvements ✅
(primary)
-1.2% [-1.2%, -1.2%] 1
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.2%] 1
All ❌✅ (primary) -0.5% [-1.2%, 0.1%] 2

Max RSS (memory usage)

Results (primary 0.7%, secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
2.1% [1.2%, 4.0%] 4
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
-1.6% [-1.8%, -1.4%] 2
All ❌✅ (primary) 0.7% [-1.1%, 2.5%] 2

Cycles

Results (secondary 3.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.1%] 92
Regressions ❌
(secondary)
0.1% [0.0%, 0.3%] 60
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.1%] 92

Bootstrap: 474.693s -> 475.809s (0.24%)
Artifact size: 390.92 MiB -> 390.93 MiB (0.00%)

@rustbot rustbot added the perf-regression Performance regression. label Nov 8, 2025
@luca3s
Copy link
Contributor Author

luca3s commented Nov 8, 2025

Only thing i can imagine causing a regression is the new lint.

Otherwise i added one byte (+ maybe padding) to CodegenFnAttrs, which shouldn't make a difference (i guess)? And one new option to the sanitize attr parser, but i don't think the regressed crates even use the sanitize attribute.

syn, the improvement looks really noisy. This PR shouldn't improve perf in any case.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 9, 2025
Fix typo in unstable-book link

This prevented the links from being rendered. Sorry for not noticing this before my changes were merged yesterday.

Introduced in rust-lang#147935
cc `@petrochenkov`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 9, 2025
Fix typo in unstable-book link

This prevented the links from being rendered. Sorry for not noticing this before my changes were merged yesterday.

Introduced in rust-lang#147935
cc ``@petrochenkov``
rust-timer added a commit that referenced this pull request Nov 9, 2025
Rollup merge of #148736 - luca3s:fix-typo, r=Zalathar

Fix typo in unstable-book link

This prevented the links from being rendered. Sorry for not noticing this before my changes were merged yesterday.

Introduced in #147935
cc ``@petrochenkov``
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 10, 2025
Fix typo in unstable-book link

This prevented the links from being rendered. Sorry for not noticing this before my changes were merged yesterday.

Introduced in rust-lang/rust#147935
cc ``@petrochenkov``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc I-lang-radar Items that are on lang's radar and will need eventual work or consideration. merged-by-bors This PR was explicitly merged by bors. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.