microsoft / microsoft/openvmm

nvme_driver: harden error handling in restore path

Open
#3,229 0 comments 0 reactions 1 assignee View on GitHub

@gurasinghMS is already working on this.

Since Apr 8, 2026.

storage
Dominant language
Rust
Stars
1.9k
Forks
238
Avg merge
1d 15h
Merged PRs (30d)
100

Description

Pre-existing error handling gaps in NvmeDriver::restore() identified during review of #3220. None are regressions — they existed before the eager/lazy restore split.

Items
  1. flat_map silently drops queue restore failures — The restore loop uses flat_map with a Result-returning closure. Because Result implements IntoIterator, Err values are silently dropped. A queue that fails to restore (e.g., interrupt mapping failure) is quietly omitted with no diagnostic. Should use map + collect::<Result<Vec<_>, _>>()? to propagate errors.

  2. expect("unable to find restored mem block") panics on mismatch — If saved state doesn't match the restored DMA allocations (corrupt state, version skew), this panics instead of returning a structured error. Should use .ok_or_else(|| anyhow!(...))?.

  3. per_cpu[q.cpu as usize].set().unwrap() panics on invalid CPU — No bounds check before indexing, and .unwrap() on .set() panics if the slot is already occupied (duplicate CPU in saved state). Should validate q.cpu < cpu_count and handle duplicates with an error return.

Also tracked by Microsoft-internal ADO 61766158

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.