镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Arm64: [PAC-RET] cDAC changes - #135959

Merged
jkotas merged 21 commits into
dotnet:mainfrom
SwapnilGaikwad:github-pac-cdac
Nov 5, 2026
Merged

jkotas merged 21 commits into
dotnet:mainfrom
SwapnilGaikwad:github-pac-cdac

Conversation

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor

This PR covers the cDAC subset of changes from 1#25436 related to cDAC.
It follows the previous work from- #127949, #127838, #128147 and #128950

More details on PAC and its role in software security can be found (here).

cc: @dotnet/arm64-contrib @a74nh @jkotas @dhartglassMSFT

Strip PAC from saved return addresses before unwinding and resolving code.
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 16, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor Author

The CI status of changes when PAC is enabled is found on PR #125436.

Comment thread src/coreclr/unwinder/arm64/unwinder.cpp Resolved
Comment thread src/coreclr/vm/cdacplatformmetadata.cpp Resolved
max-charlamb pushed a commit that referenced this pull request Oct 20, 2026
Some runtime paths report stack-interior references without using
PromoteCarefully. Filter these references from both cDAC and runtime
results before comparison so asymmetric filtering does not produce false
stress-test failures.

NOTE: This PR is created with the help of codex to address failing CI
pipeline for #135959

cc: @dotnet/arm64-contrib @dhartglassMSFT @max-charlamb
@SwapnilGaikwad

Copy link
Copy Markdown
Contributor Author

The CI failures look unrelated to PAC changes.
Hi @max-charlamb could you take a look the patch and let us know how can we push this further?

@max-charlamb

Copy link
Copy Markdown
Member

Changes look pretty good.

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor Author

Hi @jkotas, kindly look at the patch and let me know if there is anything we need to push this further.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing x86 transition-frame tests lack the required metadata mock, and PAC handling remains untested for explicit frames and real ARM64 dumps.

4 open issues
What changed in this PR

Adds ARM64 pointer-authentication support to cDAC stack walking, complementing the earlier JIT, VM, and NativeAOT work by recovering usable addresses from signed return addresses.

Changes:

  • Publishes a runtime-derived pointer-authentication mask through platform metadata.
  • Applies the mask during ARM64 unwinding and explicit-frame handling, and adjusts native Windows PAC stripping.
  • Adds mask and unwind unit tests and updates the platform-metadata specification.
File Description
src/​native/​managed/​cdac/​tests/​UnitTests/​StackWalkTests.cs Adds PAC unwind cases and platform-metadata mocks.
src/​native/​managed/​cdac/​tests/​UnitTests/​PlatformMetadataTests.cs Tests missing masks and selective bit clearing.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Legacy/​ConversionExtensions.cs Removes the obsolete PAC rejection from address conversion.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Data/​PlatformMetadata.cs Reads the optional authentication mask.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​StackWalk/​StackWalk_1.cs Uses normalized frame return addresses for method lookup.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​StackWalk/​FrameHandling/​FrameHelpers.cs Strips authentication bits from explicit-frame return addresses.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​StackWalk/​FrameHandling/​BaseFrameHandler.cs Normalizes inlined-call and transition-frame instruction pointers.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​StackWalk/​FrameHandling/​ARM64FrameHandler.cs Normalizes hijack-frame return addresses.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​StackWalk/​Context/​ARM64/​ARM64Unwinder.cs Handles the PAC unwind opcode using the target mask.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​PrecodeStubs_Common.cs Removes obsolete PAC-specific rejection.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​PlatformMetadata_1.cs Exposes the mask, defaulting to zero when absent.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​CodePointerUtils.cs Adds shared return-address masking.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Abstractions/​Contracts/​IPlatformMetadata.cs Replaces the PAC flag with a mask accessor.
src/​coreclr/​vm/​datadescriptor/​datadescriptor.inc Exports the mask field in runtime descriptors.
src/​coreclr/​vm/​cdacplatformmetadata.hpp Stores the authentication mask in native metadata.
src/​coreclr/​vm/​cdacplatformmetadata.cpp Derives and initializes the ARM64 mask.
src/​coreclr/​unwinder/​arm64/​unwinder.cpp Clears bit 47 when stripping PAC on Windows.
docs/​design/​datacontracts/​PlatformMetadata.md Documents the mask accessor and optional-field behavior.
docs/​design/​datacontracts/​data-descriptor-meanings.json Describes the new mask descriptor.

Review effort: Balanced

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@jkotas
jkotas merged commit 51bd84c into dotnet:main Nov 5, 2026
155 checks passed
@SwapnilGaikwad
SwapnilGaikwad deleted the github-pac-cdac branch November 5, 2026 11:16
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Diagnostics-cdac community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants