Skip to content

Commit

Permalink
Fix bug in mmap logic
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb committed Aug 31, 2024
1 parent ac32915 commit d086a37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ impl MemBlock
return cur_size;
}

// Compute the address from which to mmap
let map_addr = unsafe { transmute(self.mem_block.add(cur_size)) };

let map_size = new_size - cur_size;
Expand All @@ -508,7 +509,7 @@ impl MemBlock
map_addr,
map_size,
libc::PROT_WRITE | libc::PROT_READ,
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS | libc::MAP_FIXED,
-1,
0
)};
Expand Down

0 comments on commit d086a37

Please sign in to comment.