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

8312596: Null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976 #15002

Closed

Conversation

ashu-mehra
Copy link
Contributor

@ashu-mehra ashu-mehra commented Jul 24, 2023

Please review this PR to fix a potential null pointer access in using _compile.
Updated the code to unconditionally initialize _compile and added an assert (similar to C1's PhaseTraceTime constructor) for it to be non-null.


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-8312596: Null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976 (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15002

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

Using diff file

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

Webrev

Link to Webrev Comment

…Phase after JDK-8311976

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 24, 2023

👋 Welcome back ashu-mehra! 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 openjdk bot added the rfr Pull request is ready for review label Jul 24, 2023
@openjdk
Copy link

openjdk bot commented Jul 24, 2023

@ashu-mehra The following label will be automatically applied to this pull request:

  • hotspot-compiler

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 the hotspot-compiler hotspot-compiler-dev@openjdk.org label Jul 24, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 24, 2023

Webrevs

@ashu-mehra
Copy link
Contributor Author

windows-aarch64 builds failed with:

d:\a\jdk\jdk\src\hotspot\cpu\aarch64\assembler_aarch64.hpp(657): error C2220: the following warning is treated as an error
d:\a\jdk\jdk\src\hotspot\cpu\aarch64\assembler_aarch64.hpp(657): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)

Seems unrelated to these changes. Probably caused by this patch @coleenp ?

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

I suggest to remove the word "potential" in the bug title because we can trigger the null pointer with

java -XX:+PrintIdealNodeCount --version

Maybe you also want to add a Hello World like sanity test with -XX:+PrintIdealNodeCount.

Otherwise, the fix looks good.

{
assert(_compile != nullptr, "sanity check");
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is ever null but I guess it does not hurt to keep it in.

@openjdk
Copy link

openjdk bot commented Jul 25, 2023

@ashu-mehra 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:

8312596: Null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976

Reviewed-by: chagedorn, dlong, shade

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

  • b60e0ad: 8313207: Remove MetaspaceShared::_has_error_classes
  • 408987e: 8313307: java/util/Formatter/Padding.java fails on some Locales
  • 6fca289: 8313023: Return value corrupted when using CCS + isTrivial (mainline)
  • f8c2b7f: 8313231: Redundant if statement in ZoneInfoFile
  • 807ca2d: 8313316: Disable runtime/ErrorHandling/MachCodeFramesInErrorFile.java on ppc64le
  • ad34be1: 8312525: New test runtime/os/TestTrimNative.java#trimNative is failing: did not see the expected RSS reduction
  • d6245b6: 8310268: RISC-V: misaligned memory access in String.Compare intrinsic
  • 402cb6a: 8312201: Clean up common behavior in "page writers" and "member writers"
  • 23755f9: 8312411: MessageFormat.formatToCharacterIterator() can be improved
  • e2cb0bc: 8313204: Inconsistent order of sections in generated class documentation
  • ... and 59 more: https://git.openjdk.org/jdk/compare/7dd47998f00712515c25fb852b6c0cf958120508...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@chhagedorn, @dean-long, @shipilev) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 25, 2023
@ashu-mehra ashu-mehra changed the title 8312596: Potential null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976 8312596: Null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976 Jul 26, 2023
@ashu-mehra
Copy link
Contributor Author

@chhagedorn any suggestion where to add the sanity test with -XX:+PrintIdealNodeCount? Is there an existing test that I can piggyback on?

@chhagedorn
Copy link
Member

You can put it in compiler/c2 like the following test, which is also a sanity test for a C2 flag:
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/c2/TestVerifyGraphEdges.java
(You can drop -Xbatch which is implied by -Xcomp)

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 27, 2023
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@ashu-mehra
Copy link
Contributor Author

@chhagedorn

You can put it in compiler/c2 like the following test, which is also a sanity test for a C2 flag:

Thanks for the suggestion. I have added the sanity test. Please review.

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 27, 2023
Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Thanks for adding the test, looks good!

@ashu-mehra
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 27, 2023
@openjdk
Copy link

openjdk bot commented Jul 27, 2023

@ashu-mehra
Your change (at version 70f3eba) is now ready to be sponsored by a Committer.

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Ah, nit in test config.

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Jul 28, 2023
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@ashu-mehra
Copy link
Contributor Author

@JohnTortugo I have added a commit as per your suggestions.

@ashu-mehra
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 31, 2023
@openjdk
Copy link

openjdk bot commented Jul 31, 2023

@ashu-mehra
Your change (at version 8237170) is now ready to be sponsored by a Committer.

@ashu-mehra
Copy link
Contributor Author

@shipilev can you please sponsor this PR.

@shipilev
Copy link
Member

shipilev commented Aug 1, 2023

Yes!

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 1, 2023

Going to push as commit 7ba8c69.
Since your change was applied there have been 83 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 1, 2023
@openjdk openjdk bot closed this Aug 1, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 1, 2023
@openjdk
Copy link

openjdk bot commented Aug 1, 2023

@shipilev @ashu-mehra Pushed as commit 7ba8c69.

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

@ashu-mehra ashu-mehra deleted the JDK-8312596-potential-null-pointer branch August 4, 2023 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
5 participants