Skip to content

Make snapshots region aware #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 30, 2025
Merged

Make snapshots region aware #742

merged 3 commits into from
Jul 30, 2025

Conversation

ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Jul 30, 2025

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
@simongdavies
Copy link
Contributor

simongdavies commented Jul 30, 2025

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
Copy link
Member

@syntactically syntactically left a comment

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
Copy link
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

LGTM!

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