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

8186787: clang-4.0 SIGSEGV in Unsafe_PutByte #553

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

Conversation

zzambers
Copy link
Contributor

@zzambers zzambers commented Jul 25, 2024

This backport fixes failures (segfaults) in following tests which appeared after macos update:

sun/misc/CopyMemory.java 
compiler/unsafe/OpaqueAccesses.java

Backport differs from original changeset, because there were significant changes/refactoring in unsafe.

Notes:

  • original changeset changes pointer returned by addr (MemoryAccess class), to volatile. Otherwise it is basically just refactoring.
  • MemoryAccess is used by Unsafe_{Set,Put}* and Unsafe_{Set,Put}*Volatile functions, defined using DEFINE_GETSETOOP and DEFINE_GETSETOOP_VOLATILE macros
  • jdk8 does not have MemoryAccess class, so equivalent pointers, in functions mentioned higher, are cast to volatile, to achieve same effect

Testing:
Tier1: OK (fixes sun/misc/CopyMemory.java and compiler/unsafe/OpaqueAccesses.java tests on macos, 1 failure on Linux x86 is timeout - seems unrelated, macos failures explained here: #544 (comment))


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • JDK-8186787 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8186787: clang-4.0 SIGSEGV in Unsafe_PutByte (Bug - P2 - Requested)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 553

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 25, 2024

👋 Welcome back zzambers! 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 Jul 25, 2024

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

@openjdk openjdk bot changed the title Backport 6dc1d8c06d98e127b022886172e16b90bf357c97 8186787: clang-4.0 SIGSEGV in Unsafe_PutByte Jul 25, 2024
@openjdk
Copy link

openjdk bot commented Jul 25, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels Jul 25, 2024
@mlbridge
Copy link

mlbridge bot commented Jul 25, 2024

Webrevs

@zzambers
Copy link
Contributor Author

zzambers commented Jul 29, 2024

Log from failing (segfaulting) tests (without fix, for reference):
CopyMemory-segfault.log
OpaqueAccesses-segfault.log

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 26, 2024

@zzambers 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!

@zzambers
Copy link
Contributor Author

keep open

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 21, 2024

@zzambers 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!

3 similar comments
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

@zzambers 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!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

@zzambers 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!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

@zzambers 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!

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2024

@zzambers This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Nov 28, 2024
@zzambers
Copy link
Contributor Author

/open

@openjdk openjdk bot reopened this Jan 28, 2025
@openjdk
Copy link

openjdk bot commented Jan 28, 2025

@zzambers This pull request is now open

@jerboaa
Copy link
Contributor

jerboaa commented Feb 25, 2025

@adinn @tstuefe @theRealAph Could you please help review this? We see crashes of this in GHA, so it looks to fix a real bug. Then again it's fairly late to touch this area in JDK 8u. Thoughts?

@zzambers
Copy link
Contributor Author

Btw, as GHA logs have expired and this is now last remaining issue showing in tier1 on Mac, I have tried to rebase these changes in separate branch (to retest on head).
There are no failures except for security_infra tests - which are unrelated

(I can force-push rebased change here if desired)

@adinn
Copy link
Contributor

adinn commented Feb 26, 2025

@jerboaa I think this is fine to backport. Adding a volatile qualifier to the access cannot really do any harm as it has the very limited effect of stopping the C++ compiler from reordering the volatile field access write relative to other volatile field accesses within the current thread's instruction stream. Since that is actually what is required here I cannot see any real risk. My real concern is that the introduction of volatile is clearly flagged in comments and happens at a point where it is most obvious what is going on and why.

@openjdk
Copy link

openjdk bot commented Feb 26, 2025

@zzambers Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@zzambers
Copy link
Contributor Author

@adinn thank you for the review

I added comment, as you have suggested. (As in the end, approach with DEFINE_GETSETOOP is not used, I kept it as it is.)
Should I mark you as co-author?

I rebased changes on current master, to avoid some unrelated, already fixed failures in GHA testing.

@adinn
Copy link
Contributor

adinn commented Feb 26, 2025

@zzambers It's fine as it is.

@openjdk
Copy link

openjdk bot commented Feb 26, 2025

⚠️ @zzambers 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.

@zzambers
Copy link
Contributor Author

zzambers commented Feb 26, 2025

GHA tests: OK (fixes Mac tests)

Failures:

  • linux x86 failures (know troublemakers/unstable tests)
    • gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java (known, see: JDK-8303159)
    • gc/logging/TestGCId.java - timeout (known, occasionally timeouts on linux x86)
  • jdk/security_infra - unrelated

@zzambers
Copy link
Contributor Author

/approval request Fix to unsafe to avoid tier1 failures (crashes) on Mac, small change, low risk, GHA tests OK

@openjdk
Copy link

openjdk bot commented Feb 26, 2025

@zzambers
8186787: The approval request has been created successfully.

@openjdk openjdk bot added the approval label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants