Skip to content

Use hint-safe pointer authentication stripping in NativeAOT#130474

Merged
kotlarmilos merged 2 commits into
mainfrom
copilot/fix-pacstrip-ptr-issue
Jul 10, 2026
Merged

Use hint-safe pointer authentication stripping in NativeAOT#130474
kotlarmilos merged 2 commits into
mainfrom
copilot/fix-pacstrip-ptr-issue

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

NativeAOT executed xpaci during arm64 GC stack walking, causing SIGILL on tvOS devices without pointer authentication. This ports CoreCLR’s hint-safe PacStripPtr implementation.

Changes

  • Preserve the caller’s lr.
  • Move the pointer through lr and execute xpaclri.
  • Return the stripped pointer through x0.
  • Apply the change to Unix and Windows arm64 assembly stubs.
mov lr, x0
xpaclri
mov x0, lr

Note

This description was generated by GitHub Copilot.

Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 10, 2026 11:06
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

Copilot AI changed the title [WIP] Fix PacStripPtr execution on tvOS without pointer authentication Use hint-safe pointer authentication stripping in NativeAOT Jul 10, 2026
Copilot AI requested a review from kotlarmilos July 10, 2026 11:12
Copilot AI had a problem deploying to copilot-pat-pool July 10, 2026 11:17 Failure
@kotlarmilos

Copy link
Copy Markdown
Member

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

jkotas commented Jul 10, 2026

Copy link
Copy Markdown
Member

cc @SwapnilGaikwad

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor

The fix LGTM!
It matches with the fix in asmhelpers.S/asm. Missed to update MiscStubsS/.asm‎

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor

Failure seem unrelated, no SIGILL or Illegal Instruction failures.

@kotlarmilos kotlarmilos marked this pull request as ready for review July 10, 2026 15:54
Copilot AI review requested due to automatic review settings July 10, 2026 15:54

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.

Pull request overview

Updates NativeAOT’s ARM64 PacStripPtr helper to use the same hint-safe pointer-authentication stripping sequence used by CoreCLR, avoiding execution of xpaci x0 and instead using xpaclri while preserving the caller’s lr.

Changes:

  • Replace the Unix ARM64 PacStripPtr leaf stub (xpaci x0; ret) with a nested prolog/epilog that saves fp/lr, routes the input pointer through lr, executes xpaclri, and returns the stripped pointer in x0.
  • Apply the same change to the Windows ARM64 stub, encoding xpaclri as a raw instruction word (consistent with existing PAC instruction encoding patterns in that file).
Show a summary per file
File Description
src/coreclr/nativeaot/Runtime/arm64/MiscStubs.S Switches PacStripPtr to a CoreCLR-matching, hint-safe xpaclri sequence with proper lr preservation/unwind-friendly prolog/epilog.
src/coreclr/nativeaot/Runtime/arm64/MiscStubs.asm Mirrors the same PacStripPtr update for Windows ARM64, using DCD 0xD50320FF for xpaclri.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@kotlarmilos

Copy link
Copy Markdown
Member

Failure seem unrelated, no SIGILL or Illegal Instruction failures.

Correct, no jobs reported SIGILL, EXC_BAD_INSTRUCTION, or signal 4.

@kotlarmilos kotlarmilos enabled auto-merge (squash) July 10, 2026 16:22
@jkotas

jkotas commented Jul 10, 2026

Copy link
Copy Markdown
Member

/ba-g infrastructure timeouts

@kotlarmilos kotlarmilos merged commit 66cc35c into main Jul 10, 2026
133 of 152 checks passed
@kotlarmilos kotlarmilos deleted the copilot/fix-pacstrip-ptr-issue branch July 10, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NativeAOT][tvOS] PacStripPtr executes xpaci on devices without pointer authentication

5 participants