Repository navigation
host: open one strict snapshot directory - #1428
Enrique Saurez (esaurez) wants to merge 4 commits into
Conversation
Validate the private snapshot entries, strict OpenVMM manifest, artifact lengths and matching canonical key. Require the informational description without reading its contents, and leave later immutability to the caller. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 195a07bf-2a62-48c4-96c5-f60b233d27d9
Keep the future restore directory field in production and record its test-dependent dead-code expectation in the existing layout allowlist. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 195a07bf-2a62-48c4-96c5-f60b233d27d9
Regenerate the Linux and Windows public API snapshots for the three filename constants and the checked snapshot methods. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 195a07bf-2a62-48c4-96c5-f60b233d27d9
Document the private snapshot metadata checks and independently refuse valid keys with another contract version or filesystem tag through the public directory reader. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 195a07bf-2a62-48c4-96c5-f60b233d27d9
This pull request changes existing testsIt modifies or removes 2 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests. Test code
Test policy
Relocated unchanged: 0; added: 24. Compared the merge base |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the snapshot-directory reader changes.
No open issues 🎉
What changed in this PR
Adds the strict snapshot-directory reader for #1102, exposing verified metadata for future VM restore support while preserving current cold-boot behavior.
Changes:
- Adds
Snapshot::{open,key,manifest}with exact-layout, privacy, file-type, artifact-length, and key-consistency checks. - Adds validation tests while keeping
snapshot.jsoninformational and unread. - Documents caller-managed immutability and updates both platform API snapshots.
| File | Description |
|---|---|
scripts/test-layout-allowlist.json |
Registers the snapshot directory field’s test-dependent hook. |
nvx-rs/src/host/vm/tests.rs |
Uses a validated snapshot fixture in the existing refusal test. |
nvx-rs/src/host/snapshot/tests.rs |
Adds fixtures and strict-directory validation tests. |
nvx-rs/src/host/snapshot/key/tests.rs |
Tests rejection of incompatible contracts and filesystem tags. |
nvx-rs/src/host/snapshot/key.rs |
Checks key consistency with the manifest and current format. |
nvx-rs/src/host/snapshot.rs |
Implements strict opening, metadata accessors, and entry-name constants. |
nvx-rs/README.md |
Documents the format and caller’s privacy and immutability duties. |
nvx-rs/public-api/windows.txt |
Records the new public snapshot API on Windows. |
nvx-rs/public-api/linux.txt |
Records the new public snapshot API on Linux. |
Review effort: Balanced
|
Superseded by merged #1440, which explicitly reconstructs this complete SL2.12b strict-reader slice. The entire original own delta ( Closing only this original reader PR. Its branch and source at |
Part of #1102
Open the one private snapshot format through
Snapshot::{open,key,manifest}.Require exactly
key.bin,snapshot.json, andopenvmm/, with exactly theOpenVMM manifest, memory, and state files. Check private directories, regular
owner-private files, strict manifest parsing, recorded artifact lengths, and
the matching canonical key. Require the informational description without
reading, parsing, or trusting its contents.
Document the caller's duty to keep the directory and its entries private and
immutable after opening. Expose the three entry-name constants and update
both public-API snapshots. Keep the existing snapshot metadata, cold creation,
and VM lifecycle behavior from the target branch.
Preserve the four reader commits in order on the current target, without
replaying input-composition or final-integration merges. The complete change
measures 150 core lines, 3 counted files, and 9 changed paths.
Test changes
Rewrite
a_missing_boot_and_a_snapshot_are_refused_before_any_output_is_createdto obtain the now-checked
Snapshotfrom a private fixture; its refusalassertions stay unchanged. Add 24 tests covering accepted layouts, missing
or extra entries, private ownership and regular-file refusals, malformed
manifests, recorded-length mismatches, bounded keys, key consistency, and
unread description contents. Register the snapshot directory field's existing
test-dependent dead-code hook; retain all other layout seams and tests.
Validation
layout checks passed on this head.
rebased author identities, messages, trailers, additions, and file modes
are preserved.
formatting, MSRV 1.89, both API snapshots, adapters, layout/inventory,
native vector/CPU-profile comparisons, and Linux guest-binary checks passed.
2109 passed / 52 ignored. The strict snapshot focus passed 68 tests on
Windows and 69 on Linux; the one Linux foreign-owner test also passed
separately with approved privilege. Broad-suite ignored counts stay ignored.
one fully mocked host-ownership case as the unprivileged host caller and
the other 1822 cases in a private user/PID/mount namespace; no case or
assertion was removed (Windows 70 skips, Linux 34).
Host resolver, help, Ruff, both Pyright platforms, shell checks/formatting,
links, kernel inventory, PowerShell syntax, and 25 Linux Specula tests passed.
Specula is unavailable on Windows because it requires Linux-only
fcntl;that extra Windows attempt is not reported as passed.
head. Current-head Copilot feedback reports no active issues.
attempt 1, succeeded on
e5096eb6f6de3d49b8fcba1773295266dec9079f,including both OS Rust jobs and the required check. Earlier environment
failures remain recorded; they are not substituted for successful reruns.
claimed; hardware checks selected by CI remain CI's responsibility.