Skip to content

Conversation

CrooseGit
Copy link

Extends existing support for AArch64 branch protection to include support for Guarded Control Stacks.

- Adds option to rustc config to enable GCS
- Passes `guarded-control-stack` flag to llvm if enabled
@rustbot
Copy link
Collaborator

rustbot commented Sep 8, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
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 A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs PG-exploit-mitigations Project group: Exploit mitigations 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 Sep 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 8, 2025

Some changes occurred in src/doc/unstable-book/src/compiler-flags/branch-protection.md

cc @rust-lang/project-exploit-mitigations, @rcvalle

@davidtwco
Copy link
Member

I've reviewed this internally so will reroll. GCS is exposed in Clang through their -mbranch-protection flag, so this just mirrors that like the rest of this flag.

r? compiler

@rustbot rustbot assigned nnethercote and unassigned davidtwco Sep 8, 2025
Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

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

Seems pretty straightforward, and looks consistent with clang.

View changes since this review

@@ -1,2 +1,2 @@
error: incorrect value `leaf` for unstable option `branch-protection` - a `,` separated combination of `bti`, `pac-ret`, followed by a combination of `pc`, `b-key`, or `leaf` was expected
error: incorrect value `leaf` for unstable option `branch-protection` - a `,` separated combination of `bti`, `gcs`, `pac-ret`, followed by a combination of `pc`, `b-key`, or `leaf` was expected
Copy link
Member

Choose a reason for hiding this comment

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

(this will need to be blessed, as per the updated description)

Copy link
Author

Choose a reason for hiding this comment

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

Ah yes, thank you. I have now fixed it.

@Urgau
Copy link
Member

Urgau commented Sep 8, 2025

r=me with the updated test output and CI green

r? Urgau
@bors delegate+

@bors
Copy link
Collaborator

bors commented Sep 8, 2025

✌️ @CrooseGit, you can now approve this pull request!

If @Urgau told you to "r=me" after making some further change, please make that change, then do @bors r=@Urgau

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@nnethercote nnethercote left a comment

Choose a reason for hiding this comment

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

@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from b50c4db to d949360 Compare September 9, 2025 10:11
@rust-log-analyzer

This comment has been minimized.

@CrooseGit

This comment was marked as resolved.

@Urgau
Copy link
Member

Urgau commented Sep 9, 2025

Does your local rustc uses LLVM 19 (like the job)? Or are you building LLVM locally/with download-ci-llvm?

@davidtwco
Copy link
Member

Checked locally and it's the LLVM version that is causing this, just add a //@ min-llvm-version: 21 directive only for the GCS revision (or //@ min-llvm-version: 20 if it works with that version).

@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from d949360 to 7ade636 Compare September 10, 2025 10:25
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Sep 10, 2025
@CrooseGit
Copy link
Author

@bors r=@Urgau

Thank you

@bors
Copy link
Collaborator

bors commented Sep 11, 2025

📌 Commit 661289b has been approved by Urgau

It is now in the queue for this repository.

@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 Sep 11, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 12, 2025
bors added a commit that referenced this pull request Sep 12, 2025
Rollup of 16 pull requests

Successful merges:

 - #145660 (initial implementation of the darwin_objc unstable feature)
 - #145895 (thread parking: fix docs and examples)
 - #146308 (support integer literals in `${concat()}`)
 - #146323 (check before test for hardware capabilites in bits 32~63 of usize)
 - #146332 (tidy: make behavior of extra-checks more uniform)
 - #146338 (Extends AArch64 branch protection support to include GCS)
 - #146374 (Update `browser-ui-test` version to `0.22.2`)
 - #146413 (Improve suggestion in case a bare URL is surrounded by brackets)
 - #146426 (Bump miow to 0.60.1)
 - #146432 (Implement `Socket::take_error` for Hermit)
 - #146433 (rwlock tests: fix miri macos test regression)
 - #146435 (Change the default value of `gcc.download-ci-gcc` to `true`)
 - #146439 (fix cfg for poison test macro)
 - #146448 ([rustdoc] Correctly handle literal search on paths)
 - #146449 (Fix `libgccjit` symlink when we build GCC locally)
 - #146455 (test: remove an outdated normalization for rustc versions)

Failed merges:

 - #146389 (Convert `no_std` and `no_core` to the new attribute infrastructure)

r? `@ghost`
`@rustbot` modify labels: rollup
@Zalathar
Copy link
Contributor

Probably failed in rollup: #146461 (comment)

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 12, 2025
@Zalathar
Copy link
Contributor

@bors try jobs=x86_64-gnu-llvm-20-3

rust-bors bot added a commit that referenced this pull request Sep 12, 2025
…<try>

Extends AArch64 branch protection support to include GCS

try-job: x86_64-gnu-llvm-20-3
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 12, 2025

💔 Test for a1acb51 failed: CI. Failed jobs:

GCS support was added to GCC in version 15, thus the rmake test for this
patch requires GCC15
@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from 661289b to dbb94e7 Compare September 15, 2025 09:33
@CrooseGit
Copy link
Author

@bors r=@Urgau

I believe I have fixed the issue that caused the CI to fail in the rollup.
Thanks again.

@bors
Copy link
Collaborator

bors commented Sep 15, 2025

📌 Commit dbb94e7 has been approved by Urgau

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 15, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 15, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: Our Github Actions CI A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants