Skip to content

Conversation

CrooseGit
Copy link

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

@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

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

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

Extends AArch64 branch protection support to include GCS

try-job: *aarch64*
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 16, 2025

💔 Test for 6f90524 failed: CI. Failed jobs:

@bors

This comment was marked as outdated.

- Adds option to rustc config to enable GCS
- Passes `guarded-control-stack` flag to llvm if enabled
@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from 3c9eda0 to b984bb5 Compare September 18, 2025 13:30
@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

This PR was rebased onto a different master 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-bors
Copy link

rust-bors bot commented Sep 18, 2025

@CrooseGit: 🔑 Insufficient privileges: not in try users

@rust-log-analyzer

This comment has been minimized.

RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
g++ \
g++-15 \
Copy link
Member

@Urgau Urgau Sep 18, 2025

Choose a reason for hiding this comment

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

Seems like installing a specific version of g++ doesn't provide the cc binary by default.

I tested adding the update-alternatives to provide gcc, cc, g++ and cxx and that fixes the issue about cc not being provided.

# Link standard gcc binary to the g++-15 ones
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 10 \
  && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 10 \
  && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-15 30 \
  && update-alternatives --install /usr/bin/cxx cxx /usr/bin/g++-15 30

(to be added after the install in this Dockerfile)

Copy link
Author

Choose a reason for hiding this comment

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

Just seen this, thank you very much for looking into this issue.
I believe I found an alternative fix for the problem, changing the Ubuntu version to 25.10 for the builds where the above is a problem gives you gcc15 as the default. It is passing when I run the CI locally. Of course if it fails now I shall try your solution.

@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from b984bb5 to d67bd73 Compare September 19, 2025 08:33
@rust-log-analyzer

This comment has been minimized.

@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from d67bd73 to f043fb8 Compare September 19, 2025 10:36
@davidtwco
Copy link
Member

cc @rust-lang/infra for the CI image changes

@Urgau
Copy link
Member

Urgau commented Sep 19, 2025

@bors try jobs=aarch64

@rust-bors

This comment has been minimized.

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

Extends AArch64 branch protection support to include GCS

try-job: *aarch64*
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 19, 2025

💔 Test for d260a23 failed: CI. Failed jobs:

@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from f043fb8 to e02bd51 Compare September 19, 2025 14:06
@Urgau
Copy link
Member

Urgau commented Sep 19, 2025

@bors try jobs=aarch64

@rust-bors

This comment has been minimized.

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

Extends AArch64 branch protection support to include GCS

try-job: *aarch64*
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 19, 2025

💔 Test for c3587c9 failed: CI. Failed jobs:

@@ -1,8 +1,8 @@
FROM ubuntu:22.04
FROM ubuntu:25.04
Copy link
Member

Choose a reason for hiding this comment

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

Question: doesn't this mean that we no longer test if we can build against Ubuntu 22?

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
g++-15 \
Copy link
Member

Choose a reason for hiding this comment

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

Question: ... and for that matter, is this a higher g++ baseline? (I'm not super sure.)

GCS support was added to GCC in version 15, thus the rmake test for this
patch requires GCC15
Similarly, the ubuntu version is updated so the newer clang version is
available, and/or GCC15 is the default.
@CrooseGit CrooseGit force-pushed the dev/reucru01/AArch64-enable-GCS branch from e02bd51 to bb893df Compare September 22, 2025 10:39
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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

10 participants