Skip to content

Fix Windows on Arm PAC default - #160149

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lqd:fix-windows-pac
Jul 31, 2026
Merged

Fix Windows on Arm PAC default#160149
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lqd:fix-windows-pac

Conversation

@lqd

@lqd lqd commented Jul 29, 2026

Copy link
Copy Markdown
Member

Windows on Arm's branch protection only supports PAC Key B for return address signing. The CLI parsing sets it to Key A though, and it doesn't have access to the target information to fix it. This PR adds an accessor function where we can fix this possible discrepancy, and lints against using the branch_protection unstable option field directly.

I don't think we need to have a generic mechanism to allow targets to define the valid options themselves, at least not yet. So this is the rustc version of llvm/llvm-project#203989 and uses basically the same idea to set the correct default.

This fixes the pointer-auth-link-with-c run-make failure happening in the LLVM23 update PR.

It's probable people will want to add a standard value for branch protection, matching clang, and the current accessor will be a good place to do that, compared to e.g. only having an accessor for PacRet::key.

@rustbot rustbot added A-CI Area: Our Github Actions CI A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 29, 2026
@lqd

lqd commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=aarch64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 29, 2026
Fix Windows on Arm PAC default


try-job: aarch64-msvc-1
@rust-log-analyzer

This comment has been minimized.

@lqd
lqd force-pushed the fix-windows-pac branch from 52ebfd4 to 51f92b7 Compare July 29, 2026 12:55
@rust-bors

rust-bors Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f074927 (f0749270224d4341ce2ab6d8ab73416768438d65)
Base parent: ce69831 (ce6983167791bf9418726264f8e5cc7abf73d69b)

@lqd
lqd force-pushed the fix-windows-pac branch from 51f92b7 to 9fdd8e7 Compare July 29, 2026 20:22
@lqd

lqd commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=aarch64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 29, 2026
Fix Windows on Arm PAC default


try-job: aarch64-msvc-1
@rust-bors

rust-bors Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c59702c (c59702cd5210cb41c417e4060e96be20cab65b20)
Base parent: b5be620 (b5be620d5ac9824c4a6030df9fb72644ef4f459b)

@lqd

lqd commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Seems like the test_unstable_options_tracking_hash test I'd also like to see is on the other builder.

@bors try jobs=aarch64-msvc-2

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Fix Windows on Arm PAC default


try-job: aarch64-msvc-2
@lqd
lqd force-pushed the fix-windows-pac branch from 9fdd8e7 to e729464 Compare July 30, 2026 09:26
Windows on Arm only supports PAC Key B for return address signing,
but we don't know the target when parsing the branch protection CLI
flag, and have to adjust this elsewhere.

Accessing the options field directly is now linted against, and the
accessor function `Session::branch_protection` handles the per-target
adjustment.
@rust-bors

rust-bors Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 745d698 (745d69800f882f3fc3f27877219bc14af0bd2ef7)
Base parent: 83709ee (83709eedfff36840b0749ca429ac43f5479b268f)

@lqd
lqd force-pushed the fix-windows-pac branch from e729464 to a0e8bb5 Compare July 30, 2026 10:33
@lqd

lqd commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Both builders pass. The LLVM23 test failures should be fixed once this lands. I've removed nikic's commits used in the try builds, and this should be ready to review.

r? @davidtwco

@lqd
lqd marked this pull request as ready for review July 30, 2026 12:07
@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 Jul 30, 2026
@davidtwco

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a0e8bb5 has been approved by davidtwco

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jul 30, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 30, 2026
Fix Windows on Arm PAC default

Windows on Arm's branch protection only supports PAC Key B for return address signing. The CLI parsing sets it to Key A though, and it doesn't have access to the target information to fix it. This PR adds an accessor function where we can fix this possible discrepancy, and lints against using the `branch_protection` unstable option field directly.

I don't think we need to have a generic mechanism to allow targets to define the valid options themselves, at least not yet. So this is the rustc version of llvm/llvm-project#203989 and uses basically the same idea to set the correct default.

This fixes the `pointer-auth-link-with-c` run-make [failure](https://triage.rust-lang.org/gha-logs/rust-lang/rust/90283463228) happening in the [LLVM23 update PR](rust-lang#158734).

It's probable people will want to add a `standard` value for branch protection, matching clang, and the current accessor will be a good place to do that, compared to e.g. only having an accessor for `PacRet::key`.
rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Rollup of 14 pull requests

Successful merges:

 - #159817 (Rename splat to avoid stable name collisions)
 - #160204 (Sync from portable simd 2026 07 30)
 - #150885 (Revive L4Re target)
 - #158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`)
 - #160125 (Fix typing mode handling in transmute checks and rustc_dump_layout)
 - #160152 (Create on-demand CI job for testing EC2 instances)
 - #159214 (std: improve the documentation of the random feature)
 - #159818 (Resolve vars before calling `unnormalized_obligations`)
 - #160040 (Split function parsing out of `item.rs` to a new module.)
 - #160044 (Add regression tests for fixed dead-code issues)
 - #160144 (renovate: group lockfiles PRs)
 - #160149 (Fix Windows on Arm PAC default)
 - #160175 (Try to recover less from incorrectly parsed const arg)
 - #160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`)
rust-bors Bot pushed a commit that referenced this pull request Jul 31, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #160204 (Sync from portable simd 2026 07 30)
 - #138230 (Add `raw_borrows_via_references` lint)
 - #158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`)
 - #160015 (refactor(mir-transform): Merge `can_be_overridden`, `is_required` and `is_enabled` into one)
 - #160031 (std: make positioned I/O unsupported on VxWorks)
 - #160125 (Fix typing mode handling in transmute checks and rustc_dump_layout)
 - #160152 (Create on-demand CI job for testing EC2 instances)
 - #160232 (rustdoc: fix ICE when a grapheme cluster joins a Prepend-class character to `_` or `:`)
 - #159214 (std: improve the documentation of the random feature)
 - #159818 (Resolve vars before calling `unnormalized_obligations`)
 - #159955 (Stop using higher-order macros to declare arenas)
 - #159958 (Fix avoid cycle for self referential return type notation)
 - #160040 (Split function parsing out of `item.rs` to a new module.)
 - #160044 (Add regression tests for fixed dead-code issues)
 - #160144 (renovate: group lockfiles PRs)
 - #160149 (Fix Windows on Arm PAC default)
 - #160164 (Derive `GenericTypeVisitable` for `RegionConstraint`)
 - #160175 (Try to recover less from incorrectly parsed const arg)
 - #160177 (A few more "predicate"-to-"clause" renamings)
 - #160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`)
 - #160192 (Fix ICE for parsing issue with a closing brace)
 - #160209 (bootstrap: Remove method `Subcommand::kind`)
 - #160221 (Remove `Copy` supertrait from `VaList`)
 - #160223 (interpret: rename validate_operand → validate_place)
 - #160234 (Always use short ty path for call with missing arguments suggestion)
rust-bors Bot pushed a commit that referenced this pull request Jul 31, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #160204 (Sync from portable simd 2026 07 30)
 - #138230 (Add `raw_borrows_via_references` lint)
 - #158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`)
 - #160015 (refactor(mir-transform): Merge `can_be_overridden`, `is_required` and `is_enabled` into one)
 - #160031 (std: make positioned I/O unsupported on VxWorks)
 - #160125 (Fix typing mode handling in transmute checks and rustc_dump_layout)
 - #160152 (Create on-demand CI job for testing EC2 instances)
 - #160232 (rustdoc: fix ICE when a grapheme cluster joins a Prepend-class character to `_` or `:`)
 - #159214 (std: improve the documentation of the random feature)
 - #159818 (Resolve vars before calling `unnormalized_obligations`)
 - #159955 (Stop using higher-order macros to declare arenas)
 - #159958 (Fix avoid cycle for self referential return type notation)
 - #160040 (Split function parsing out of `item.rs` to a new module.)
 - #160044 (Add regression tests for fixed dead-code issues)
 - #160144 (renovate: group lockfiles PRs)
 - #160149 (Fix Windows on Arm PAC default)
 - #160164 (Derive `GenericTypeVisitable` for `RegionConstraint`)
 - #160175 (Try to recover less from incorrectly parsed const arg)
 - #160177 (A few more "predicate"-to-"clause" renamings)
 - #160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`)
 - #160192 (Fix ICE for parsing issue with a closing brace)
 - #160209 (bootstrap: Remove method `Subcommand::kind`)
 - #160221 (Remove `Copy` supertrait from `VaList`)
 - #160223 (interpret: rename validate_operand → validate_place)
 - #160234 (Always use short ty path for call with missing arguments suggestion)
@RalfJung

Copy link
Copy Markdown
Member

@bors p=1
blocking LLVM update

@rust-bors
rust-bors Bot merged commit 88606fe into rust-lang:main Jul 31, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 31, 2026
@lqd
lqd deleted the fix-windows-pac branch July 31, 2026 08:09
rust-timer added a commit that referenced this pull request Jul 31, 2026
Rollup merge of #160149 - lqd:fix-windows-pac, r=davidtwco

Fix Windows on Arm PAC default

Windows on Arm's branch protection only supports PAC Key B for return address signing. The CLI parsing sets it to Key A though, and it doesn't have access to the target information to fix it. This PR adds an accessor function where we can fix this possible discrepancy, and lints against using the `branch_protection` unstable option field directly.

I don't think we need to have a generic mechanism to allow targets to define the valid options themselves, at least not yet. So this is the rustc version of llvm/llvm-project#203989 and uses basically the same idea to set the correct default.

This fixes the `pointer-auth-link-with-c` run-make [failure](https://triage.rust-lang.org/gha-logs/rust-lang/rust/90283463228) happening in the [LLVM23 update PR](#158734).

It's probable people will want to add a `standard` value for branch protection, matching clang, and the current accessor will be a good place to do that, compared to e.g. only having an accessor for `PacRet::key`.
@Kobzol Kobzol mentioned this pull request Jul 31, 2026
9 tasks
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Jul 31, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - rust-lang/rust#160204 (Sync from portable simd 2026 07 30)
 - rust-lang/rust#138230 (Add `raw_borrows_via_references` lint)
 - rust-lang/rust#158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`)
 - rust-lang/rust#160015 (refactor(mir-transform): Merge `can_be_overridden`, `is_required` and `is_enabled` into one)
 - rust-lang/rust#160031 (std: make positioned I/O unsupported on VxWorks)
 - rust-lang/rust#160125 (Fix typing mode handling in transmute checks and rustc_dump_layout)
 - rust-lang/rust#160152 (Create on-demand CI job for testing EC2 instances)
 - rust-lang/rust#160232 (rustdoc: fix ICE when a grapheme cluster joins a Prepend-class character to `_` or `:`)
 - rust-lang/rust#159214 (std: improve the documentation of the random feature)
 - rust-lang/rust#159818 (Resolve vars before calling `unnormalized_obligations`)
 - rust-lang/rust#159955 (Stop using higher-order macros to declare arenas)
 - rust-lang/rust#159958 (Fix avoid cycle for self referential return type notation)
 - rust-lang/rust#160040 (Split function parsing out of `item.rs` to a new module.)
 - rust-lang/rust#160044 (Add regression tests for fixed dead-code issues)
 - rust-lang/rust#160144 (renovate: group lockfiles PRs)
 - rust-lang/rust#160149 (Fix Windows on Arm PAC default)
 - rust-lang/rust#160164 (Derive `GenericTypeVisitable` for `RegionConstraint`)
 - rust-lang/rust#160175 (Try to recover less from incorrectly parsed const arg)
 - rust-lang/rust#160177 (A few more "predicate"-to-"clause" renamings)
 - rust-lang/rust#160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`)
 - rust-lang/rust#160192 (Fix ICE for parsing issue with a closing brace)
 - rust-lang/rust#160209 (bootstrap: Remove method `Subcommand::kind`)
 - rust-lang/rust#160221 (Remove `Copy` supertrait from `VaList`)
 - rust-lang/rust#160223 (interpret: rename validate_operand → validate_place)
 - rust-lang/rust#160234 (Always use short ty path for call with missing arguments suggestion)
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-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants