experiment: v0.4 Phase 4 PoC — WpBranch snapshot round-trip + restore#160
Merged
Conversation
Uses the production forkd_uffd::wp_snapshot::WpBranch library (not the raw uffd_raw module from earlier PoCs) to capture a snapshot during a KVM guest's lifetime, then loads that snapshot into a fresh KVM VM and validates the restored VM re-runs the guest code correctly. Sequence: 1. source VM: memfd-backed, guest writes 0x42, halts. 2. reset BEFORE marker, WpBranch captures snapshot. 3. fresh dest VM: memfd loaded from snapshot file. 4. dest vcpu runs same guest code from 0:0x100 → writes 0x42. 5. ✓ dest memfd at GPA 0x1000 holds 0x42 (restore is valid). If this passes, the WpBranch-captured snapshot file is functionally restorable — not just bit-consistent with the pre-WP-arm state. This is the last kernel-level question for v0.4: previous PoCs proved WP catches writes and is consistent; this proves the resulting file works as a snapshot. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
The fourth and final kernel-level question for v0.4: are WpBranch-captured snapshots actually restorable, or just bit-consistent?
This PoC uses the production `forkd_uffd::wp_snapshot::WpBranch` library (not raw uffd_raw) to capture a snapshot during a KVM guest's run, then loads that snapshot into a fresh KVM VM and validates the restored VM re-runs the guest code correctly.
Result: PASS
```
[stage 1] source VM
running source vcpu... halted; memfd[0x1000] = 0x42 ✓
[stage 2] WpBranch capture
arm: 13.245µs
bulk_copy: 256 pages
snapshot has BEFORE marker (0xBE) at 0x1000 ✓
[stage 3] restore + re-run
destination memfd loaded with snapshot ✓
dest vcpu halted; memfd[0x1000] = 0x42 (re-ran code) ✓
Phase 4 PASSED — restore is functionally valid, not just bit-consistent.
```
v0.4 kernel-level open questions: all closed
What remains for v0.4 to ship
Integration engineering, not research:
Test plan
🤖 Generated with Claude Code