Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail #15481

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Aug 30, 2023

There is a long-standing bug on our AIX-port that may cause os::attempt_reserve_memory_at() to return a different address than requested.

All other implementations - usually just using mmap(2) - will unmap again if the attach address differs from the requested one.

On AIX, we use either mmap or shmat, depending on some internal logic and our page size goal. If we use shmat (mostly this is the default nowadays on AIX since we need to use System V APIs for 64K pages), we may end up with an address mapped to the next lower segment boundary. Not only may this round down the requested address by SHMLBA, but it has been observed to result in a very high address if the requested address had been very low (e.g. attempting to map below 0x20_0000 gave us 0xa00_0100_a000_0000). I assume (not having the sources to the AIX kernel) that this is either the result of a wraparound while looking for the next lower segment boundary or it is a segment chosen at random.

Whatever the reason for that behavior, the contract for os::attempt_reserve_memory_at() is to return either the wish address or NULL, not some other address.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15481/head:pull/15481
$ git checkout pull/15481

Update a local copy of the PR:
$ git checkout pull/15481
$ git pull https://git.openjdk.org/jdk.git pull/15481/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15481

View PR using the GUI difftool:
$ git pr show -t 15481

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15481.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2023

👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@tstuefe tstuefe marked this pull request as ready for review August 30, 2023 08:17
@tstuefe
Copy link
Member Author

tstuefe commented Aug 30, 2023

Pinging @backwaterred - could you please test this fix?

@openjdk
Copy link

openjdk bot commented Aug 30, 2023

@tstuefe The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot-runtime hotspot-runtime-dev@openjdk.org rfr Pull request is ready for review labels Aug 30, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 30, 2023

Webrevs

@tstuefe
Copy link
Member Author

tstuefe commented Sep 1, 2023

Pinging @JoKern65 and @TOatGithub . Could you please review and possibly test this? I had no AIX machine to test, so this was done blindly.

@JoKern65
Copy link
Contributor

JoKern65 commented Sep 1, 2023

@tstuefe At least the build was fine, but the team is still running the test suite.

@tstuefe
Copy link
Member Author

tstuefe commented Sep 1, 2023

@tstuefe At least the build was fine, but the team is still running the test suite.

Cool. Thanks!

Copy link
Contributor

@TOatGithub TOatGithub left a comment

Choose a reason for hiding this comment

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

code seems reasonable to me just from viewing at it

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing it! Are you planning to resolve the #ifndef AIX code in 89d18ea separately?

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@tstuefe This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail

Reviewed-by: mdoerr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 13 new commits pushed to the master branch:

  • 42f5b9e: 8315436: HttpsServer does not send TLS alerts
  • 033f311: 8315069: Relativize extended_sp in interpreter frames
  • c2e01eb: 8313983: jmod create --target-platform should replace existing ModuleTarget attribute
  • 81b5d22: 8315459: Print G1 reserved and committed sizes as separate items in VM.info and hs_err
  • 764f65c: 8315278: Patch 'print-targets' target to print targets separated by new line
  • 7754ac0: 8314925: ChoiceFormat does not specify IllegalArgumentExceptions
  • 2264667: 8315422: getSoTimeout() would be in try block in SSLSocketImpl
  • d5973bd: 6333341: [BI] Doc: java.text.BreakIterator class specification is unclear
  • 63f561f: 8306882: (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link
  • 2436fb0: 8312306: Add more Reference.reachabilityFence() calls to the security classes using Cleaner
  • ... and 3 more: https://git.openjdk.org/jdk/compare/c8acab1d913a6c676706fce7ad98a7f831a95682...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 1, 2023
@tstuefe
Copy link
Member Author

tstuefe commented Sep 1, 2023

LGTM. Thanks for fixing it!

Thanks, Martin!

Are you planning to resolve the #ifndef AIX code in 89d18ea separately?

Yes, let's do it after my vacation, in case there are follow-up issues.

@TheRealMDoerr
Copy link
Contributor

Ok, will you file a JBS issue or should I do it?
Please use "/integrate delegate" in case you can't integrate before your vacation.

@tstuefe
Copy link
Member Author

tstuefe commented Sep 1, 2023

Ok, will you file a JBS issue or should I do it?

Done https://bugs.openjdk.org/browse/JDK-8315524

Please use "/integrate delegate" in case you can't integrate before your vacation.

Yeah, lets just integrate now. Thanks @JoKern65 @TOatGithub @TheRealMDoerr !

/integrate

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

Going to push as commit c32e340.
Since your change was applied there have been 13 commits pushed to the master branch:

  • 42f5b9e: 8315436: HttpsServer does not send TLS alerts
  • 033f311: 8315069: Relativize extended_sp in interpreter frames
  • c2e01eb: 8313983: jmod create --target-platform should replace existing ModuleTarget attribute
  • 81b5d22: 8315459: Print G1 reserved and committed sizes as separate items in VM.info and hs_err
  • 764f65c: 8315278: Patch 'print-targets' target to print targets separated by new line
  • 7754ac0: 8314925: ChoiceFormat does not specify IllegalArgumentExceptions
  • 2264667: 8315422: getSoTimeout() would be in try block in SSLSocketImpl
  • d5973bd: 6333341: [BI] Doc: java.text.BreakIterator class specification is unclear
  • 63f561f: 8306882: (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link
  • 2436fb0: 8312306: Add more Reference.reachabilityFence() calls to the security classes using Cleaner
  • ... and 3 more: https://git.openjdk.org/jdk/compare/c8acab1d913a6c676706fce7ad98a7f831a95682...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 1, 2023
@openjdk openjdk bot closed this Sep 1, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 1, 2023
@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@tstuefe Pushed as commit c32e340.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
4 participants