Uh oh!
There was an error while loading. Please reload this page.
Fix createdump SIGSEGV on Heap dumps with interpreter active - #128163
Fix createdump SIGSEGV on Heap dumps with interpreter active#128163max-charlamb merged 2 commits into
Conversation
Thread::m_pInterpThreadContext was declared as a raw InterpThreadContext*. In DAC mode the field's value is a target-process address, so dereferencing it as a host pointer (e.g. from Thread::IsAddressInStack) crashes createdump when enumerating thread stacks for Heap minidumps. Change the field type to PTR_InterpThreadContext (DPTR), matching the treatment of Thread::m_pFrame and similar fields. In non-DAC builds DPTR(T) is just T*, so there is no overhead. In DAC builds the read marshals correctly from the target. The accessor signatures are unchanged. Also remove the <DumpTypes>Full</DumpTypes> workaround on the InterpreterStack DumpTests debuggee so that the Heap path that originally failed is exercised again. Fixesdotnet#128044 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Pull request overview
This PR aims to fix a Linux createdump crash during heap-type minidump generation when the CoreCLR interpreter is active, by making the interpreter thread-context pointer DAC-safe. It also adjusts the cDAC DumpTests “InterpreterStack” debuggee configuration so the previously-problematic heap-dump path is exercised again.
Changes:
- Update
Thread::m_pInterpThreadContextto use a DAC-aware pointer type (PTR_InterpThreadContext) so DAC consumers (e.g.,createdump) don’t treat target addresses as host pointers. - Add the
PTR_InterpThreadContexttypedef incommon.hunderFEATURE_INTERPRETER. - Remove the
InterpreterStackdebuggee’sDumpTypes=Fullworkaround (intended to re-enable heap dumps for this debuggee).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DumpTests/Debuggees/InterpreterStack/InterpreterStack.csproj | Removes the Full-dump-only workaround so heap dump generation is used again for this debuggee. |
| src/coreclr/vm/threads.h | Changes m_pInterpThreadContext to a DAC-safe pointer typedef. |
| src/coreclr/vm/common.h | Introduces PTR_InterpThreadContext typedef under FEATURE_INTERPRETER. |
Uh oh!
There was an error while loading. Please reload this page.
The override was a workaround for dotnet#128044; with that fix in place, fall back to the DumpTestBase default ("heap") so the failing code path is covered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Note
This PR was authored with assistance from GitHub Copilot.
Fixes#128044.
Problem
createdump SIGSEGVs on Linux when generating a Heap-type minidump for a
process running interpreted code. The crash reproduces locally with the
InterpreterStackDumpTests debuggee and matches the CI failure thatprompted
<DumpTypes>Full</DumpTypes>to be added as a temporary workaround.The faulting backtrace is:
Root cause
Thread::m_pInterpThreadContextwas declared as a rawInterpThreadContext *. In non-DAC code that's a normal host pointer, but inDAC mode the field's value is a target-process address. When
IsAddressInStack(a DAC-callable helper) dereferencedm_pInterpThreadContext->pStackStartit read from a target-process addressas if it were a host address, which faults inside createdump.
Fix
Change the field type to
PTR_InterpThreadContext(DPTR), matching thetreatment of other Thread fields like
m_pFrame. In non-DAC buildsDPTR(T)is justT*, so there is no overhead or behavior change. In DACbuilds the read goes through
__DPtr<T>and marshals correctly from thetarget.
Also remove the
<DumpTypes>Full</DumpTypes>workaround on theInterpreterStackDumpTests debuggee so the Heap path that originallyfailed is exercised again.
Validation
Locally reproduced the original SIGSEGV on Linux x64 with the auto-dump
mechanism (
DOTNET_DbgMiniDumpType=2+DOTNET_Interpreter=MethodA)running the
InterpreterStackdebuggee. With this fix applied, createdumpproduces a complete Heap dump (~74 MB) instead of crashing.