@@ -640,13 +640,11 @@ impl Snapshot {
640640 /// The file format uses a page-aligned memory blob that can be
641641 /// mmapped directly on load for zero-copy instantiation.
642642 ///
643- /// Note: extra memory regions added via
644- /// [`map_region`](crate::MultiUseSandbox::map_region) or
645- /// [`map_file_cow`](crate::MultiUseSandbox::map_file_cow) are
646- /// **not** persisted. Only the primary sandbox memory is saved.
647- /// Regions that were folded into the snapshot memory (by taking
648- /// a snapshot after mapping) are included since they become part
649- /// of the memory blob.
643+ /// # Portability
644+ ///
645+ /// Snapshot files are **not portable** across CPU architectures,
646+ /// hypervisors, or operating systems. All three are checked at
647+ /// load time and a mismatch produces an error.
650648 pub fn to_file ( & self , path : impl AsRef < std:: path:: Path > ) -> crate :: Result < ( ) > {
651649 use std:: io:: { BufWriter , Write } ;
652650
@@ -750,6 +748,10 @@ impl Snapshot {
750748 /// The memory blob is mapped directly from the file for zero-copy
751749 /// loading using platform-specific CoW mechanisms.
752750 ///
751+ /// Returns an error if the file is from a different CPU
752+ /// architecture, hypervisor, or OS than this host. See
753+ /// [`Snapshot::to_file`] for the full portability story.
754+ ///
753755 /// Note: ELF unwind info (`LoadInfo`) is not persisted in the
754756 /// snapshot file, so the `mem_profile` feature will not have
755757 /// accurate profiling data for sandboxes created from disk
@@ -761,6 +763,9 @@ impl Snapshot {
761763 /// Load a snapshot from a file on disk without verifying the
762764 /// content hash. This is faster for large snapshots in trusted
763765 /// environments where file integrity is guaranteed by other means.
766+ ///
767+ /// All other portability checks (architecture, hypervisor, OS)
768+ /// still apply. See [`Snapshot::to_file`] for details.
764769 pub fn from_file_unchecked ( path : impl AsRef < std:: path:: Path > ) -> crate :: Result < Self > {
765770 Self :: from_file_impl ( path, false )
766771 }
0 commit comments