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

8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array #1572

Closed
wants to merge 1 commit into from

Conversation

iwanowww
Copy link
Contributor

@iwanowww iwanowww commented Dec 2, 2020

Elimination of a single macro node may trigger removal of some other macro nodes (e.g., see PhaseMacroExpand::process_users_of_allocation() which can eliminate AllocateCopy if it is a user of Allocate node being scalar replaced). But PhaseMacroExpand::eliminate_macro_nodes() doesn't take it into account: it iterates over the array backwards one by one and if it is unfortunate to eliminate multiple elements when it is at the very end of the array, it crashes on an out-of-bounds access.

The fix is to adjust current position on every iteration. If there are multiple elements removed, current position can point at an element which is already processed, but that's benign.

Testing:

  • failing tests
  • hs-tier-1-6 w/ -XX:+AlwaysIncrementalInline

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1572/head:pull/1572
$ git checkout pull/1572

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 2, 2020

👋 Welcome back vlivanov! 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 Dec 2, 2020

@iwanowww 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 Dec 2, 2020
@iwanowww iwanowww changed the title 8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array. 8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array Dec 2, 2020
@iwanowww iwanowww marked this pull request as ready for review December 2, 2020 19:21
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 2, 2020
@mlbridge
Copy link

mlbridge bot commented Dec 2, 2020

Webrevs

Copy link

@neliasso neliasso left a comment

Choose a reason for hiding this comment

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

Looks good!

@openjdk
Copy link

openjdk bot commented Dec 2, 2020

@iwanowww 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:

8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array

Reviewed-by: neliasso, kvn

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

  • 3da30e9: 8257241: CDS should not handle disableEagerInitialization for archived lambda proxy classes
  • 7104400: 8257164: Share LambdaForms for VH linkers/invokers
  • 3e89981: 8257623: vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java shouldn't use timeout
  • 93b6ab5: 8256818: SSLSocket that is never bound or connected leaks socket resources
  • 692b273: 8257189: Handle concurrent updates of MH.form better
  • 6704266: 8257565: epsilonBarrierSet.hpp should not include barrierSetAssembler
  • 0b8c780: 8256256: UL should not use heap allocation for output string
  • 2508bc7: 8257140: Crash in JvmtiTagMap::flush_object_free_events()
  • cfb50a9: 8253916: ResourceExhausted/resexhausted001 crashes on Linux-x64
  • 287b829: 8254877: GCLogPrecious::_lock rank constrains what locks you are allowed to have when crashing
  • ... and 16 more: https://git.openjdk.java.net/jdk/compare/927504e8270b4ea44c10d7faf0959b107281ddfe...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 Dec 2, 2020
@iwanowww
Copy link
Contributor Author

iwanowww commented Dec 4, 2020

Thanks for the reviews, Nils and Vladimir.

@iwanowww
Copy link
Contributor Author

iwanowww commented Dec 4, 2020

/integrate

@openjdk openjdk bot closed this Dec 4, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 4, 2020
@openjdk
Copy link

openjdk bot commented Dec 4, 2020

@iwanowww Since your change was applied there have been 67 commits pushed to the master branch:

  • fd6756e: 8257634: C2: Introduce IncrementalInliningForceCleanup diagnostic flag
  • af6b7f9: 8257743: Minimal build on AArch64 failed with --disable-precompiled-headers
  • d6dd440: 8256264: Printed GlyphVector outline with low DPI has bad quality on Windows
  • 2b4a423: 8255542: Attribute length of Module, ModulePackages and other attributes is ignored
  • ca40267: 8257509: Strengthen requirements to call G1HeapVerifier::verify(VerifyOption)
  • 4a85514: 8257182: JCK test failures in integer / long rotation tests
  • f33808f: 8257631: C2: Assertion failure in ArrayCopyNode::get_count() during late inlining
  • 417e7e6: 8257632: C2: Late inlining attempt on a call with a dead memory crashes
  • 6845fee: 8257625: C2: Harden input checks in vector intrinsics
  • 4390f2c: 8257630: C2: ReplacedNodes doesn't handle non-CFG multi nodes
  • ... and 57 more: https://git.openjdk.java.net/jdk/compare/927504e8270b4ea44c10d7faf0959b107281ddfe...master

Your commit was automatically rebased without conflicts.

Pushed as commit fbdc187.

💡 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-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants