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

8271925: ZGC: Arraycopy stub passes invalid oop to load barrier #5014

Closed
wants to merge 2 commits into from

Conversation

@TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented Aug 5, 2021

The fix for JDK-8270461, see PR 252, made sure that the arraycopy offset when cloning an oop array always points to the first element of the array. However, it missed to adjust the copy length as well, leading to reading/copying 8 bytes beyond the end of the array.

This only reproduces in Valhalla (probably because the mark word layout differs there) and only with -XX:-UseCompressedClassPointers. I'll backport the fix to JDK 17u.

Thanks,
Tobias


Progress

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

Issue

  • JDK-8271925: ZGC: Arraycopy stub passes invalid oop to load barrier

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5014/head:pull/5014
$ git checkout pull/5014

Update a local copy of the PR:
$ git checkout pull/5014
$ git pull https://git.openjdk.java.net/jdk pull/5014/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5014

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5014.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Aug 5, 2021

👋 Welcome back thartmann! 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.

Loading

@openjdk openjdk bot added the rfr label Aug 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 5, 2021

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

  • hotspot-gc

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.

Loading

@openjdk openjdk bot added the hotspot-gc label Aug 5, 2021
@TobiHartmann
Copy link
Member Author

@TobiHartmann TobiHartmann commented Aug 5, 2021

/label add hotspot-compiler

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Aug 5, 2021

@TobiHartmann
The hotspot-compiler label was successfully added.

Loading

@TobiHartmann
Copy link
Member Author

@TobiHartmann TobiHartmann commented Aug 5, 2021

/label remove hotspot-gc

Loading

Copy link
Contributor

@neliasso neliasso left a comment

Looks good.

Loading

@TobiHartmann
Copy link
Member Author

@TobiHartmann TobiHartmann commented Aug 5, 2021

Thanks for the review, Nils!

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Aug 5, 2021

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

8271925: ZGC: Arraycopy stub passes invalid oop to load barrier

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

  • a86ac0d: 8271939: Clean up primitive raw accessors in oopDesc
  • b84a9c7: 8271956: AArch64: C1 build failed after JDK-8270947
  • 38ff85c: 8271461: CompileCommand support for hidden class methods
  • c495ede: 8272099: mark hotspot runtime/Monitor tests which ignore external VM flags
  • e882087: 8271904: mark hotspot runtime/ClassFile tests which ignore external VM flags
  • fa36e33: 8271513: support JavaThreadIteratorWithHandle replacement by new ThreadsList::Iterator
  • cc61520: 8270842: G1: Only young regions need to redirty outside references in remset.
  • f4cf2f7: 8272095: ProblemList java/nio/channels/FileChannel/Transfer2GPlus.java on linux-aarch64
  • 0aca4f7: 8271868: Warn user when using mac-sign option with unsigned app-image.
  • b6a19f1: 8271128: InlineIntrinsics support for 32-bit ARM
  • ... and 18 more: https://git.openjdk.java.net/jdk/compare/4abe5311407c68d04fb0babb87fa279e35d5fabc...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.

Loading

@openjdk openjdk bot added ready and removed hotspot-gc labels Aug 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 5, 2021

@TobiHartmann
The hotspot-gc label was successfully removed.

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Aug 5, 2021

Webrevs

Loading

assert((arrayOopDesc::base_offset_in_bytes(T_OBJECT) - offset) == BytesPerLong, "unexpected offset");
length = phase->transform_later(new SubXNode(length, phase->longcon(1))); // Size is in longs
Copy link
Contributor

@vnkozlov vnkozlov Aug 5, 2021

Choose a reason for hiding this comment

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

Do we have check that length is count of BytesPerLong?
Do we have a guard that this code is executed only in 64-bit VM?
SubXNode is SubINode in 32-bit VM.

Loading

Copy link
Contributor

@neliasso neliasso Aug 5, 2021

Choose a reason for hiding this comment

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

Z is 64 bit only.

Loading

Copy link
Contributor

@vnkozlov vnkozlov Aug 6, 2021

Choose a reason for hiding this comment

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

Okay. SubLNode should be used then to avoid confusion.
By expending code I see that it is guarded by (bt == T_OBJECT) so length is indeed in longs. No issue here.

Loading

Copy link
Member Author

@TobiHartmann TobiHartmann Aug 9, 2021

Choose a reason for hiding this comment

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

Thanks for the review, Vladimir. Yes, ZGC is 64-bit only and the code I'm fixing is applied to object arrays only. I've changed SubXNode to SubLNode to avoid confusion.

Loading

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Good.

Loading

@TobiHartmann
Copy link
Member Author

@TobiHartmann TobiHartmann commented Aug 10, 2021

Thanks for the review, Vladimir!

Loading

@TobiHartmann
Copy link
Member Author

@TobiHartmann TobiHartmann commented Aug 10, 2021

/integrate

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Aug 10, 2021

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

  • 3b899ef: 8272168: some hotspot runtime/logging tests don't check exit code
  • abdc107: 8270454: G1: Simplify region index comparison
  • eb6f3fe: 8272169: runtime/logging/LoaderConstraintsTest.java doesn't build test.Empty
  • 9654fd7: 8271892: mark hotspot runtime/PrintStringTableStats/PrintStringTableStatsTest.java test as ignoring external VM flags
  • 843943c: 8263567: gtests don't terminate the VM safely
  • 7fc99cf: 8225488: Examine ExecutableType.getReceiverType behavior when source receiver parameter is absent
  • 4548677: 8268824: Remove unused jdk.accessibility APIs deprecated for removal in JDK 9
  • b53828b: 8272047: java/nio/channels/FileChannel/Transfer2GPlus.java failed with Unexpected transfer size: 2147418112
  • 41dc795: 8264792: The NumberFormat for locale sq_XK formats price incorrectly.
  • 9c6457f: 8267385: Create NSAccessibilityElement implementation for JavaComponentAccessibility
  • ... and 31 more: https://git.openjdk.java.net/jdk/compare/4abe5311407c68d04fb0babb87fa279e35d5fabc...master

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Aug 10, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Aug 10, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 10, 2021

@TobiHartmann Pushed as commit d53d94b.

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants