Bug
mmap.c and mmap64.c call TRANSLATE_GUEST_POINTER_TO_HOST(addr) on the address argument. Since addr is a guest virtual address and not a pointer to data, this causes unexpected memory allocation via mmap.
When using mmap (with MAP_FIXED flag) with non-NULL addr:
- glibc translates:
host_addr = base + addr
- rawposix truncates 64-bit to 32-bit:
useraddr = host_addr as u32
- rawposix translates again:
sysaddr = base + useraddr
Bug
mmap.candmmap64.ccallTRANSLATE_GUEST_POINTER_TO_HOST(addr)on the address argument. Sinceaddris a guest virtual address and not a pointer to data, this causes unexpected memory allocation via mmap.When using mmap (with MAP_FIXED flag) with non-NULL addr:
host_addr = base + addruseraddr = host_addr as u32sysaddr = base + useraddr