Skip to content

Make snapshots region aware#742

Merged
ludfjig merged 3 commits into
hyperlight-dev:mainfrom
ludfjig:snapshot
Jul 30, 2025
Merged

Make snapshots region aware#742
ludfjig merged 3 commits into
hyperlight-dev:mainfrom
ludfjig:snapshot

Conversation

@ludfjig

@ludfjig ludfjig commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

This PR makes sure that when restoring to a snapshot, memory region that were mapped when the snapshot was taken, will be remapped if they have been unmapped since.

Will add a follow up pr for making sure snapshots "belong" to a particular sandbox, and can not be used to restore different sandbox.

@ludfjig ludfjig force-pushed the snapshot branch 2 times, most recently from e7ab5a3 to a9486f4 Compare July 30, 2025 06:22
@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Jul 30, 2025
syntactically
syntactically previously approved these changes Jul 30, 2025
Comment thread src/hyperlight_host/src/hypervisor/mod.rs
Comment thread src/hyperlight_host/src/sandbox/initialized_multi_use.rs
Comment thread src/hyperlight_host/src/hypervisor/kvm.rs
@simongdavies

simongdavies commented Jul 30, 2025

Copy link
Copy Markdown
Member

Will add a follow up pr for making sure snapshots "belong" to a particular sandbox, and can not be used to restore different sandbox.

Can we get this done before the next release?

@ludfjig ludfjig changed the title Make snapshot region aware Make snapshots region aware Jul 30, 2025
@ludfjig ludfjig force-pushed the snapshot branch 2 times, most recently from 11084ba to 93612a2 Compare July 30, 2025 17:54
syntactically
syntactically previously approved these changes Jul 30, 2025

@syntactically syntactically left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

dblnz
dblnz previously approved these changes Jul 30, 2025

@dblnz dblnz 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.

LGTM!

Comment thread src/hyperlight_host/src/hypervisor/hyperv_linux.rs
ludfjig added 2 commits July 30, 2025 12:44
- Accept iterator instead of slice
- Move function from trait to module level.
  Necessary to maintain object safety of Hypervisor trait

Signed-off-by: Ludvig Liljenberg <[email protected]>
 - Separate Vecs for initial sandbox regions and mmap regions
 - Replace unmap_regions(n) with unmap_region(region) for precise control
 - Add Hash derive for MemoryRegion and related types
 - Enable use of MemoryRegino in HashSet for efficient set operations

Signed-off-by: Ludvig Liljenberg <[email protected]>
 - Snapshot now contains the memory region that were mapped
   at the time of snapshot
 - On restore, unmap regions that were not mapped at
   time of snapshot. Map regions that were
 - Add simple test

Signed-off-by: Ludvig Liljenberg <[email protected]>
@ludfjig ludfjig merged commit 2dee742 into hyperlight-dev:main Jul 30, 2025
33 checks passed
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants