Skip to content

Commit 3928bf3

Browse files
committed
WIP: kani proofs
Signed-off-by: Babis Chalios <[email protected]>
1 parent 805443f commit 3928bf3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/vmm/src/arch/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ fn arch_memory_regions_with_gap(
132132
gap_start: usize,
133133
gap_size: usize,
134134
) -> Option<(usize, usize)> {
135+
// 0-sized gaps don't really make sense. We should never receive such a gap.
136+
assert!(gap_size > 0);
137+
135138
let first_addr_past_gap = gap_start + gap_size;
136139
match (size + offset).checked_sub(gap_start) {
137140
// case0: region fits all before gap

src/vmm/src/arch/x86_64/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ mod verification {
477477
};
478478

479479
#[kani::proof]
480-
#[kani::unwind(3)]
480+
#[kani::unwind(4)]
481481
fn verify_arch_memory_regions() {
482482
let offset: u64 = kani::any::<u64>();
483483
let len: u64 = kani::any::<u64>();
@@ -486,6 +486,13 @@ mod verification {
486486
kani::assume(offset.checked_add(len).is_some());
487487

488488
let regions = arch_memory_regions(offset as usize, len as usize);
489+
for region in &regions {
490+
println!(
491+
"region: [{:x},{:x})",
492+
region.0.0,
493+
region.0.0 + region.1 as u64
494+
);
495+
}
489496

490497
// There are two MMIO gaps, so we can get either 1, 2 or 3 regions
491498
assert!(regions.len() <= 3);

0 commit comments

Comments
 (0)