File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[package ]
22name = " vmkatz"
3- version = " 1.1.0 "
3+ version = " 1.1.1 "
44edition = " 2021"
55license = " MIT"
66
Original file line number Diff line number Diff line change @@ -340,15 +340,16 @@ pub fn find_ept_candidates<P: PhysicalMemory>(l1: &P) -> Result<Vec<EptCandidate
340340 // Scan budget: if no candidates found after scanning a portion of L1, give up.
341341 // EPT PML4 tables are placed by the hypervisor in the lower portion of L1 memory.
342342 // For genuine VBS VMs, candidates appear within the first few GB.
343- // Small VMs (<2GB) can't run VBS, so reduce budget to 25%.
343+ // Cap at 4GB — scanning more is wasteful since EPTs live in low memory.
344+ const MAX_SCAN_BUDGET : u64 = 4 * 1024 * 1024 * 1024 ;
344345 let scan_budget = if l1_size < 2 * 1024 * 1024 * 1024 {
345346 l1_size / 4
346347 } else {
347- l1_size / 2
348+ ( l1_size / 4 ) . min ( MAX_SCAN_BUDGET )
348349 } ;
349350 let mut pages_since_last_candidate: u64 = 0 ;
350- // Also give up if we've scanned 2M pages (8GB ) without finding a candidate.
351- const PAGES_WITHOUT_CANDIDATE_LIMIT : u64 = 2_000_000 ;
351+ // Give up if we've scanned 256K pages (1GB ) without finding a candidate.
352+ const PAGES_WITHOUT_CANDIDATE_LIMIT : u64 = 256_000 ;
352353
353354 let mut addr: u64 = 0 ;
354355 while addr < l1_size {
Original file line number Diff line number Diff line change @@ -166,7 +166,10 @@ impl VmwareLayer {
166166
167167 /// Parse a .vmsn file and return (regions, tags).
168168 fn parse_vmsn_metadata ( vmsn_path : & Path ) -> Result < ( Vec < MemoryRegion > , Vec < Tag > ) > {
169- let vmsn_data = fs:: read ( vmsn_path) ?;
169+ // Memory-map instead of fs::read to avoid loading the entire multi-GB
170+ // snapshot into memory — only the header/tag pages get paged in.
171+ let vmsn_file = fs:: File :: open ( vmsn_path) ?;
172+ let vmsn_data = unsafe { Mmap :: map ( & vmsn_file) ? } ;
170173
171174 let ( hdr, groups) = header:: parse_vmsn ( & vmsn_data) ?;
172175 log:: info!(
You can’t perform that action at this time.
0 commit comments