-Zharden-sls flag (target modifier) added to enable mitigation against straight line speculation (SLS)#136597
-Zharden-sls flag (target modifier) added to enable mitigation against straight line speculation (SLS)#136597azhogin wants to merge 2 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in compiler/rustc_codegen_gcc |
|
First commit adds retpoline feature, but PR descriptions says about sls. |
Yes, first commit is in another PR #135927. |
|
Marking this as blocked on #135927 |
|
I filed an MCP for this flag: rust-lang/compiler-team#869 |
|
☔ The latest upstream changes (presumably #141232) made this pull request unmergeable. Please resolve the merge conflicts. |
| warning: target feature `retpoline-external-thunk` cannot be enabled with `-Ctarget-feature`: use `x86-retpoline` target modifier flag instead | ||
| | | ||
| = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
| = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344> | ||
|
|
||
| warning: 1 warning emitted |
There was a problem hiding this comment.
Why is this possible at all?
| //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib | ||
| //@ needs-llvm-components: x86 | ||
| //@ [by_flag]compile-flags: -Zharden-sls=all | ||
| //@ [by_feature]compile-flags: -Ctarget-feature=+harden-sls-ijmp,+harden-sls-ret |
There was a problem hiding this comment.
These should not be set by -Ctarget-feature.
There was a problem hiding this comment.
@azhogin it would be great if we could make these hard errors now instead of an FCW
There was a problem hiding this comment.
Changed to be hard error. Also it requires to add non-aux-compiler-flags directive for tests (related issue described here #147881). To workaround error generated at minicore auxiliary build.
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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. |
Rebased to main, the review comment addressed. |
|
@rustbot review |
| Some((_, stability, _)) => { | ||
| if let Err(reason) = stability.toggle_allowed() { | ||
| sess.dcx().emit_warn(errors::ForbiddenCTargetFeature { | ||
| sess.dcx().emit_err(errors::ForbiddenCTargetFeature { |
There was a problem hiding this comment.
Sorry, I think we were unclear. We don't want to change all instances of the "forbidden target feature" warning into hard errors, we just want this new instance of it to be a hard error.
The reason these are currently a warning is because of backwards compatibly where previous stable compilers allowed these features to be specified. However, harden-sls is a new feature and so there isn't a backwards compatibility requirement. As such, it makes sense to treat invalid uses as a hard error rather than an ignorable warning.
This probably means there needs to be a new level of Stability that generates an error instead of a warning and then you can use that instead of Stability::Forbidden.
There was a problem hiding this comment.
I pushed a commit here that implements that, it just needs to be used in this PR
|
Reminder, once the PR becomes ready for a review, use |
|
☔ The latest upstream changes (presumably #149836) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@azhogin just making sure you've seen this, the PR is now waiting on you to address this comment from 2025-12-03: #136597 (comment) |
…t straight line speculation (SLS)
|
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. |
|
Rebased on cherry-picked wesleywiser's commit "Allow forbidden target features to be hard errors". @rustbot ready |
Flag (target modifier) to mitigate against straight line speculation (SLS).
-Zharden-sls=[none|all|return|indirect-jmp].The flag enables the related features:
+harden-sls-ijmp,+harden-sls-ret.The flag is tracked as a target modifier to be equal between linked crates.
Tracking issue: #116851