Skip to content

8251216: Implement MD5 intrinsics on AArch64 #6628

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

Closed
wants to merge 1 commit into from
Closed

8251216: Implement MD5 intrinsics on AArch64 #6628

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 1, 2021

Implementation of MD5 intrinsic support for AArch64.

Contributed by Ludovic Henry (@luhenry).

Speedup measured (in Aurora running Ampere Altra) as follows:

openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:1048576-provider:...29.39%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:2047-provider:.........28.91%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:2048-provider:.........28.81%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:1023-provider:.........28.43%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:1024-provider:.........28.32%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:511-provider:...........27.78%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:512-provider:...........27.62%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:255-provider:...........26.52%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:256-provider:...........26.38%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:127-provider:...........25.41%
openjdk.bench.javax.crypto.full.MessageDigestBench.digest-algorithm:MD5-dataSize:128-provider:...........24.66%

Testing tier1-7.


Progress

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

Issue

Reviewers

Contributors

  • Ludovic Henry <luhenry@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6628

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 1, 2021

👋 Welcome back phedlin! 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 Dec 1, 2021

@phedlin Unknown command contribute - for a list of valid commands use /help.

@openjdk
Copy link

openjdk bot commented Dec 1, 2021

@phedlin 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 Dec 1, 2021
@openjdk
Copy link

openjdk bot commented Dec 1, 2021

@phedlin Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <duke@openjdk.org>

@ghost
Copy link
Author

ghost commented Dec 1, 2021

/contributor add @luhenry

@openjdk
Copy link

openjdk bot commented Dec 1, 2021

@phedlin
Contributor Ludovic Henry <luhenry@openjdk.org> successfully added.

@openjdk openjdk bot added the compiler compiler-dev@openjdk.org label Dec 1, 2021
@openjdk
Copy link

openjdk bot commented Dec 1, 2021

@phedlin
The compiler label was successfully added.

@ghost ghost marked this pull request as ready for review December 1, 2021 12:32
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 1, 2021
@mlbridge
Copy link

mlbridge bot commented Dec 1, 2021

Webrevs

@ghost
Copy link
Author

ghost commented Dec 1, 2021

/label add hotspot-compiler
/label remove compiler

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Dec 1, 2021
@openjdk
Copy link

openjdk bot commented Dec 1, 2021

@phedlin
The hotspot-compiler label was successfully added.

@openjdk openjdk bot removed the compiler compiler-dev@openjdk.org label Dec 1, 2021
@openjdk
Copy link

openjdk bot commented Dec 1, 2021

@phedlin
The compiler label was successfully removed.

Copy link
Contributor

@theRealAph theRealAph left a comment

Choose a reason for hiding this comment

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

MD5 has been proven insecure, and its weaknesses have been exploited in the field. It is disabled in many systems. I am surprised that we are thinking of accelerating it for possible future use, and that we're adding a worse-then-useless crypto algorithm to the AArch64 startup.

@ghost
Copy link
Author

ghost commented Dec 1, 2021

Fair point. But does that also rule out all uses, while still being supported. Not all hashes have to be exposed and on the upside, it's rather fast on any hardware (well, it's also one of its down sides). Who should make the choice to use it or not?

@luhenry
Copy link
Member

luhenry commented Dec 1, 2021

MD5 has been proven insecure, and its weaknesses have been exploited in the field. It is disabled in many systems. I am surprised that we are thinking of accelerating it for possible future use, and that we're adding a worse-then-useless crypto algorithm to the AArch64 startup.

I wholeheartedly agree with your take. Unfortunately, it's still used on many systems, like for verifying the integrity of downloads (Azure Blob Storage for example).

@cl4es
Copy link
Member

cl4es commented Dec 1, 2021

While I think it's good that distributions are free to omit MD5 now, there's still various non-cryptographic uses that warrant continued support and enhancements. Checksumming, JDK APIs such as UUID.nameUUIDFromBytes, etc.. Perhaps there should be a build flag to omit all of this, though?

For startup it remains a sore point that stubs like these are generated eagerly on bootstrap. I hope we'll be able to make this lazy in the near future (JDK-8231349) to make adding intrinsics come with fewer trade-offs. This particular stub is very simple and likely adds unnoticably to bootstrap, but in accumulation it's grown to be a bit of a concern in places, especially on x86 with large AVX-512 intrinsics. I'm not sure if there's been any progress on this recently, though. @vnkozlov?

(I'm not qualified to review Aarch64 code, but this contribution looks ok to me.)

@theRealAph
Copy link
Contributor

MD5 has been proven insecure, and its weaknesses have been exploited in the field. It is disabled in many systems. I am surprised that we are thinking of accelerating it for possible future use, and that we're adding a worse-then-useless crypto algorithm to the AArch64 startup.

I wholeheartedly agree with your take. Unfortunately, it's still used on many systems, like for verifying the integrity of downloads (Azure Blob Storage for example).

Ha! 😊
OK. This seems like a really weird time to be adding MD5 support, almost four years after MD5 was disabled for jarfile signing, and 15 years after the first practical break. But I guess it's harmless enough, even though I hate having to carry such baggage around.

@openjdk
Copy link

openjdk bot commented Dec 1, 2021

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

8251216: Implement MD5 intrinsics on AArch64

Co-authored-by: Ludovic Henry <luhenry@openjdk.org>
Reviewed-by: aph, neliasso

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

  • a093cdd: 8276657: XSLT compiler tries to define a class with empty name
  • 8198807: 8266435: WBMPImageReader.read() should not truncate the input stream
  • b226ab9: 8276141: XPathFactory set/getProperty method
  • 09522db: 8277647: [REDO] JDK-8277507 Add jlink.debug system property while launching jpackage tests to help diagonize recent intermittent failures
  • 67745fa: 8276299: G1: Unify the wording buffer/node/element in G1SegmentedArrayXxx, G1CardSetXxx and related classes
  • 51d6d7a: 8266839: Enable pandoc on macosx-aarch64 at Oracle
  • 0dfb3a7: 8268582: javadoc throws NPE with --ignore-source-errors option
  • f41e768: 8277762: Allow configuration of HOTSPOT_BUILD_USER
  • a363b7b: 8177819: DateTimeFormatterBuilder zone parsing should recognise DST
  • 9b3e672: 8278014: [vectorapi] Remove test run script
  • ... and 40 more: https://git.openjdk.java.net/jdk/compare/ad51d0692534744d04a32959e7e50ee5e87adff5...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 Dec 1, 2021
Copy link

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

@ghost
Copy link
Author

ghost commented Dec 2, 2021

Thank you for reviewing @aph and @neliasso.
Thank you for contributing the patch @luhenry.
Thank you for commenting on the issue @cl4es.

/integrate

@openjdk
Copy link

openjdk bot commented Dec 2, 2021

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

  • a093cdd: 8276657: XSLT compiler tries to define a class with empty name
  • 8198807: 8266435: WBMPImageReader.read() should not truncate the input stream
  • b226ab9: 8276141: XPathFactory set/getProperty method
  • 09522db: 8277647: [REDO] JDK-8277507 Add jlink.debug system property while launching jpackage tests to help diagonize recent intermittent failures
  • 67745fa: 8276299: G1: Unify the wording buffer/node/element in G1SegmentedArrayXxx, G1CardSetXxx and related classes
  • 51d6d7a: 8266839: Enable pandoc on macosx-aarch64 at Oracle
  • 0dfb3a7: 8268582: javadoc throws NPE with --ignore-source-errors option
  • f41e768: 8277762: Allow configuration of HOTSPOT_BUILD_USER
  • a363b7b: 8177819: DateTimeFormatterBuilder zone parsing should recognise DST
  • 9b3e672: 8278014: [vectorapi] Remove test run script
  • ... and 40 more: https://git.openjdk.java.net/jdk/compare/ad51d0692534744d04a32959e7e50ee5e87adff5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Dec 2, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 2, 2021
@openjdk
Copy link

openjdk bot commented Dec 2, 2021

@phedlin Pushed as commit 088b244.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants