Skip to content

host: open one strict snapshot directory - #1428

Closed
Enrique Saurez (esaurez) wants to merge 4 commits into
esaurez/slim-2.2.2-sl2.10-20261109from
esaurez/slim-2.3.2-sl2.12b-20261109
Closed

Enrique Saurez (esaurez) wants to merge 4 commits into
esaurez/slim-2.2.2-sl2.10-20261109from
esaurez/slim-2.3.2-sl2.12b-20261109

Conversation

@esaurez

@esaurez Enrique Saurez (esaurez) commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1102

Open the one private snapshot format through Snapshot::{open,key,manifest}.
Require exactly key.bin, snapshot.json, and openvmm/, with exactly the
OpenVMM 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_created
to obtain the now-checked Snapshot from a private fixture; its refusal
assertions 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

  • Source and submodule verification, whitespace/conflict checks, and test
    layout checks passed on this head.
  • The four original patches reconstruct the original qualified tree exactly;
    rebased author identities, messages, trailers, additions, and file modes
    are preserved.
  • Fresh Windows and Linux Rust feature matrices, warning-denied Clippy/docs,
    formatting, MSRV 1.89, both API snapshots, adapters, layout/inventory,
    native vector/CPU-profile comparisons, and Linux guest-binary checks passed.
  • All-features library results: Windows 1306 passed / 9 ignored; Linux
    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.
  • The complete 1823-case CLI inventory passed on both platforms. Linux ran
    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).
  • Adversarial tests: 84 run on each platform (Windows 11 skips, Linux none).
    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.
  • Independent whole-change read-only review completed cleanly on this exact
    head. Current-head Copilot feedback reports no active issues.
  • Full CI run 42719403012,
    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.
  • No guest code, VMM arguments, or CLI VM path changed. No local VM result is
    claimed; hardware checks selected by CI remain CI's responsibility.

Enrique Saurez and others added 4 commits November 9, 2026 15:08
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
@esaurez Enrique Saurez (esaurez) added the tests-modified Changes existing tests, test data, or test wiring label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It 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

Change What Before After
modified test fn a_missing_boot_and_a_snapshot_are_refused_before_any_output_is_created in host::vm::tests nvx-rs/src/host/vm/tests.rs:492 nvx-rs/src/host/vm/tests.rs:492

Test policy

Change What Before After
loosened allowlist entry nvx-rs/src/host/snapshot.rs (the seams allow 1 test hooks) scripts/test-layout-allowlist.json

Relocated unchanged: 0; added: 24. Compared the merge base e4af86899218 with e5096eb6f6de.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.json informational 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

@esaurez

Copy link
Copy Markdown
Contributor Author

Superseded by merged #1440, which explicitly reconstructs this complete SL2.12b strict-reader slice. The entire original own delta (e4af8689..e5096eb6) and the merged replacement's own delta (b253a3dd..4b296464) have the same stable patch ID, c342605fa1dd93d19add7e18a096379f5916db67, covering production, tests, documentation and API/layout updates.

Closing only this original reader PR. Its branch and source at e5096eb6f6de3d49b8fcba1773295266dec9079f are retained; this does not complete or close #1102.

@esaurez
Enrique Saurez (esaurez) deleted the esaurez/slim-2.3.2-sl2.12b-20261109 branch November 13, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat-nvx-refactor tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants