Skip to content

vmbus_serial_host: implement RX_CLEAR_BUFFER instead of todo!()#3687

Open
rei141 wants to merge 1 commit into
microsoft:mainfrom
rei141:fix-vmbus-serial-rx-clear-buffer
Open

vmbus_serial_host: implement RX_CLEAR_BUFFER instead of todo!()#3687
rei141 wants to merge 1 commit into
microsoft:mainfrom
rei141:fix-vmbus-serial-rx-clear-buffer

Conversation

@rei141

@rei141 rei141 commented Jun 7, 2026

Copy link
Copy Markdown

Summary

The RX_CLEAR_BUFFER host notification is guest-triggerable but reached todo!("clear rx buffer unimplemented"), so a
guest could panic the serial device in the paravisor after the VERSION handshake.

Fix

Implement the branch by clearing the buffered host->guest RX data (self.state.rx_bytes.clear();). This is both the
security fix (no longer panics on guest input) and the intended functionality.

Impact

Denial of service (reachable todo!() panic), not memory unsafety. Scoped to the attacking guest's own VM — an
unprivileged VTL0 guest crashing the VTL2 paravisor that serves it (a self-DoS); no cross-VM/host impact.

The RX_CLEAR_BUFFER host notification is guest-triggerable but reached
`todo!()`, so a guest could panic the serial device. Implement it by
clearing the buffered RX bytes.
@rei141 rei141 requested a review from a team as a code owner June 7, 2026 17:32
Copilot AI review requested due to automatic review settings June 7, 2026 17:32

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Implements handling for a guest-issued “clear RX buffer” notification to avoid guest-triggerable panics and correctly discard buffered RX data.

Changes:

  • Replaces a todo!() panic with logic to clear the buffered RX bytes on RX_CLEAR_BUFFER.
  • Adds explanatory comments documenting why this must be non-panicking.

// The guest asked to discard buffered host->guest RX data. This
// is guest-controlled, so it must not panic (the previous
// `todo!()` was a guest-triggerable DoS); just clear the buffer.
self.state.rx_bytes.clear();
match notification {
HostNotifications::RX_CLEAR_BUFFER => {
todo!("clear rx buffer unimplemented")
// The guest asked to discard buffered host->guest RX data. This

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.

This comment isn't necessary, it's just restating the obvious and mentioning now obsolete history.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

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.

3 participants