Skip to content

Retain page table root finder for in-memory snapshots - #1730

Open
ludfjig wants to merge 1 commit into
ll/snapshot-restore-layout-compatibilityfrom
ll/snapshot-restore-retain-pt-root-finder
Open

Retain page table root finder for in-memory snapshots#1730
ludfjig wants to merge 1 commit into
ll/snapshot-restore-layout-compatibilityfrom
ll/snapshot-restore-retain-pt-root-finder

Conversation

@ludfjig

@ludfjig ludfjig commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

restoring a snapshot into another sandbox could retain the target sandbox’s finder or lose the source guest’s finder. Later snapshots might then discover the wrong page-table roots. This pr fixes that (for in-memory snapshots only as the pt-finder cannot be serialized to disk)

@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Aug 12, 2026
@ludfjig ludfjig changed the title Retain page table root finder in memory snapshots Retain page table root finder for in-memory snapshots Aug 12, 2026
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from 3066727 to 369449c Compare August 12, 2026 18:11
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from 369449c to 7594cc8 Compare August 12, 2026 18:59
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from 7594cc8 to 90f3e0d Compare August 12, 2026 23:08
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from 90f3e0d to e68e972 Compare August 13, 2026 19:46
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from e68e972 to 34faa8e Compare August 13, 2026 21:13
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch 2 times, most recently from 5e7ba67 to 85d03c4 Compare August 13, 2026 22:44
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from 85d03c4 to 454ea47 Compare August 18, 2026 00:54
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig
ludfjig force-pushed the ll/snapshot-restore-retain-pt-root-finder branch from 454ea47 to 1a6288c Compare August 18, 2026 01:20
@ludfjig
ludfjig marked this pull request as ready for review August 18, 2026 01:23
Copilot AI lite review requested due to automatic review settings August 18, 2026 01:23
@ludfjig ludfjig added the ready-for-review PR is ready for (re-)review label Aug 18, 2026

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.

Pull request overview

This PR fixes a correctness issue in the host snapshot/restore pipeline where restoring a snapshot into a different sandbox could accidentally keep the target sandbox’s page-table root finder (or lose the source guest’s finder), leading to later snapshots walking the wrong page-table roots. The fix applies to in-memory snapshots only (the finder remains non-serializable for on-disk snapshots).

Changes:

  • Plumbs an optional runtime-only pt_root_finder through Snapshot so in-memory snapshots retain it across from_snapshot and restore.
  • Updates PtRootFinder to Arc<... + Send + Sync> and wires it through snapshot creation/restoration paths.
  • Adds tests and documentation clarifying that PtRootFinder is not serialized for file-backed snapshots, plus a changelog entry for the breaking API change.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/hyperlight_host/src/sandbox/snapshot/mod.rs Adds pt_root_finder to in-memory Snapshot and a crate-level accessor.
src/hyperlight_host/src/sandbox/snapshot/file/mod.rs Documents that PtRootFinder is not serialized for on-disk snapshots; initializes loaded snapshots with pt_root_finder: None.
src/hyperlight_host/src/sandbox/snapshot/file_tests.rs Extends snapshot round-trip tests to validate in-memory retention and on-disk non-serialization of the finder.
src/hyperlight_host/src/sandbox/initialized_multi_use.rs Switches PtRootFinder to Arc + Sync, propagates it across from_snapshot/restore, and adds thread-safety tests.
src/hyperlight_host/src/mem/mgr.rs Passes optional finder through to Snapshot::new.
CHANGELOG.md Records the breaking change to PtRootFinder (Arc + Sync).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. ready-for-review PR is ready for (re-)review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants