-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 1 commit into
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.
|
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) |
This comment has been minimized.
This comment has been minimized.
|
Rebased on cherry-picked wesleywiser's commit "Allow forbidden target features to be hard errors". @rustbot ready |
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.
…t straight line speculation (SLS)
|
@rustbot review |
…feature_hard_error_option, r=dingxiangfei2009 Allow forbidden target features to be hard errors Sometimes when adding a new target features to the list of known target features, we want to completely forbid them from being used because they are ABI affecting and should be target modifiers instead. As such, we want to issue an error rather than a warning since there are no future compatibility concerns . r? @workingjubilee since you're familiar with the motivating case in rust-lang#136597 If I rebase that PR on top of this locally, then we get the following error messages when trying to activate the SLS target feature (note that they are *errors* not *warnings* and we've omitted the usual note about future compatibility): ``` error: target feature `harden-sls-ijmp` cannot be enabled with `-Ctarget-feature`: use `harden-sls` compiler flag instead error: target feature `harden-sls-ret` cannot be enabled with `-Ctarget-feature`: use `harden-sls` compiler flag instead error: aborting due to 2 previous errors ```
|
☔ The latest upstream changes (presumably #156834) made this pull request unmergeable. Please resolve the merge conflicts. |
View all comments
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