[cDAC] Implement CheckContext for cDAC#128503
Merged
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR wires up DacDbiImpl.CheckContext in the managed cDAC implementation by parsing the incoming platform context buffer and (when control flags are present) validating the stack pointer against the thread’s cached stack bounds. On the native DAC side, it removes the UNSUPPORTED_DbgSkipStackCheck opt-out and related globals.
Changes:
- Implement
DacDbiImpl.CheckContextin managed code with stack-pointer range validation gated on context control flags. - Extend the platform context abstractions to expose
ContextControlFlagsfor architecture-specific masking. - Add targeted unit tests for
CheckContextand remove skip-stack-check knob/logic from the native DAC implementation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DacDbiImplTests.cs | Adds unit tests covering CheckContext behavior for control-flag vs no-control-flag scenarios across target-arch strings. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements managed CheckContext logic (reads context bytes, conditionally validates SP range, returns HRESULTs). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/IPlatformContext.cs | Adds ContextControlFlags to the public platform context interface. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/IPlatformAgnosticContext.cs | Adds ContextControlFlags to the public platform-agnostic context interface. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/ContextHolder.cs | Plumbs ContextControlFlags through the ContextHolder<T> wrapper. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/AMD64Context.cs | Provides architecture-specific ContextControlFlags value for AMD64 contexts. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/ARMContext.cs | Provides architecture-specific ContextControlFlags value for ARM contexts. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/ARM64Context.cs | Provides architecture-specific ContextControlFlags value for ARM64 contexts. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/LoongArch64Context.cs | Provides architecture-specific ContextControlFlags value for LoongArch64 contexts. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/RISCV64Context.cs | Provides architecture-specific ContextControlFlags value for RISC-V64 contexts. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/X86Context.cs | Provides architecture-specific ContextControlFlags value for x86 contexts (public type). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/CorDbHResults.cs | Adds CORDBG_E_NON_MATCHING_CONTEXT constant for managed HRESULT parity. |
| src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp | Removes UNSUPPORTED_DbgSkipStackCheck-based bypass and dead globals; always enforces stack-range check when control flags are present. |
rcj1
approved these changes
May 22, 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
Implements
CheckContextin the managed cDAC. Removes theUNSUPPORTED_DbgSkipStackCheckconfig bypass from the native DAC.Changes
ContextControlFlagsproperty to the platform context interface hierarchyDbgSkipStackCheckconfig knob, dead globals, and skip logic from native DACTests