Skip to content

[cDAC] Restore non-stub method resolution in GetRuntimeNameByAddress - #10

Open
anurag6569201 wants to merge 1 commit into
qa/agent-dotnet-runtime/pr-10-131977/basefrom
qa/agent-dotnet-runtime/pr-10-131977/head
Open

anurag6569201 wants to merge 1 commit into
qa/agent-dotnet-runtime/pr-10-131977/basefrom
qa/agent-dotnet-runtime/pr-10-131977/head

Conversation

@anurag6569201

Copy link
Copy Markdown

dotnet#127134 removed handling of non-stubs, however, there are still tools that need this functionality.

Source merge-base: ecc21b8a08df017dbe4d92e81191a028213d418e
Source head: 15a5415519fe8cdb1dd2653ecff46a927f6d5076

@shipwright-agent

Copy link
Copy Markdown

⛔ Shipwright · Blocked

Recommendation: do not merge PR #10 · Tier T1
Checks: 0 total · 0 needing attention

Next step: resolve the blocking findings before merge.

Findings (4)

  • CRITICAL The managed path unconditionally calls GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr) and passes the result to GetCodeBlockHandle without validating that the address i · src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:253
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The new managed-code path calls GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr) unconditionally and then passes the result to GetCodeBlockHandle. · src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:253
    • Fix: Fix the review finding before release.
  • HIGH The refactored logic nests the stub classification fallback inside the resultName-is-null block, making the control flow harder to follow. · src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:250
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The new code path trusts the result of GetInterpreterCodeFromInterpreterPrecodeIfPresent without checking whether the returned pointer is valid before dereferencing it via GetCodeB · src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:253
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

Fireworks usage: 7,513 input · 641 output · 8,154 total tokens · $0.0021 · 11s · 0 fix iteration(s)

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.

// Try stub classification
CodeKind codeKind = eman.GetCodeKind(codeAddr);
if (codeKind == CodeKind.StubPrecode || codeKind == CodeKind.FixupPrecode)
TargetCodePointer managedCodeAddr = _target.Contracts.PrecodeStubs.GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · CRITICAL

The managed path unconditionally calls GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr) and passes the result to GetCodeBlockHandle without validating that the address i

Impact: The managed path unconditionally calls GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr) and passes the result to GetCodeBlockHandle without validating that the address is actually an interpreter precode. For non-precode addresses, the contract may return a null/default TargetCodePointer, and GetCodeBlockHandle on that invalid pointer can fail or return an unexpected handle. The previous code only invoked…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

// Try stub classification
CodeKind codeKind = eman.GetCodeKind(codeAddr);
if (codeKind == CodeKind.StubPrecode || codeKind == CodeKind.FixupPrecode)
TargetCodePointer managedCodeAddr = _target.Contracts.PrecodeStubs.GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The new managed-code path calls GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr) unconditionally and then passes the result to GetCodeBlockHandle.

Impact: The new managed-code path calls GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr) unconditionally and then passes the result to GetCodeBlockHandle. If the address is not an interpreter precode, the contract may return a null/default TargetCodePointer, and GetCodeBlockHandle on that invalid pointer can fail or return an unexpected handle. The previous code only called precode-specific APIs after confirming…

Suggested fix: Fix the review finding before release.

// Try stub classification
CodeKind codeKind = eman.GetCodeKind(codeAddr);
if (codeKind == CodeKind.StubPrecode || codeKind == CodeKind.FixupPrecode)
TargetCodePointer managedCodeAddr = _target.Contracts.PrecodeStubs.GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The new code path trusts the result of GetInterpreterCodeFromInterpreterPrecodeIfPresent without checking whether the returned pointer is valid before dereferencing it via GetCodeB

Impact: The new code path trusts the result of GetInterpreterCodeFromInterpreterPrecodeIfPresent without checking whether the returned pointer is valid before dereferencing it via GetCodeBlockHandle. If the contract returns a null or attacker-influenced pointer for a non-precode address, this could lead to an invalid memory access or unexpected handle resolution in the diagnostic data reader.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant