Skip to content

Comments

Don't crash when walking callstack roots in the debugger#124402

Merged
hoyosjs merged 2 commits intodotnet:mainfrom
leculver:dac-crash
Feb 24, 2026
Merged

Don't crash when walking callstack roots in the debugger#124402
hoyosjs merged 2 commits intodotnet:mainfrom
leculver:dac-crash

Conversation

@leculver
Copy link
Contributor

Changeset 1fa1745 introduced a stack walking regression where we will crash trying to unwind/report registers. The real fix here is in cgenamd64.cpp/excep.cpp, which will point the context to a local copy before we try to use it.

I've also added some changes in gcinfodecoder.cpp that aren't strictly necessary but would have avoided the problem to begin with.

Fixes #124401.

@dotnet-policy-service
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a critical crash that occurs when debuggers walk callstack roots on Linux amd64 coredumps. The root cause is that context pointers in DAC (Data Access Component) builds resolve through a cache that can evict entries before the pointers are consumed, leading to invalid memory access.

Changes:

  • Fixed AMD64 FaultingExceptionFrame to use local context pointers in DAC builds instead of frame member references
  • Extended SoftwareExceptionFrame context pointer fix from X86-only to all architectures
  • Added defensive checks in GC info decoder to use captured register values in DAC scenarios across all architectures

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/coreclr/vm/amd64/cgenamd64.cpp Added DACCESS_COMPILE guards in FaultingExceptionFrame::UpdateRegDisplay_Impl to point context pointers at local pCurrentContext copy instead of m_ctx members
src/coreclr/vm/excep.cpp Expanded DACCESS_COMPILE context pointer fix from TARGET_X86 to all architectures in SoftwareExceptionFrame::UpdateRegDisplay_Impl
src/coreclr/vm/gcinfodecoder.cpp Added DACCESS_COMPILE && TARGET_UNIX guards to use GetCapturedRegister instead of GetRegisterSlot in ReportRegisterToGC and GetStackSlot across all architectures

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@leculver leculver force-pushed the dac-crash branch 2 times, most recently from 1cc2ca8 to b26de30 Compare February 13, 2026 21:29
Copilot AI review requested due to automatic review settings February 13, 2026 21:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@janvorli
Copy link
Member

Looking at the FaultingExceptionFrame::UpdateRegDisplay_Impl variants, it seems the other architectures would suffer from the same issue.

@leculver
Copy link
Contributor Author

I'll take a look and keep working on it when I'm back in office Tuesday morning.

@leculver
Copy link
Contributor Author

I've updated the other platforms with the fix as well.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@leculver
Copy link
Contributor Author

Before merging, I want JanV to have a chance to weigh in here when he's back on Monday.

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@leculver leculver enabled auto-merge (squash) February 23, 2026 14:22
Copilot AI review requested due to automatic review settings February 23, 2026 14:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

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.

DAC crash when walking stack roots

4 participants