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

8293197: Avoid double racy reads from non-volatile fields in SharedSecrets #10076

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Aug 30, 2022

After integration of JDK-8259021 a few more fields were added to SharedSecrets class. It make sense to update their reading code to use the same idiom.


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-8293197: Avoid double racy reads from non-volatile fields in SharedSecrets

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10076

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2022

👋 Welcome back aturbanov! 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 Aug 30, 2022

@turbanoff The following labels will be automatically applied to this pull request:

  • core-libs
  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added security security-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Aug 30, 2022
@turbanoff turbanoff changed the title [PATCH] SharedSecrets should avoid double racy reads from non-volatile fields 8293197: Avoid double racy reads from non-volatile fields in SharedSecrets Sep 1, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 1, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 1, 2022

Webrevs

@mlbridge
Copy link

mlbridge bot commented Sep 1, 2022

Mailing list message from Bernd Eckenfels on core-libs-dev:

BTW, after then ensures it looks like a good candidate for a system-assert for not-null for all of those fields, right?

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: core-libs-dev <core-libs-dev-retn at openjdk.org> im Auftrag von Andrey Turbanov <aturbanov at openjdk.org>
Gesendet: Thursday, September 1, 2022 8:24:58 AM
An: core-libs-dev at openjdk.org <core-libs-dev at openjdk.org>; security-dev at openjdk.org <security-dev at openjdk.org>
Betreff: RFR: 8293197: Avoid double racy reads from non-volatile fields in SharedSecrets

After integration of [JDK-8259021](https://bugs.openjdk.org/browse/JDK-8259021) a few more fields were added to `SharedSecrets` class. It make sense to update their reading code to use the same idiom.

-------------

Commit messages:
- [PATCH] SharedSecrets should avoid double racy reads from non-volatile fields
- [PATCH] SharedSecrets should avoid double racy reads from non-volatile fields

Changes: https://git.openjdk.org/jdk/pull/10076/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10076&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8293197
Stats: 16 lines in 1 file changed: 8 ins; 0 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/10076.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10076/head:pull/10076

PR: https://git.openjdk.org/jdk/pull/10076
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20220901/5f8d016f/attachment-0001.htm>

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

Surprising that the additions since JDK-8259021 didn't follow the same pattern but I think some of these were in other repos at the time.

@openjdk
Copy link

openjdk bot commented Sep 3, 2022

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

8293197: Avoid double racy reads from non-volatile fields in SharedSecrets

Reviewed-by: alanb

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

  • a366e82: 7113208: Incorrect javadoc on java.net.DatagramPacket.setLength()
  • ac05bc8: 8293293: Move archive heap loading code out of heapShared.cpp
  • e1e6732: 8293319: [C2 cleanup] Remove unused other_path arg in Parse::adjust_map_after_if
  • 5757e21: 8292385: assert(ctrl == kit.control()) failed: Control flow was added although the intrinsic bailed out
  • 3993a1f: 8292067: Convert test/sun/management/jmxremote/bootstrap shell tests to java version
  • 83a3408: 8293315: Add back logging for Placeholders
  • b6477fd: 8293288: bootcycle build failure after JDK-8173605
  • 0c6094e: 8293188: x86_64: Introduce stubGenerator_x86_64.hpp
  • 2baeebb: 8293006: sun/tools/jhsdb/JStackStressTest.java fails with "UnalignedAddressException: 8baadbabe"
  • da99e3e: 8289400: Improve com/sun/jdi/TestScaffold error reporting
  • ... and 64 more: https://git.openjdk.org/jdk/compare/bc6ac6f7af7a41a7f045c9f2e443e6d204197051...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 3, 2022
@turbanoff
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 7, 2022

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

  • 205f992: 8293326: jdk/sun/security/tools/jarsigner/compatibility/SignTwice.java slow on Windows
  • 710a143: 8293445: clhsdb "thread" command gives incorrect error message for bad threadID
  • 57930f8: 8293285: x86_64: Move libm stub implementations to StubGenerator
  • 5b4c415: 8293254: x86_64: Extract arraycopy stub implementations into a separate file
  • fb6eb6f: 8293245: x86_64: Extract Adler32 stub implementation into stubGenerator_x86_64_adler.cpp
  • da59618: 8264744: (fs) Use file cloning in Linux version of Files::copy method
  • 85d4b49: 8283929: GHA: Add RISC-V build config
  • 98d85e6: 8292579: (tz) Update Timezone Data to 2022c
  • 7c96608: 8293403: JfrResolution::on_jvmci_resolution crashes when caller is null
  • c05015b: 8291736: find_method_handle_intrinsic leaks Method*
  • ... and 102 more: https://git.openjdk.org/jdk/compare/bc6ac6f7af7a41a7f045c9f2e443e6d204197051...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 7, 2022

@turbanoff Pushed as commit 2259e42.

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

@turbanoff turbanoff deleted the SharedSecrets_avoid_double_racy_reads branch October 27, 2022 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants