SOS: read macOS arm64 thread metadata from a valid address - #5953
Open
max-charlamb wants to merge 3 commits into
Open
SOS: read macOS arm64 thread metadata from a valid address#5953max-charlamb wants to merge 3 commits into
max-charlamb wants to merge 3 commits into
Conversation
Probe the new Apple Silicon createdump thread-info address and retain the legacy address fallback for compatibility with existing dumps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7805386d-16fd-4306-bcc9-54d4ea7b65cf
Read Apple Silicon createdump thread metadata from 0x00007ffffff00000 while retaining the legacy-address fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7805386d-16fd-4306-bcc9-54d4ea7b65cf
steveisok
approved these changes
Aug 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Updates SOS’s macOS arm64 thread-metadata reader to probe a new 47-bit-valid synthetic address (to satisfy LLDB) while retaining a fallback to the legacy address for older createdump outputs.
Changes:
- Read
SpecialThreadInfoHeaderfrom a new macOS arm64-safe address, with fallback to the legacy address. - Carry forward the selected base address for subsequent
SpecialThreadInfoEntryreads. - Introduce a dedicated
SpecialThreadInfoLegacyAddressconstant and document the rationale.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/SOS/lldbplugin/services.cpp | Adds fallback probing logic and uses the chosen base address for the thread-info table walk. |
| src/SOS/inc/specialthreadinfo.h | Defines a new 47-bit-valid address for Apple Silicon and a legacy fallback constant. |
Suppressed comments (1)
src/SOS/lldbplugin/services.cpp:2773
- The signature validation is currently only used to decide whether to fall back; if the fallback read succeeds but returns unexpected data (or if legacy == primary), the function can proceed without ever validating
header.signature. Add a post-read validation step (after the potential fallback) that returns early ifheader.signaturedoes not matchSPECIAL_THREADINFO_SIGNATURE.
size_t read = process.ReadMemory(threadInfoAddress, &header, sizeof(SpecialThreadInfoHeader), error);
if ((error.Fail() || read != sizeof(header) ||
strncmp(header.signature, SPECIAL_THREADINFO_SIGNATURE, sizeof(SPECIAL_THREADINFO_SIGNATURE)) != 0)
&& SpecialThreadInfoAddress != SpecialThreadInfoLegacyAddress)
{
// Fall back to the legacy address for dumps produced by older createdump binaries.
error.Clear();
threadInfoAddress = SpecialThreadInfoLegacyAddress;
read = process.ReadMemory(threadInfoAddress, &header, sizeof(SpecialThreadInfoHeader), error);
}
if (error.Fail() || read != sizeof(header))
{
return;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+20
to
+24
| const uint64_t SpecialThreadInfoAddress = 0x00007ffffff00000; | ||
| const uint64_t SpecialThreadInfoLegacyAddress = 0x7fffffff00000000; | ||
| #else | ||
| const uint64_t SpecialThreadInfoAddress = 0x7fffffff00000000; | ||
| const uint64_t SpecialThreadInfoLegacyAddress = 0x7fffffff00000000; |
max-charlamb
added a commit
to dotnet/runtime
that referenced
this pull request
Aug 7, 2026
## Summary - write the macOS arm64 createdump thread-info region at a 47-bit-valid address - emit OS thread IDs using LLDB's `process metadata` `LC_NOTE` format - this is for future support so we can eventually remove the `SpecialThreadInfo` - retain the existing special thread-info segment while consumers migrate to the LLDB format ## Motivation Apple Silicon LLDB rejects the legacy `0x7fffffff00000000` synthetic segment and falls back to sequential thread IDs beginning at zero. SOS then cannot correlate LLDB threads with runtime OS thread IDs or retrieve the selected thread context. Coordinated SOS reader change: dotnet/diagnostics#5953 ## Related precedent This follows @steveisok's coordinated Apple Silicon fix for `SpecialDiagInfoAddress`: - runtime writer: #130443 - diagnostics readers: dotnet/diagnostics#5823 ## Testing Draft pending coordinated diagnostics validation on macOS arm64. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7805386d-16fd-4306-bcc9-54d4ea7b65cf
Keep the shared thread-info architecture condition symmetric with the createdump producer; the definition is only consumed by macOS code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7805386d-16fd-4306-bcc9-54d4ea7b65cf
steveisok
approved these changes
Aug 8, 2026
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.
Summary
Motivation
Apple Silicon LLDB rejects the legacy
0x7fffffff00000000synthetic segment and assigns sequential thread IDs beginning at zero. SOS cannot then correlate LLDB threads with runtime OS thread IDs or retrieve the selected thread context.Coordinated writer change: dotnet/runtime#131962
Related precedent
This follows @steveisok's coordinated Apple Silicon fix for
SpecialDiagInfoAddress:Testing
Draft pending coordinated macOS arm64 validation with the runtime writer change.