You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: move get_memory_access_violation out from trait
- 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 <4257730+ludfjig@users.noreply.github.com>
* implement memory region tracking in drivers
- 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 <4257730+ludfjig@users.noreply.github.com>
* Make snapshot region aware
- 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 <4257730+ludfjig@users.noreply.github.com>
---------
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
_surrogate_process:SurrogateProcess,// we need to keep a reference to the SurrogateProcess for the duration of the driver since otherwise it will dropped and the memory mapping will be unmapped and the surrogate process will be returned to the pool
282
283
entrypoint:u64,
283
284
orig_rsp:GuestPtr,
284
-
mem_regions:Vec<MemoryRegion>,
285
285
interrupt_handle:Arc<WindowsInterruptHandle>,
286
286
mem_mgr:Option<MemMgrWrapper<HostSharedMemory>>,
287
287
host_funcs:Option<Arc<Mutex<FunctionRegistry>>>,
288
+
289
+
sandbox_regions:Vec<MemoryRegion>,// Initially mapped regions when sandbox is created
290
+
mmap_regions:Vec<MemoryRegion>,// Later mapped regions
291
+
288
292
#[cfg(gdb)]
289
293
debug:Option<HypervDebug>,
290
294
#[cfg(gdb)]
@@ -358,7 +362,8 @@ impl HypervWindowsDriver {
358
362
_surrogate_process: surrogate_process,
359
363
entrypoint,
360
364
orig_rsp:GuestPtr::try_from(RawPtr::from(rsp))?,
361
-
mem_regions,
365
+
sandbox_regions: mem_regions,
366
+
mmap_regions:Vec::new(),
362
367
interrupt_handle: interrupt_handle.clone(),
363
368
mem_mgr:None,
364
369
host_funcs:None,
@@ -457,8 +462,11 @@ impl Debug for HypervWindowsDriver {
457
462
fs.field("Entrypoint",&self.entrypoint)
458
463
.field("Original RSP",&self.orig_rsp);
459
464
460
-
for region in&self.mem_regions{
461
-
fs.field("Memory Region",®ion);
465
+
for region in&self.sandbox_regions{
466
+
fs.field("Sandbox Memory Region",®ion);
467
+
}
468
+
for region in&self.mmap_regions{
469
+
fs.field("Mapped Memory Region",®ion);
462
470
}
463
471
464
472
// Get the registers
@@ -631,18 +639,17 @@ impl Hypervisor for HypervWindowsDriver {
0 commit comments