Skip to content

netvsp: handle guest-triggered WorkerErrors instead of tearing down#3549

Open
erfrimod wants to merge 2 commits into
microsoft:mainfrom
erfrimod:erfrimod/netvsp-netvsc-robustness
Open

netvsp: handle guest-triggered WorkerErrors instead of tearing down#3549
erfrimod wants to merge 2 commits into
microsoft:mainfrom
erfrimod:erfrimod/netvsp-netvsc-robustness

Conversation

@erfrimod
Copy link
Copy Markdown
Contributor

Several error paths in the netvsp worker would propagate errors up as WorkerError, causing the VMM to tear down the network adapter connection when a guest sent malformed or unexpected data. These are guest inputs that cause netvsp to stop processing packets.

  • Malformed packets are skipped with rate-limited tracing.
  • Invalid RNDIS packet completions are traced and skipped.
  • Failing a receive/send buffer setup sends guest a FAILURE status and continues, possibly allowing the guest to retry.
  • Unexpected packets are traced at warn level and skipped.
  • RNDIS control message failures are traced, free the allocated buffers, and skip the message.
    • RNDIS INIT message is a special case, where it attempts to send a VF notification after sending the guest INIT complete. For the VF notification failures, we trace and then skip freeing buffers.

@erfrimod erfrimod requested a review from a team as a code owner May 21, 2026 21:46
Copilot AI review requested due to automatic review settings May 21, 2026 21:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the netvsp worker against malformed or unexpected guest inputs by converting several previously-fatal WorkerError paths into “trace + skip” handling, preventing the VMM from tearing down the network channel due to guest-triggered protocol issues.

Changes:

  • Skip malformed packets during ring draining with rate-limited logging instead of failing the worker.
  • Treat invalid/duplicate RNDIS packet completions and unexpected packet types as non-fatal (rate-limited) events.
  • When send/receive buffer setup fails during initialization, send FAILURE completions to the guest and continue to allow retries; adjust RNDIS control message error handling to free buffers where appropriate.

Comment thread vm/devices/net/netvsp/src/lib.rs
Comment thread vm/devices/net/netvsp/src/lib.rs
Comment thread vm/devices/net/netvsp/src/lib.rs
@github-actions
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.

2 participants