Skip to content

Add LLDB native unwind test for createdump dumps (PAC on ARM64) - #6256

Draft
max-charlamb wants to merge 4 commits into
dotnet:mainfrom
max-charlamb:dev/maxcharlamb/lldb-pac-unwind
Draft

max-charlamb wants to merge 4 commits into
dotnet:mainfrom
max-charlamb:dev/maxcharlamb/lldb-pac-unwind

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Adds an LLDB-only, dump-based SOS test that runs raw thread backtrace on the crashing thread of a createdump-generated core (SimpleThrow, Core flavor). It asserts that the unwind reaches libcoreclr.so and the host's corehost_main.

The newer glibc on the Linux ARM64 Helix image enables PAC return addresses. createdump does not write the NT_ARM_PAC_MASK (0x406) note per thread, which kernel cores include. Without that note, LLDB cannot strip PAC bits and the native unwind stops early. This test is expected to fail on Linux ARM64 until createdump is fixed in dotnet/runtime, and to pass on x64.

Draft: opened to observe the result on the ARM64 Helix queue.

Max Charlamb and others added 3 commits November 17, 2026 16:50
Verifies LLDB can unwind the crashing thread of a createdump core through
libcoreclr and JIT code back to the host. On Linux ARM64 with pointer
authentication, createdump does not write the NT_ARM_PAC_MASK note, so LLDB
cannot strip PAC bits from saved return addresses and the unwind stops early.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
Co-authored-by: Copilot <[email protected]>
Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
Combine into a single SosTheory over cdb/LLDB and assert the crash thread unwinds through at least three coreclr frames. Skip musl, where stripped libc lacks unwind info.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
Docker-based Helix queues (e.g. Ubuntu 26.04 ARM64) mount the correlation
payload read-only, so runtests.sh copies dotnet-cli into the work item
before overlaying the private runtime. The harness picks up the copy via
SOSHARNESS_DOTNET_ROOT.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
max-charlamb added a commit to dotnet/runtime that referenced this pull request Nov 18, 2026
- Capture the Linux ARM64 `NT_ARM_PAC_MASK` regset for each thread and
write it as a `LINUX` ELF core note when available.
- Include emitted notes in the `PT_NOTE` size and report unexpected
regset failures without preventing dump creation.
- This allows native tooling to unwind dumps created with createdump
when the system has ARM-PAC enabled.

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:
- [Baseline: queue change only (#137796), run
1687082](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1687082)
- expected to fail `NativeUnwindTests` on Linux ARM64.
- [This PR at dd159c9: queue change + fix, run
1687081](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1687081)
- expected to pass.

---------

Co-authored-by: Max Charlamb <[email protected]>
Co-authored-by: Copilot <[email protected]>
Copilot-Session: d35a41b1-6332-4188-8ee8-793457babe03
steveisok pushed a commit to dotnet/runtime 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant