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 1 changed file with 7 additions and 10 deletions.
@@ -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);

3 comments on commit 02cdd6e

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 02cdd6e May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tstuefe
Copy link
Member Author

@tstuefe tstuefe commented on 02cdd6e Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 02cdd6e Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tstuefe the backport was successfully created on the branch tstuefe-backport-02cdd6eb in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 02cdd6eb from the openjdk/jdk repository.

The commit being backported was authored by Thomas Stuefe on 5 May 2021 and was reviewed by Martin Doerr.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev tstuefe-backport-02cdd6eb:tstuefe-backport-02cdd6eb
$ git checkout tstuefe-backport-02cdd6eb
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev tstuefe-backport-02cdd6eb

Please sign in to comment.