Skip to content

Conversation

@azhogin
Copy link
Contributor

@azhogin azhogin commented Feb 5, 2025

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

@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2025

r? @estebank

rustbot has assigned @estebank.
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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 5, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@klensy
Copy link
Contributor

klensy commented Feb 25, 2025

First commit adds retpoline feature, but PR descriptions says about sls.

@azhogin azhogin marked this pull request as draft February 25, 2025 18:23
@azhogin
Copy link
Contributor Author

azhogin commented Feb 25, 2025

First commit adds retpoline feature, but PR descriptions says about sls.

Yes, first commit is in another PR #135927.
This one depends on.

@Dylan-DPC
Copy link
Member

Marking this as blocked on #135927

@Dylan-DPC Dylan-DPC added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 22, 2025
@Darksonn
Copy link
Contributor

I filed an MCP for this flag: rust-lang/compiler-team#869

@bors
Copy link
Collaborator

bors commented May 18, 2025

☔ The latest upstream changes (presumably #141232) made this pull request unmergeable. Please resolve the merge conflicts.

Comment on lines 1 to 6
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should not be set by -Ctarget-feature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azhogin it would be great if we could make these hard errors now instead of an FCW

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@workingjubilee workingjubilee self-assigned this Jun 14, 2025
@ojeda
Copy link
Contributor

ojeda commented Jul 16, 2025

@azhogin Since #135927 is merged now, should this be rebased and unblocked now?

Thanks!

@Darksonn Darksonn added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Jul 16, 2025
@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jul 20, 2025
@wesleywiser wesleywiser added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2025
@ojeda
Copy link
Contributor

ojeda commented Oct 22, 2025

In the Rust <-> Rust for Linux sync call we were wondering about the status on this one: I think what is open is the review above: #136597 (comment).

@bors
Copy link
Collaborator

bors commented Nov 8, 2025

☔ The latest upstream changes (presumably #147803) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Nov 17, 2025

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.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 17, 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 src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 17, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2025

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

@rustbot rustbot added the A-rustc-dev-guide Area: rustc-dev-guide label Nov 18, 2025
@azhogin
Copy link
Contributor Author

azhogin commented Nov 18, 2025

In the Rust <-> Rust for Linux sync call we were wondering about the status on this one: I think what is open is the review above: #136597 (comment).

Rebased to main, the review comment addressed.

@azhogin
Copy link
Contributor Author

azhogin commented Nov 18, 2025

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 18, 2025
Some((_, stability, _)) => {
if let Err(reason) = stability.toggle_allowed() {
sess.dcx().emit_warn(errors::ForbiddenCTargetFeature {
sess.dcx().emit_err(errors::ForbiddenCTargetFeature {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 3, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 3, 2025
@bors
Copy link
Collaborator

bors commented Dec 10, 2025

☔ The latest upstream changes (presumably #149836) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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 S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.