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

8293660: Fix frame::sender_for_compiled_frame frame size assert #10242

Closed

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Sep 12, 2022

The condition and assert messages are contradicting each other here:

frame frame::sender_for_compiled_frame(RegisterMap* map) const {
  ...
  assert(_cb->frame_size() >= 0, "must have non-zero frame size");
  intptr_t* sender_sp = unextended_sp() + _cb->frame_size();

I found this in x86_32 Loom port, where a entry generator bug caused zero-sized frames. I believe the assert message is correct, and the condition is not: sender SP should be different from (unextended) SP. In fact, if allowed to proceed, the tests can then fail the later assert, assuming sp() == unextended_sp():

  assert(sender_sp != sp(), "must have changed");

This code predates OpenJDK history, and assert was copy-pasted in this form to many arches.

Additional testing:

  • Linux x86_64 fastdebug tier1

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-8293660: Fix frame::sender_for_compiled_frame frame size assert

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10242

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 12, 2022

👋 Welcome back shade! 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 Sep 12, 2022
@openjdk
Copy link

openjdk bot commented Sep 12, 2022

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

  • hotspot

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 hotspot-dev@openjdk.org label Sep 12, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 12, 2022

Webrevs

Copy link
Member

@dean-long dean-long left a comment

Choose a reason for hiding this comment

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

This looks fine. You could probably even use >= 2. More correct would probably be >= metadata_words, but some ports are setting that value to 0, which will probably break things with loom.

There are also some places under hotspot/agent/src/share/classes that are doing the equivalent in Java:

Assert.that(cb.getFrameSize() > 0, "CodeBlob must have non-zero frame size");

which would probably be low-risk to fix in this PR if you wanted.

@openjdk
Copy link

openjdk bot commented Sep 13, 2022

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

8293660: Fix frame::sender_for_compiled_frame frame size assert

Reviewed-by: dlong, 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 24 new commits pushed to the master branch:

  • 7e02039: 8293647: Avoid unnecessary boxing in jdk.hotspot.agent
  • 9039022: 8287394: AArch64: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • 1dc5039: 8293626: AccessFlag::locations(ClassFileFormatVersion cffv) does not throw NPEx when parameter is null
  • 6f2223f: 8288180: C2: VectorPhase must ensure that SafePointNode memory input is a MergeMemNode
  • 725f41f: 8293351: Add second tmp register to aarch64 BarrierSetAssembler::load_at
  • 37234c8: 8291912: Introduce per-allocation target struct for members in G1PLABAllocator
  • 1e1db5d: 8292591: Experimentally add back barrier-less Java thread transitions
  • dfc16e0: 8292302: Windows GetLastError value overwritten by ThreadLocalStorage::thread
  • 8bd79d3: 8170305: URLConnection doesn't handle HTTP/1.1 1xx (informational) messages
  • 9cd3e35: 4834298: JFileChooser.getSelectedFiles() failed with multi-selection and double-click
  • ... and 14 more: https://git.openjdk.org/jdk/compare/37df5f56259429482cfdbe38e8b6256f1efaf9e8...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 13, 2022
@shipilev
Copy link
Member Author

This looks fine. You could probably even use >= 2. More correct would probably be >= metadata_words,
but some ports are setting that value to 0, which will probably break things with loom.

Yeah, I'd prefer to keep the most accepting form. It seems we really want to catch the zero case to guarantee stack walking progress.

There are also some places under hotspot/agent/src/share/classes that are doing the equivalent in Java:
Assert.that(cb.getFrameSize() > 0, "CodeBlob must have non-zero frame size");
which would probably be low-risk to fix in this PR if you wanted.

Fixed those in new commit.

@shipilev
Copy link
Member Author

Any other reviews?

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@shipilev
Copy link
Member Author

Thank you!

/integrate

@openjdk
Copy link

openjdk bot commented Sep 14, 2022

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

  • b3461c1: 8293680: PPC64BE build failure after JDK-8293344
  • 7e02039: 8293647: Avoid unnecessary boxing in jdk.hotspot.agent
  • 9039022: 8287394: AArch64: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • 1dc5039: 8293626: AccessFlag::locations(ClassFileFormatVersion cffv) does not throw NPEx when parameter is null
  • 6f2223f: 8288180: C2: VectorPhase must ensure that SafePointNode memory input is a MergeMemNode
  • 725f41f: 8293351: Add second tmp register to aarch64 BarrierSetAssembler::load_at
  • 37234c8: 8291912: Introduce per-allocation target struct for members in G1PLABAllocator
  • 1e1db5d: 8292591: Experimentally add back barrier-less Java thread transitions
  • dfc16e0: 8292302: Windows GetLastError value overwritten by ThreadLocalStorage::thread
  • 8bd79d3: 8170305: URLConnection doesn't handle HTTP/1.1 1xx (informational) messages
  • ... and 15 more: https://git.openjdk.org/jdk/compare/37df5f56259429482cfdbe38e8b6256f1efaf9e8...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 14, 2022

@shipilev Pushed as commit 60f59a4.

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

@shipilev shipilev deleted the JDK-8293660-sender-sp-assert branch September 14, 2022 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants