Skip to content
Permalink
Browse files
8266419: [aix] in mmap mode, os::attempt_reserve_memory_at() fails to…
… handle wrong mapping address

Reviewed-by: mdoerr
  • Loading branch information
tstuefe committed May 5, 2021
1 parent 250b45a commit 02cdd6eb6d1e4bc99f8f34786e92c33123e50482
Showing with 7 additions and 10 deletions.
  1. +7 −10 src/hotspot/os/aix/os_aix.cpp
@@ -1748,6 +1748,11 @@ static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) {
if (addr == MAP_FAILED) {
trcVerbose("mmap(" PTR_FORMAT ", " UINTX_FORMAT ", ..) failed (%d)", p2i(requested_addr), size, errno);
return NULL;
} else if (requested_addr != NULL && addr != requested_addr) {
trcVerbose("mmap(" PTR_FORMAT ", " UINTX_FORMAT ", ..) succeeded, but at a different address than requested (" PTR_FORMAT "), will unmap",
p2i(requested_addr), size, p2i(addr));
::munmap(addr, extra_size);
return NULL;
}

// Handle alignment.
@@ -1763,16 +1768,8 @@ static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) {
}
addr = addr_aligned;

if (addr) {
trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (" UINTX_FORMAT " bytes)",
p2i(addr), p2i(addr + bytes), bytes);
} else {
if (requested_addr != NULL) {
trcVerbose("failed to mmap-allocate " UINTX_FORMAT " bytes at wish address " PTR_FORMAT ".", bytes, p2i(requested_addr));
} else {
trcVerbose("failed to mmap-allocate " UINTX_FORMAT " bytes at any address.", bytes);
}
}
trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (" UINTX_FORMAT " bytes)",
p2i(addr), p2i(addr + bytes), bytes);

// bookkeeping
vmembk_add(addr, size, 4*K, VMEM_MAPPED);

0 comments on commit 02cdd6e

Please sign in to comment.