Skip to content

Conversation

dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Jul 29, 2025

The fix for JDK-8361447 added a new field to the GuardHeader, not realizing that the size of the GuardHeader must be such that the address of the user-data has the strictest necessary alignment (16-byte).

We need to add a padding field to restore the alignment.

A static assert is added to check the alignment.

Testing:

  • tiers 1-3 (in progress)

Thanks


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-8364235: Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory (Bug - P2)

Reviewers

Contributors

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26524

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 29, 2025

👋 Welcome back dholmes! 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.

@openjdk
Copy link

openjdk bot commented Jul 29, 2025

@dholmes-ora 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:

8364235: Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory

Co-authored-by: Johan Sjölen <[email protected]>
Reviewed-by: dcubed, jsjolen, aboldtch

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 111 new commits pushed to the master branch:

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 rfr Pull request is ready for review label Jul 29, 2025
@openjdk
Copy link

openjdk bot commented Jul 29, 2025

@dholmes-ora 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.

@mlbridge
Copy link

mlbridge bot commented Jul 29, 2025

Webrevs

Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd prefer to do it the way I suggest.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 29, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jul 29, 2025
@dholmes-ora
Copy link
Member Author

/contributor add jdksjolen

@openjdk
Copy link

openjdk bot commented Jul 30, 2025

@dholmes-ora jdksjolen was not found in the census.

Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <[email protected]>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@dholmes-ora
Copy link
Member Author

/contributor add @jdksjolen

@openjdk
Copy link

openjdk bot commented Jul 30, 2025

@dholmes-ora
Contributor Johan Sjölen <[email protected]> successfully added.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 30, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Aug 3, 2025
@dholmes-ora
Copy link
Member Author

Thanks for the reviews @xmas92 and @jdksjolen !

@dholmes-ora
Copy link
Member Author

@kimbarrett and I discussed this further at some length after I flagged the max_align_t issue. On further analysis, considering in particular 32-bit systems, there is no guarantee that we actually get a properly aligned based address with alignas(16) when we are malloc'ing ourselves, as the "new alignment" may only be 8-bytes not 16-bytes. To deal with that Kim suggested revising the the GuardedMemory calculations so that we use align_up(size, 16) ensure the user-data will actually placed on a 16-byte boundary, regardless of the initial placement of the GuardHeader or its size. I am working on that revision.

I also want to investigate a potential regression test.

@dholmes-ora
Copy link
Member Author

After even more discussions it seems there is no way to guarantee the required base-address alignment, we just have to assume it is correct (as we implicitly assume today), so the alignas(16) fix will stay. Just need someone to re-approve after the comment edit. Thanks.

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

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

Thumbs up.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed rfr Pull request is ready for review labels Aug 6, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 6, 2025
@dholmes-ora
Copy link
Member Author

Thanks Dan!

/integrate

@zhaosongzs
Copy link
Member

/touch

@openjdk
Copy link

openjdk bot commented Aug 7, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 7, 2025

@dholmes-ora Pushed as commit 078d0d4.

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

@openjdk
Copy link

openjdk bot commented Aug 7, 2025

@zhaosongzs The command touch can only be used in open pull requests.

@dholmes-ora dholmes-ora deleted the 8364235-guardedmemory-alignment branch August 7, 2025 05:01
@dholmes-ora
Copy link
Member Author

/backport jdk25u

@openjdk
Copy link

openjdk bot commented Aug 8, 2025

@dholmes-ora the backport was successfully created on the branch backport-dholmes-ora-078d0d49-master in my personal fork of openjdk/jdk25u. To create a pull request with this backport targeting openjdk/jdk25u: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 078d0d49 from the openjdk/jdk repository.

The commit being backported was authored by David Holmes on 7 Aug 2025 and was reviewed by Daniel D. Daugherty, Johan Sjölen and Axel Boldt-Christmas.

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/jdk25u:

$ git fetch https://github.com/openjdk-bots/jdk25u.git backport-dholmes-ora-078d0d49-master:backport-dholmes-ora-078d0d49-master
$ git checkout backport-dholmes-ora-078d0d49-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk25u.git backport-dholmes-ora-078d0d49-master

⚠️ @dholmes-ora You are not yet a collaborator in my fork openjdk-bots/jdk25u. An invite will be sent out and you need to accept it before you can proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

7 participants