Fix assertion in snapshot module for pages that are equal to SNAPSHOT_PAGE_SIZE (#2738)

Co-authored-by: Scott Powell <scott.powell@str.us>
This commit is contained in:
Scott 2024-12-03 04:34:56 -05:00 committed by GitHub
parent 36734083f9
commit 0dabc34329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,7 +257,7 @@ impl SnapshotModule {
pub fn access(&mut self, addr: GuestAddr, size: usize) { pub fn access(&mut self, addr: GuestAddr, size: usize) {
// ASSUMPTION: the access can only cross 2 pages // ASSUMPTION: the access can only cross 2 pages
debug_assert!(size > 0 && size < SNAPSHOT_PAGE_SIZE); debug_assert!(size > 0 && size <= SNAPSHOT_PAGE_SIZE);
let page = addr & SNAPSHOT_PAGE_MASK; let page = addr & SNAPSHOT_PAGE_MASK;
self.page_access(page); self.page_access(page);
let second_page = (addr + size as GuestAddr - 1) & SNAPSHOT_PAGE_MASK; let second_page = (addr + size as GuestAddr - 1) & SNAPSHOT_PAGE_MASK;