-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8336095: Use-after-free in Superword leads to memory corruption #20297
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
Conversation
👋 Welcome back thartmann! A progress list of the required criteria for merging this PR into |
@TobiHartmann 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:
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 60 new commits pushed to the
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 |
@TobiHartmann The following label will be automatically applied to this pull request:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TobiHartmann Looks good to me. Thanks for finding the root cause and fixing this bug!
Future RFE:
We should probably create a dedicated arena for each Phase, so that the memory can be released after each phase, and re-used properly with the next phase. That could reduce memory footprint.
Thanks for the review.
Yes, I thought about that as well. There are also some places where we use the |
Filed JDK-8337015. |
I tried but could not reproduce the issues with your fix. They do reproduce with baseline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
Thanks Richard and Vladimir. I'll wait for final confirmation from @reinrich before integrating this. |
The nightly test runs of the suite triggering those issues were good, but probably we have to wait 1-2 more days (the issue did not show up every night). |
No issues seen in our test infrastructure with the patch for a couple of days. Looks good (but I am not a JIT expert) . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good to me.
Thanks, Richard.
Great, thanks for checking! I'll integrate on Monday. |
/integrate |
Going to push as commit 90641a6.
Your commit was automatically rebased without conflicts. |
@TobiHartmann Pushed as commit 90641a6. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
JDK-8333684 refactored code in Superword and moved a ResourceMark such that a re-allocation of the
Node_List
IdealLoopTree::_body
now happens within a nested ResourceMark.IdealLoopTree::_body
is still live and used once we leave the scope of that ResourceMark, leading to a use-after-free bug causing memory corruption (for details, see JBS):This was reported by SAP (@MBaesken) and only happened in their internal testing. I was able to reproduce this though by adding additional verification code that I will integrate separately with JDK-8336999 because other data structures / containers in C2 should have it as well.
The solution is to allocate
IdealLoopTree::_body
in thecomp_arena
(similar to JDK-8325672). My verification code now passes.Best regards,
Tobias
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20297/head:pull/20297
$ git checkout pull/20297
Update a local copy of the PR:
$ git checkout pull/20297
$ git pull https://git.openjdk.org/jdk.git pull/20297/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20297
View PR using the GUI difftool:
$ git pr show -t 20297
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20297.diff
Webrev
Link to Webrev Comment