You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openvmm: unsupported snapshot state panics restore after potentially changing the partition #1168
A decoded snapshot containing CPU or VM elements unsupported by the destination partition panics the VM worker instead of returning a restore error. Supported elements earlier in the restore order may already have changed the partition.
In vmm_core/virt/src/state.rs, state_trait! generates this per-element restore block:
if let Some(value) = state.$get.as_ref() {
// TODO: assert good or not?
assert!(<$ty as $crate::state::StateElement<$caps, $vp>>::is_present(self.caps()));
self.$set(value).map_err(|err| $crate::state::StateError{phase: concat!("restore ", stringify!($id)), err})?;
if cfg!(debug_assertions) {
if <$ty as $crate::state::StateElement<$caps, $vp>>::can_compare(self.caps()) {
assert_eq!(&self.$get().expect($id), value, "restore state mismatch (actual/expected)");
}
}
}
A field's presence in decoded protobuf input does not establish backend support. The unconditional assertion checks a property of external snapshot input, and checking it inside the setter loop is too late to prevent earlier mutation.
Trigger
Restore a decoded snapshot containing SynIC CPU state into a KVM partition without Hyper-V enlightenments. VM-level hypercall or reference-TSC state presents the same problem when those elements are unsupported. Ordinary saves omit unavailable elements, but crafted or incompatible snapshot input can still contain them.
Fix
fix.patch preflights every present snapshot element against destination capabilities before invoking any setter or commit. An unsupported element returns StateError; the backend-error source becomes optional because this rejection occurs before backend access. Backend failures retain their actual error sources.
This prevents partial mutation caused by unsupported elements. It does not make restore transactional against arbitrary failures from later backend setters.
Activity
tangruize commentedon Nov 1, 2026
Proposed patch
Patch against OpenVMM
998b9f2402050cd16d1faa897bc831ef1434be48. Save the contents below asfix.patchand rungit apply fix.patch.fix.patchdoc: specify the refusal of an element that the partition lacks
openvmm: pin the refusal of a restored element that the partition lacks