Repository navigation
guest: cold-boot a retained layered root - #1397
Pedro Henrique Penna (ppenna) merged 1 commit into
Conversation
This pull request changes existing testsIt modifies or removes 5 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: 4; added: 30. Compared the merge base |
There was a problem hiding this comment.
🟡 Changes recommended
Trailing slashes bypass the directory-symlink rejection during home resolution, allowing boot to retain a symlinked home that account-creation mode should reject or repair.
1 open issue
What changed in this PR
Adds layered-root cold boot to nvx-init, building on the existing root, view, and mapping components. It prepares the shared VM root and retains control and mapping handles across a single root switch; workload execution remains outside this PR.
Changes:
- Assemble the root, mount runtime filesystems before live shares, apply the view, and switch root once.
- Centralize account parsing while preserving legacy
EntryAPIs, and add bounded atomic account updates. - Add boot and filesystem regression tests and stabilize the adversarial timeout fixture.
| File | Description |
|---|---|
scripts/test-layout-allowlist.json |
Update allowances for the boot test seam and root annotations. |
scripts/test_adversarial.py |
Wait for child readiness before testing containment timeout. |
nvx-rs/src/guest/sys/rooted/tests.rs |
Test atomic replacement, metadata preservation, and failure cleanup. |
nvx-rs/src/guest/sys/rooted.rs |
Add rooted directory lookup and atomic file replacement. |
nvx-rs/src/guest/root.rs |
Remove obsolete dead-code expectations from boot operations. |
nvx-rs/src/guest/mod.rs |
Register the shared account module. |
nvx-rs/src/guest/init/tests.rs |
Preserve helper and signal tests through test-local drivers. |
nvx-rs/src/guest/init/boot/tests.rs |
Cover boot inputs, account preparation, and native layered boots. |
nvx-rs/src/guest/init/boot/account.rs |
Resolve or create the shared root’s workload account. |
nvx-rs/src/guest/init/boot.rs |
Implement layered boot and retain control and mapping state. |
nvx-rs/src/guest/init.rs |
Connect PID 1 startup to layered boot. |
nvx-rs/src/guest/entry/tests.rs |
Reuse shared account fixtures and relocate parser tests. |
nvx-rs/src/guest/entry.rs |
Delegate account parsing while preserving public paths. |
nvx-rs/src/guest/account/tests.rs |
House relocated account parser tests and fixtures. |
nvx-rs/src/guest/account.rs |
Centralize bounded account database reading and parsing. |
Review effort: Balanced
6e891d5 to
8913204
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A valid single live share targeting /run/nvx/hostfs/root is misclassified as a host export and rejected for lacking virtfs_aggregate=1, causing cold boot to fail.
1 open issue
1 resolved since last review
Review effort: Balanced
8913204 to
c22e445
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The privileged PID 1 root/mount transition and retained mapping handles carry guest-wide risk, and the reported native-boot and multi-backend evidence requires maintainer validation.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
|
For this review, the current evidence is bound to c22e445, not an earlier candidate: all applicable Windows/Linux Rust, Python and quality commands passed; the privileged filesystem cases passed 9 Root and 2 Entry tests; and fresh WHP/MSHV guest boots checked mappings through handles opened before the only root switch, a markerless live share at The guest SDK source digest is These are author-run results, not CI or maintainer approval. The requested maintainer validation of this privileged transition remains outstanding; the PR stays Draft. |
There was a problem hiding this comment.
🔵 Needs a closer look
PID-1 root switching and retained-descriptor changes require human confirmation of reported privileged microVM boot, mapping, and shutdown results that could not be independently validated in this source-only review.
No open issues 🎉
Review effort: Balanced
f26845b to
9c9b018
Compare
9c9b018 to
0f9a26b
Compare
Prepare the root, runtime mounts, view and account through their canonical owners before one switch. Keep control, user/home and mapping handles for the later dispatcher, and require complete mappings before workloads start. Keep the existing timeout regression deterministic by waiting for its real attached fixture child before the unchanged workload deadline and teardown assertions. Refuse final home-directory symlinks even with trailing slashes by normalizing only the lookup path. Preserve the root path, ordinary ancestor resolution and original account home bytes; cover refusal, account repair and unchanged usable-directory defaults. Distinguish a host export from a single live share by its aggregate marker, not just their possibly identical mount target. Keep strict export validation and positive-MAPS requirements while accepting the existing live-share form. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5e14ef9-1791-4b27-b60e-d3efd0e62e16
c22e445 to
29fca59
Compare
29fca59
into
feature/nvx-refactor

Part of #1115. Depends on #1395.
Summary
Boot the real layered root from
nvx-initusing the existing root, view and mapping codecs. Assemble the root, retain its export and mapping descriptors, mount the runtime before live shares beneath/run, apply the view, then switch root exactly once. Hand the initialized root, control channel, identity, account defaults and mapping state to the control caller so it can apply MAPS through retained handles and require completeness before workloads.Move account parsing into one crate-private owner while preserving the legacy public
Entrypaths. Account creation uses bounded, descriptor-relative atomic replacements that preserve database metadata and surface write, rename and directory-sync errors. Home lookup resolves ancestor symlinks inside the prepared root and refuses a final symlink, including trailing slashes. Only the lookup path is normalized;/and the original returned HOME bytes are preserved.Identify a host export by both its directory and the aggregate marker. A single live share may use
/run/nvx/hostfs/rootwithout that marker and remains a shared directory. Malformed aggregate markers still use the unchanged strict export parser, and positive MAPS still require a real export.This does not add restore activation, per-execution containment, another root switch, a new runtime/reaper, workload-exec integration, or kernel/OpenVMM changes.
Scope and existing tests
The complete owned delta is 693 CORE lines across eight counted files, with 15 changed paths and 653 test-category added lines. The physical account extraction is counted in full. The official classifier reproduces the original 693/eight/15 measurement and the same result for the new parent-to-candidate delta.
The existing-test inventory reports five changes: the adversarial fixture atomically publishes its live child PID and bounds readiness to five seconds before the unchanged one-second containment timeout; three obsolete
cfg_attr(not(test), expect(dead_code))annotations are removed from now-called methods; and the boot seam is declared in the existing allowlist. These annotations are lint expectations, not failure-injection hooks. Four tests relocate unchanged; 30 tests are added.Home regressions cover final-symlink refusal and account repair with trailing slashes, while usable paths preserve the exact HOME bytes and account databases. Live-share regressions cover both access modes at ordinary and export-directory targets, malformed/incomplete/mixed forms, and positive-MAPS refusal without an actual export. Real unhooked
nvx-initvalidation is separate from the declared unit-test seam.Validation
Current candidate:
29fca59317ffb67d8a3c89061faddf224c086051, directly on PR1395 head0dd708cfa28ede292101feba561b1e3a3de9dcf7; unchanged OpenVMM pin14dc4116ec7e57567633c4b7b07892aca3a58522.This is an owned-only linear replay of the single original
f26845b0..c22e4459commit, with zero merge commits and no conflicts or source corrections. Git range-diff reports an unchanged patch. Original commit-message bytes, trailers and file modes are preserved; the original and rebased commits are unsigned.Current CI run 42659271988, attempt 2, completed successfully at this head. The first attempt failed three Windows WHP latency metrics at the unchanged greater-than-50% threshold. After an explicit one-job rerun authorization, the Windows platform and its dependent performance/required checks reran; the gate checked 111 metrics and reported zero regressions. Unchanged successful jobs were reused by GitHub, not represented as newly executed. The original measurements, failures and offline gate reproduction are retained. The cause of the earlier slow samples is unproved; no source, threshold or baseline was changed to obtain a pass.
The independent native Opus 5.5/max/long-context whole-owned review found no significant issues. Current-head Copilot review 5829477565 is COMMENTED with no open issues, not formal approval. Fresh current-head unhooked PID1 boot, post-switch MAPS and shutdown evidence requested by its maintainer caveat is now recorded on both MSHV and WHP below; maintainer approval is not inferred.
Fresh local Windows execution completed all 29 Rust rows, including formatting, feature-specific lint/test/build/doc/MSRV checks, runtime-adapter configurations, native vectors and the current CLI build/provenance. Applicable Python lint/type/format/layout/kernel-inventory checks passed. The complete Python unit command passed: 1823 tests, 67 skipped.
The four previously failing local containment cases now passed using the prescribed standalone Python profile, followed by the complete 84-test adversarial action (11 skipped), four host-profile tests, CLI help checks and native PowerShell syntax. These Python-only checks used the existing host guard and the unchanged complete remaining-resource forecast, preserving its reduced compiler cap without invoking a compiler or VM. The earlier virtual-environment launcher/actual-child PID discrepancy and all failed attempts remain recorded; the earlier slowdown or failure causes are not represented as a source fix. No repository assertion, test timeout, skip or default test concurrency was changed.
Fresh Pedro/Linux qualification now actually passed on the user-selected
/mnt/slim-data-2filesystem. The shared compilation broker, versioned full host guard, common reservations and complete-pipeline forecast bound that actual new device; no resource threshold, job ceiling or compiler/VM overlap exception was introduced. All 39 Rust/guest/adapter/vector/CLI rows passed. The ordinary-user Python unit command passed 1823 tests with 30 skipped; adversarial passed all 84 without skips, and all four host-profile tests passed. All 16 quality rows passed, including 25 Specula tests. The exact approved current precompiled nine Root and two Entry cases also executed successfully as UID0/PID1 inside private mount/PID/proc namespaces; approval alone is not counted as execution. No owned privileged mount or test process remained in the host namespace. Root-owned post-test fixture data is retained, not falsely reported removed.Actual guarded MSHV execution passed all three current native cases: MAPS and live-share fixtures exited naturally with zero, and the real unhooked production PID1/root-switch fixture reached its intended time-helper witness and natural exit 125. That expected fixture exit is not represented as a normal zero guest exit. Every structured teardown flag was true. The four public managed-exec configuration, sandbox lifecycle, proxy-only and RAM-upper scenarios then passed, with no observed owned VMM left afterward.
The Linux musl test binary and MAPS/live fixtures were freshly built from this candidate. Runtime kernel/Alpine/Ubuntu/native/CLI inputs passed complete official source/provenance validation. Fresh local guest helpers and current CI runtime helpers have the same complete guest-source identity but different executable bytes; their identities remain separate, and runtime used the explicitly authenticated current CI helpers. Earlier CRLF, temporary-path, wrong-platform-helper and transport failures remain recorded separately; no old-head execution, assertion waiver, deadline change or test-concurrency override was used as a pass.
Fresh guarded WHP execution also passed the same three native cases with natural exits zero/zero/125 and every structured teardown flag true. All four public managed-exec configuration, sandbox lifecycle, proxy-only and RAM-upper scenarios passed, recording 27/41/12/14 checks respectively. No owned VMM remained, and the NVX/native source and index were clean afterward. The original complete remaining 8-GiB RAM/16-GiB DATA reservation was not reduced: the existing shared host guard waited for actual capacity, admitted the policy-reduced 16-GiB VM reservation, then monitored the complete execution. No compiler or additional CI run was invoked.
Applicable local qualification is complete for this frozen candidate. Both platforms used the freshly compiled current Linux musl fixture binary, source-validated current runtime artifacts and unchanged native pin. Prior source executions remain historical; all failed operational attempts remain separate from the successful current evidence.
The main CI run above remains successful. The separate current
repository_context / agentcheck is failed; it was not rerun or represented as a successful check.The preceding
c22e4459qualification remains historical, not a pass for this candidate. Parent local hardware/RESET-ACK qualification is not claimed complete here. The PR stays Draft; no final Ready or merge is requested.