Repository navigation
Preserve ARM64 PAC masks in Linux core dumps - #137777
Merged
max-charlamb merged 6 commits intoNov 18, 2026
Merged
Conversation
Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: Successfully started running 3 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. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Co-authored-by: Copilot <[email protected]>
This reverts commit b4f6b73. Co-authored-by: Copilot <[email protected]>
max-charlamb
marked this pull request as ready for review
November 18, 2026 00:49
max-charlamb
requested review from
SwapnilGaikwad,
hoyosjs,
jkotas,
steveisok and
tommcdon
November 18, 2026 01:07
steveisok
reviewed
Nov 18, 2026
steveisok
approved these changes
Nov 18, 2026
Match the diagnostics CI queue so PAC-signed return addresses are exercised. Co-authored-by: Copilot <[email protected]> Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
steveisok
approved these changes
Nov 18, 2026
Co-authored-by: Copilot <[email protected]> Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
This was referenced Nov 18, 2026
Validation-only; the queue change is tracked separately in dotnet#137796. Co-authored-by: Copilot <[email protected]> Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
steveisok
approved these changes
Nov 18, 2026
Open
3 tasks
hoyosjs
approved these changes
Nov 18, 2026
Member
Author
|
/backport to release/11.0 |
Contributor
|
Started backporting to |
Contributor
|
@max-charlamb backporting to git am output$ git cherry-pick 2e314e7a7d6888c4fb1494b3dee8a66d6425c521
Auto-merging src/coreclr/debug/createdump/dumpwriterelf.h
CONFLICT (content): Merge conflict in src/coreclr/debug/createdump/dumpwriterelf.h
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/createdumpcore.h deleted in HEAD and modified in 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)). Version 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)) of src/coreclr/debug/createdump/shared/createdumpcore.h left in tree.
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/dumpwriterelf.cpp deleted in HEAD and modified in 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)). Version 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)) of src/coreclr/debug/createdump/shared/dumpwriterelf.cpp left in tree.
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/threadsnapshot.cpp deleted in HEAD and modified in 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)). Version 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)) of src/coreclr/debug/createdump/shared/threadsnapshot.cpp left in tree.
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/threadsnapshot.h deleted in HEAD and modified in 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)). Version 2e314e7a7d6 (Preserve ARM64 PAC masks in Linux core dumps (#137777)) of src/coreclr/debug/createdump/shared/threadsnapshot.h left in tree.
error: could not apply 2e314e7a7d6... Preserve ARM64 PAC masks in Linux core dumps (#137777)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Preserve ARM64 PAC masks in Linux core dumps
Using index info to reconstruct a base tree...
A src/coreclr/debug/createdump/shared/createdumpcore.h
A src/coreclr/debug/createdump/shared/dumpwriterelf.cpp
A src/coreclr/debug/createdump/shared/dumpwriterelf.h
A src/coreclr/debug/createdump/shared/threadsnapshot.cpp
A src/coreclr/debug/createdump/shared/threadsnapshot.h
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/debug/createdump/dumpwriterelf.h
CONFLICT (content): Merge conflict in src/coreclr/debug/createdump/dumpwriterelf.h
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/createdumpcore.h deleted in HEAD and modified in Preserve ARM64 PAC masks in Linux core dumps. Version Preserve ARM64 PAC masks in Linux core dumps of src/coreclr/debug/createdump/shared/createdumpcore.h left in tree.
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/dumpwriterelf.cpp deleted in HEAD and modified in Preserve ARM64 PAC masks in Linux core dumps. Version Preserve ARM64 PAC masks in Linux core dumps of src/coreclr/debug/createdump/shared/dumpwriterelf.cpp left in tree.
CONFLICT (modify/delete): src/coreclr/debug/createdump/shared/threadsnapshot.cpp deleted in HEAD and modified in Preserve ARM64 PAC masks in Linux core dumps. Version Preserve ARM64 PAC masks in Linux core dumps of src/coreclr/debug/createdump/shared/threadsnapshot.cpp left in tree.
Auto-merging src/coreclr/debug/createdump/threadinfo.h
CONFLICT (content): Merge conflict in src/coreclr/debug/createdump/threadinfo.h
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Preserve ARM64 PAC masks in Linux core dumps
Error: The process '/usr/bin/git' failed with exit code 128 |
2 of 4 tasks
steveisok
pushed a commit
that referenced
this pull request
Nov 20, 2026
Backport of #137777 to release/11.0. Manual backport: the bot cherry-pick conflicted because createdump was reorganized into `shared/` on main. Changes are ported to the `release/11.0` layout (`ThreadSnapshot` -> `ThreadInfo`, `createdumpcore.h` -> `createdump.h`, `CrashInfo::Threads()` holds `ThreadInfo*`). Logic is unchanged. ## Customer Impact - [ ] Customer reported - [x] Found internally On Linux ARM64 systems where glibc signs return addresses with PAC (e.g. Ubuntu 26.04 / glibc 2.43), dumps created by createdump omit the `NT_ARM_PAC_MASK` note. Without it, LLDB cannot strip PAC bits from return addresses and native stack unwinding stops after the first libc frames, so crash dumps cannot be fully analyzed. ## Regression - [ ] Yes - [x] No Exposed by newer distros that enable PAC by default; createdump never wrote this note. ## Testing dotnet/diagnostics#6256 adds `NativeUnwindTests`, which asserts LLDB unwinds through multiple runtime frames in a createdump dump. A/B on the Ubuntu 26.04 ARM64 queue against main: baseline without fix (run 1687082) vs. with fix (run 1687081). ## Risk Low. ARM64 Linux only. Adds one optional per-thread ELF note when the kernel exposes the PAC mask regset; failures to read it are logged and do not prevent dump creation. Co-authored-by: Max Charlamb <[email protected]> Co-authored-by: Copilot <[email protected]> Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
max-charlamb
added a commit
that referenced
this pull request
Nov 21, 2026
## Summary #137777 added `NT_ARM_PAC_MASK` support so Linux ARM64 core dumps preserve the PAC (Pointer Authentication Code) address mask, letting debuggers correctly strip signed return addresses when unwinding. That PR also contained a macOS equivalent, but it was reverted (`c6d46965dcd56ea37441a826457a5f039370e765`) because it hadn't been built or tested on real macOS/PAC hardware. This PR reapplies that macOS fix (cherry-picked from the reverted commit `b4f6b7329b7efa4733918edcae847aa9a911a752`) and validates it end-to-end on real Apple Silicon PAC hardware. ### What it does On ARM64 macOS, `createdump` now emits an `LC_NOTE` named `"addrable bits"` in the Mach-O core dump, containing a version-4 `{version, lowAddressBits, highAddressBits, reserved}` payload sourced from `sysctlbyname("machdep.virtual_address_size", ...)`. This matches the format LLDB/`debugserver` already expect/produce, so LLDB can correctly determine how many address bits are valid and strip PAC signing bits from return addresses when unwinding arm64e-signed frames. - `src/coreclr/debug/createdump/shared/dumpwritermacho.cpp`: adds `BuildAddressableBitsNote()`, wires it into `WriteDump()`/`WriteHeader()`. - `src/coreclr/debug/createdump/shared/dumpwritermacho.h`: adds `AddressableBitsPayload` struct and related `DumpWriter` members. ### Validation Performed on a local Apple M3 Pro (confirmed `FEAT_PAuth`, `FEAT_PAuth2`, `FEAT_FPAC`, `FEAT_PACIMP` all enabled via `sysctl hw.optional.arm.*`): 1. Built `createdump` with the fix (`osx.arm64.Debug`) and deployed it into a matching testhost's shared framework directory. 2. Ran a minimal managed app that throws an unhandled exception with `DOTNET_DbgEnableMiniDump=1 DOTNET_DbgMiniDumpType=4` to produce a full core dump. 3. Confirmed via `otool -l` that an `LC_NOTE` with `data_owner="addrable bits"` is present, and manually decoded its 16-byte payload (`{version=4, lowAddressBits=47, highAddressBits=47, reserved=0}`) — this **exactly matches** the live `sysctl machdep.virtual_address_size` value (47) on the machine. 4. To rule out a regression from this change, reproduced an (unrelated, pre-existing) LLDB crash (`Bus error` in `ObjectFileMachO::ParseSymtab`/OSO debug-map parsing on this Xcode LLDB build) identically on dumps produced **with and without** the fix, confirming it's an environment issue unrelated to this change, not a regression. > [!NOTE] > This PR description and the investigation behind it were drafted with GitHub Copilot CLI assistance. Co-authored-by: Max Charlamb <[email protected]> Co-authored-by: Copilot <[email protected]>
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.
NT_ARM_PAC_MASKregset for each thread and write it as aLINUXELF core note when available.PT_NOTEsize and report unexpected regset failures without preventing dump creation.Related to #109457.
Validation (A/B on Ubuntu 26.04 / glibc 2.43, both using dotnet/diagnostics#6256). The temporary queue change used for validation (dd159c9) has been reverted from this PR; the baseline carries only that queue change:
NativeUnwindTestson Linux ARM64.