Skip to content

underhill_crash: report failed crash dump transfers as errors - #5236

Merged
Sunil Muthuswamy (sunilmut) merged 2 commits into
microsoft:mainfrom
sunilmut:user/sunilmut/crash-transfer-error-repro
Nov 26, 2026
Merged

Sunil Muthuswamy (sunilmut) merged 2 commits into
microsoft:mainfrom
sunilmut:user/sunilmut/crash-transfer-error-repro

Conversation

@sunilmut

@sunilmut Sunil Muthuswamy (sunilmut) commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

send_dump raced its read and write tasks, discarded both results, and always
returned Ok(()). A dump the host rejected, or one cut short by a closed
channel, was therefore reported as delivered and the crash reporter exited
successfully. The existing comment already said a VSP error should make the
function error out.

This change:

  • Returns the result of whichever task finishes first, preferring a host
    error if both finish in the same poll.
  • Propagates streaming and completion errors from the write task.
  • Treats receive failures in the read loop as errors (the host only responds
    to writes on failure).

To test against an in-memory VMBus pipe, read_message, send_dump, and
DumpStreamer are generic over RingMem; the real process still uses
MappedRingMem.

Test changes (the crate's first unit tests, with a fake host over
connected_message_pipes):

  • A host-reported write error fails the transfer (returned Ok before).
  • A closed channel fails the transfer (returned Ok before).
  • A successful transfer delivers every byte in order, then completion.

send_dump discarded the results of its read and write tasks and always
returned success, so a dump the host rejected, or one cut short by a
closed channel, was reported as delivered. Propagate host write errors,
channel failures, and streaming/completion errors so the crash reporter
exits with a failure status. Make the protocol code generic over the
VMBus ring type so it can be tested with in-memory pipes.

Test changes:
- Add the crate's first unit tests, using a fake host over test pipes.
- Verify a host-reported write error fails the transfer.
- Verify a closed channel fails the transfer.
- Verify a successful transfer delivers every byte in order.
@sunilmut
Sunil Muthuswamy (sunilmut) requested a review from a team as a code owner November 23, 2026 00:34
Copilot AI balanced review requested due to automatic review settings November 23, 2026 00:34
@github-actions github-actions Bot added the unsafe Related to unsafe code label Nov 23, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

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.

🟡 Changes recommended

The failure tests cover only read-side errors, leaving writer-side streaming and completion error propagation to send_dump unverified and vulnerable to regressions.

1 open issue
What changed in this PR

This PR makes OpenHCL’s crash reporter propagate dump-transfer failures instead of reporting success when the host rejects a dump or the channel closes.

Changes:

  • Returns the first completed task’s result, prioritizing read-side errors when both tasks are ready.
  • Propagates streaming, completion, and receive errors.
  • Generalizes ring-memory types and adds in-memory tests for successful delivery, host rejection, and channel closure.
File Description
openhcl/​underhill_crash/​src/​lib.rs Propagates transfer errors and adds in-memory transfer tests.
openhcl/​underhill_crash/​Cargo.toml Adds ring-memory and test-tracing dependencies.
Cargo.lock Records the added dependencies for underhill_crash.

Review effort: Balanced

Comment thread openhcl/underhill_crash/src/lib.rs Resolved
Keep the host channel open while an invalid outgoing ring consumer offset
causes streaming and completion writes to fail independently.

Assert that send_dump returns the matching writer error rather than relying
on a competing read-side failure. Both tests reject swallowed writer errors.
Copilot AI balanced review requested due to automatic review settings November 25, 2026 01:36

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.

🟢 Approval recommended

No active review issues are recorded for the crash-dump transfer error-propagation changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@sunilmut
Sunil Muthuswamy (sunilmut) merged commit 2b2021d into microsoft:main Nov 26, 2026
108 of 109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants