Skip to content

Fix macOS single-file runtime info capture - #134353

Merged
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/fix-macos-singlefile-runtime-info
Sep 21, 2026
Merged

max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/fix-macos-singlefile-runtime-info

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Summary

  • use the relocated Mach-O symbol address directly when capturing DotNetRuntimeInfo
  • document that MachOModule::TryLookupSymbol returns an absolute target address
  • rename related variables to distinguish addresses from offsets

Details

MachOModule::TryLookupSymbol returns m_loadBias + n_value, which is already the symbol's relocated address in the target process. The macOS single-file createdump path added the module base again, causing the DotNetRuntimeInfo read to target an invalid address. Since ReadMemory also registers the containing page for the dump, the failed read could leave reduced dumps without the runtime version and legacy DAC identity.

Validation

  • independently parsed a .NET 11 osx-x64 single-file Mach-O image and verified the returned address is within the image while the previous double-based address is outside it
  • audited all MachOModule::TryLookupSymbol callers for similar address handling
  • end-to-end macOS dump validation pending CI

MachOModule::TryLookupSymbol returns a relocated target address, but createdump added the module base again before reading DotNetRuntimeInfo. Use the returned address directly and clarify the lookup contract.

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

Copilot-Session: fef3d44c-e682-4eee-9fcf-f621dda46b83
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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.

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.

Copilot review overview

🟢 Approval recommended

The change is narrowly scoped, matches the Mach-O reader’s existing “relocated address” computation, and fixes the only confirmed incorrect use site in the macOS single-file createdump path.

Review effort: Lite
Findings: None

What changed in this PR

Fixes macOS createdump’s single-file runtime info capture by treating MachOModule::TryLookupSymbol results as already-relocated target virtual addresses (rather than module-relative offsets), avoiding an erroneous second base addition when reading DotNetRuntimeInfo.

Changes:

  • Document MachOModule::TryLookupSymbol as returning a relocated target address and rename out-parameters accordingly.
  • Rename local variables in the Mach-O reader export path to reflect “address” semantics.
  • Fix macOS single-file DotNetRuntimeInfo read to use the symbol’s relocated address directly (instead of module.BaseAddress() + symbolOffset).
File Description
src/​coreclr/​debug/​dbgutil/​machoreader.h Documents TryLookupSymbol address semantics and renames the out-parameter to symbolAddress.
src/​coreclr/​debug/​dbgutil/​machoreader.cpp Renames locals/out-params to reflect absolute-address semantics; implementation continues to return m_loadBias + n_value.
src/​coreclr/​debug/​createdump/​crashinfomac.cpp Fixes single-file DotNetRuntimeInfo read to use the relocated symbol address directly, preventing double-basing.

@max-charlamb
max-charlamb requested a review from rcj1 September 21, 2026 16:54
@max-charlamb
max-charlamb enabled auto-merge (squash) September 21, 2026 17:20
@max-charlamb

Copy link
Copy Markdown
Member Author

/ba-g All tests passed, stuck on Monitor Helix Jobs

@max-charlamb
max-charlamb merged commit 5da3c23 into dotnet:main Sep 21, 2026
109 of 111 checks passed
@max-charlamb
max-charlamb deleted the dev/max-charlamb/fix-macos-singlefile-runtime-info branch September 21, 2026 20:33
@steveisok

Copy link
Copy Markdown
Member

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 22, 2026
steveisok pushed a commit that referenced this pull request Sep 22, 2026
Backport of #134353 to release/11.0

/cc @steveisok @max-charlamb

## Customer Impact

- [ ] Customer reported
- [ ] Found internally

[Select one or both of the boxes. Describe how this issue impacts
customers, citing the expected and actual behaviors and scope of the
issue. If customer-reported, provide the issue number.]

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]

**IMPORTANT**: If this backport is for a servicing release, please
verify that:

- For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`,
not `release/X.0`.
- For .NET 10+: The PR target branch is `release/X.0` (no `-staging`
suffix).

## Package authoring no longer needed in .NET 9

**IMPORTANT**: Starting with .NET 9, you no longer need to edit a NuGet
package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older
versions.

Co-authored-by: Max Charlamb <[email protected]>
Co-authored-by: Max Charlamb <[email protected]>
Copilot-Session: fef3d44c-e682-4eee-9fcf-f621dda46b83
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants