From 252d5b3cf3fd7a48fe9d610b59e3d6da9f2c6fe9 Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Fri, 27 Mar 2020 19:07:59 +0000 Subject: handle mmap of large offsets on 32 bit systems While only 32 bits of address can be mapped, that 32 bits can be offset by further than 32 bits in to a large file. As chirantan points out, the try_mmap call was already casting the usize to u64 on all architectures. Convert the usize offset in mmap to u64 and address users of the API as well. Change-Id: I67aed928ea521049fb51eb7aa61ea4de8b4d096c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124879 Reviewed-by: Dylan Reid Tested-by: Dylan Reid Tested-by: kokoro Commit-Queue: Dylan Reid --- src/plugin/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugin/process.rs b/src/plugin/process.rs index ea7a78c..51fc892 100644 --- a/src/plugin/process.rs +++ b/src/plugin/process.rs @@ -361,7 +361,7 @@ impl Process { None => return Err(SysError::new(EOVERFLOW)), _ => {} } - let mem = MemoryMapping::from_fd_offset(&shm, length as usize, offset as usize) + let mem = MemoryMapping::from_fd_offset(&shm, length as usize, offset) .map_err(mmap_to_sys_err)?; let slot = vm.add_mmio_memory(GuestAddress(start), mem, read_only, dirty_log)?; entry.insert(PluginObject::Memory { -- cgit 1.4.1