Arm64:[PAC-RET]Fix ARM64 epilog detection and PAC signing SP recovery - #135088
Open
SwapnilGaikwad wants to merge 4 commits into
Open
SwapnilGaikwad wants to merge 4 commits into
SwapnilGaikwad wants to merge 4 commits into
Conversation
Fixes: dotnet#134912 - Stop treating SP adjustments as evidence of an epilog: they may occur during stack allocation in the function body. - Continue rejecting hijacking after FP or LR has been restored. - For NativeAOT assert that signing SP equals CFA. - Use the caller SP recovered by unwinding to sign hijacked return addresses. This avoids reconstructing signing SP from frame offsets.
|
Azure Pipelines: Successfully started running 6 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Contributor
Author
|
cc: @dotnet/arm64-contrib @jkotas @dhartglassMSFT |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new CFA invariant breaks PAC-enabled ARM64 OSR prologs and can produce invalid hijack signatures.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes ARM64 PAC return-address hijacking and epilog detection in NativeAOT.
Changes:
- Refines ARM64 epilog detection.
- Recovers PAC signing SP through unwinding.
- Adds signing-SP/CFA assertions.
| File | Description |
|---|---|
CorInfoImpl.RyuJit.cs |
Validates PAC CFI assumptions. |
UnixNativeCodeManager.cpp |
Updates epilog detection and PAC signing-SP recovery. |
unwindarm64.cpp |
Asserts PAC occurs before frame setup. |
| UNATIVE_OFFSET cbProlog = unwindGetCurrentOffset(func); | ||
| // Sign before frame setup so signing SP == CFA. | ||
| // Stack probes may precede PAC because they do not change SP. | ||
| assert(func->cfiCodes->empty()); |
Contributor
Author
There was a problem hiding this comment.
This check is in generateCFIUnwindCodes() that's true on Unix NativeAOT. We do not have OSR for NativeAOT so it's safe to assert no cfi codes are present to ensure SP == CFA.
jkotas
reviewed
Oct 2, 2026
Member
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes: #134912