Repository navigation
Reject incomplete time-adjusted snapshot restores - #83
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The validation correctly addresses the inconsistent restore path and is adequately tested.
Review effort: Balanced
Findings: None
What changed in this PR
Rejects incomplete x86 snapshot restores before applying restore-time TSC adjustments.
Changes:
- Requires a serialized
"partition"payload for time-adjusted restores. - Adds coverage for payload presence, absence, and inventory-only cases.
| File | Description |
|---|---|
openvmm/openvmm_core/src/worker/dispatch.rs |
Adds validation and focused snapshot-restore tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Time-adjusted x86_64 restores advance partition-owned clock state, including the restored vCPU TSC. A snapshot without a serialized partition unit cannot safely participate in that adjustment. Validate the saved-state payload before applying frequency checks or restoring VM state. Reject time-adjusted restores when the partition unit payload is missing, while preserving support for snapshots without partition state when no time adjustment is requested. Check the serialized units rather than inventory metadata, and add tests covering valid restores, missing partition state, unadjusted restores, and inventory-only partition entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 92b84e0a-86e8-404d-8265-7a76d8d4ac16
ppenna
force-pushed
the
fix/require-partition-for-time-adjusted-restore
branch
from
September 20, 2026 17:07
ee40bf3 to
89caf8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reject x86 snapshot restores that request restore-time adjustment without carrying the partition saved-state payload.
Problem
SavedStatecontains both an inventory of registered state units and a list of serialized unit payloads. A unit can appear in the inventory while its payload is absent.The restore path permits absent unit payloads:
StateUnits::restoreskips a unit when no matching serialized state is present. However, whenrestore_timeis set, OpenVMM subsequently advances restored VM time and callsPartitionUnit::advance_tscfor the instantiated virtual processors regardless of whether the snapshot restored the partition and VP state.As a result, an x86 snapshot with restore-time adjustment but no
"partition"payload could report a successful restore while applying the time adjustment to the destination VM's pre-existing VP state. The same snapshot and restore policy could therefore produce different guest TSC values depending on the destination state.How Verus exposed the bug
The Verus work modeled successful snapshot restoration as a relation between the saved snapshot, the restore-time policy, and the resulting VM state.
For a VP present in the partition payload, the expected restored TSC can be represented as the saved TSC plus the checked downtime adjustment. For a missing saved VP entry, the existing projection preserves the destination VP value because there is no snapshot value from which to derive a restored value.
This revealed an unrepresentable production path: if the entire partition payload is omitted, production restore skips partition restoration but still adjusts every instantiated VP's TSC. The restore request contains no destination pre-restore TSC values, so no faithful request-derived representation can predict the resulting TSC. A concrete reproduction confirmed that identical snapshot inputs can produce different final counters when starting from different destination values.
This was not a Verus verifier failure. The proof attempt exposed a missing runtime validity check in the production restore path.
Fix
Before performing frequency checks, restoring state units, advancing time, or acquiring the restore stop guard, validate that an x86 restore with
restore_timeincludes a serialized state unit named exactly"partition".If it does not, return:
The check intentionally uses
SavedState.units, notSavedState.inventory: inventory membership records that a unit exists in the VM configuration, but does not prove that the snapshot carries its serialized state.Restores without time adjustment retain the existing sparse-state behavior. Non-x86 builds are unchanged.
Tests
Run with: