Skip to content

8315380: AsyncGetCallTrace crash in frame::safe_for_sender #3003

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jbachorik
Copy link
Contributor

@jbachorik jbachorik commented Feb 26, 2025

This change is fixing the problem in frame_aarch64.cpp, function safe_for_sender, where we have this code

bool unextended_sp_safe = unextended_sp < thread->stack_base();

While this captures one possibility of not being safe, it omits the check for unextended_sp falling within the stack space.

The proposed change then is

bool unextended_sp_safe = (unextended_sp < thread->stack_base() && \
                             sp >= thread->stack_base() - thread->stack_size());

This is actually just making sure the behaviour is the same as in JDK 15+ (since JDK-8238988) where the unextended_sp is checked for being within the stack limits.

The change is not accompanied by a JTReg test because I was not able to craft one triggering the issue reliably.

Existing tests from tier1-tier4 were run on a linux-aarch64 system with no new failures observed.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 2 Reviewers)
  • JDK-8315380 needs maintainer approval

Issue

  • JDK-8315380: AsyncGetCallTrace crash in frame::safe_for_sender (Bug - P4 - Requested)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/3003/head:pull/3003
$ git checkout pull/3003

Update a local copy of the PR:
$ git checkout pull/3003
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/3003/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3003

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/3003.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 26, 2025

👋 Welcome back jbachorik! 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 Feb 26, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 26, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 26, 2025

Webrevs

@jbachorik
Copy link
Contributor Author

/label add hotspot,serviceability

@openjdk
Copy link

openjdk bot commented Mar 7, 2025

@jbachorik
The label hotspot is not a valid label.
The label serviceability is not a valid label.
These labels are valid:

@jbachorik
Copy link
Contributor Author

/label hotspot-runtime

@openjdk
Copy link

openjdk bot commented Mar 7, 2025

@jbachorik
The label hotspot-runtime is not a valid label.
These labels are valid:

Copy link
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

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

Should not the new check be of unextended_sp rather than sp? That would match the check in JDK 17.

@jbachorik
Copy link
Contributor Author

Should not the new check be of unextended_sp rather than sp? That would match the check in JDK 17.

Indeed. I feel a bit stupid now. Fixed.

Copy link
Member

@phohensee phohensee 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 now.

@openjdk
Copy link

openjdk bot commented Mar 10, 2025

⚠️ @jbachorik This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@jbachorik
Copy link
Contributor Author

/approval I would like to ask for approval to integrate this JDK 11 specific bug fix. The change is very limited and improves the profiling experience for users of this Java version.

@openjdk
Copy link

openjdk bot commented Mar 10, 2025

@jbachorik usage: /approval [<id>] (request|cancel) [<text>]

@jbachorik
Copy link
Contributor Author

/approval request I would like to ask for approval to integrate this JDK 11 specific bug fix. The change is very limited and improves the profiling experience for users of this Java version.

@openjdk
Copy link

openjdk bot commented Mar 10, 2025

@jbachorik
8315380: The approval request has been created successfully.

@openjdk openjdk bot added the approval label Mar 10, 2025
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 7, 2025

@jbachorik This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@jbachorik
Copy link
Contributor Author

@jerboaa @gnu-andrew I have created the approval request and tagged the JBS ticket. Would it be possible to review the request?

@jerboaa
Copy link
Contributor

jerboaa commented Apr 16, 2025

@jbachorik This is in a delicate area of the JVM and is a JDK 11u specific fix. Please get a second review for this. Thanks! It would also be good to explain why this isn't an issue in later JDKs on the issue.

@jbachorik
Copy link
Contributor Author

/help

@openjdk
Copy link

openjdk bot commented Apr 16, 2025

@jbachorik Available commands:

  • approval - request for maintainer's approval
  • approve - null
  • author - sets an overriding author to be used in the commit when the PR is integrated
  • backport - create a backport
  • cc - add or remove an additional classification label
  • clean - Mark the backport pull request as a clean backport
  • contributor - adds or removes additional contributors for a PR
  • covered - used when employer has signed the OCA
  • csr - require a compatibility and specification request (CSR) for this pull request
  • help - shows this text
  • integrate - performs integration of the changes in the PR
  • issue - edit the list of issues that this PR solves
  • jep - require a JDK Enhancement Proposal (JEP) for this pull request
  • label - add or remove an additional classification label
  • open - Set the pull request state to "open"
  • reviewer - manage additional reviewers for a PR
  • reviewers - set the number of additional required reviewers for this PR
  • signed - used after signing the OCA
  • solves - edit the list of issues that this PR solves
  • sponsor - performs integration of a PR that is authored by a non-committer
  • summary - updates the summary in the commit message
  • test - used to run tests

@jbachorik
Copy link
Contributor Author

/reviewers @simonis @shipilev

@openjdk
Copy link

openjdk bot commented Apr 16, 2025

@jbachorik Usage: /reviewers <n> [<role>] where <n> is the number of required reviewers. If role is set, the reviewers need to have that project role. If omitted, role defaults to authors.

@jbachorik
Copy link
Contributor Author

/reviewer @dholmes-ora @shipilev

@openjdk
Copy link

openjdk bot commented Apr 16, 2025

@jbachorik Syntax: /reviewer (credit|remove) [@user | openjdk-user]+. For example:

  • /reviewer credit @openjdk-bot
  • /reviewer credit duke
  • /reviewer credit @user1 @user2

@jbachorik
Copy link
Contributor Author

/reviewers 2 reviewer

@openjdk
Copy link

openjdk bot commented Apr 16, 2025

@jbachorik
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 2 Reviewers).

@jbachorik
Copy link
Contributor Author

Ok, I bumped up the number of required reviewers.
But I don't seem to be able to find any mechanism to actually request the second review anywhere.

So, if someone is reading this in the email thread and has a few moments to review this rather trivial change, please, have a look.

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.

I think @apangin would be good to look at it.

Comment on lines 88 to 89
bool unextended_sp_safe = (unextended_sp < thread->stack_base() && \
unextended_sp >= thread->stack_base() - thread->stack_size());
Copy link
Member

Choose a reason for hiding this comment

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

  1. What's the meaning of trailing \ here?
  2. I think you can do unextended_sp >= thread->stack_end() to better capture the intent and match 8238988 better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the meaning of trailing \ here?
No particular meaning, removed.

I think you can do unextended_sp >= thread->stack_end() to better capture the intent and match 8238988 better.
Yes. Done.

Also, I noticed that the check for unextended_sp is not done very consistently across archs. This is also changed in 8238988 but I opted for the simplicity and added the change only for the arch for which the original issue was reported. I hope it's ok but if a more extensive change is preferred I can apply similar logic to other archs as well.

Copy link
Member

Choose a reason for hiding this comment

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

I see this for other arches:

  • AArch64: Checks (stack_base, *)
  • ARM: Checks [stack_base, sp]
  • PPC: Checks (stack_base, *)
  • S390: Checks (stack_base, *)
  • SPARC: Checks [stack_base, sp]
  • x86: Checks (stack_base, sp]

So I think only AArch64, PPC and S390 are affected by this bug? Checking against sp on other arches looks more conservative than checking for stack_end(), so I think we are "fine" there. Given that profiling on PPC and S390 is likely not happening all that often -- I think async-profiler started supporting PPC profiling only not that long ago -- I don't think there is a need to fix those.

@TheRealMDoerr might disagree, though :)

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I'm not interested in asprof with jdk11. One remark: I wouldn't allow Copyright additions if I was lead maintainer.

@jbachorik
Copy link
Contributor Author

@jerboaa AFAICS, it is already mentioned in this comment, along with the JBS ticket that made it safe in JDK 15+

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.

Fine by me, thanks.

@jbachorik
Copy link
Contributor Author

Thanks everyone for helping me to review this!

@jerboaa I think we are ok now?

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.

Still fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

6 participants