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

8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards #2682

Closed
wants to merge 2 commits into from

Conversation

ziyiluo
Copy link
Member

@ziyiluo ziyiluo commented Feb 23, 2021

All of the "isAssignableFrom" checks in "engineGetKeySpec" appear to be backwards in Java's KeyFactorySpi.engineGetKeySpec implementations. In most cases, the requested KeySpec is equal to the concrete implementation so the inversion does not matter. But there are few cases, as presented in the added jtreg test, will cause unexpected behavior (e.g., ClassCastException rather than an InvalidKeySpecException). The fix is trivial.

Co-author @SalusaSecondus


Progress

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

Issue

  • JDK-8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2682/head:pull/2682
$ git checkout pull/2682

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 23, 2021

👋 Welcome back luoziyi! 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 openjdk bot added the rfr Pull request is ready for review label Feb 23, 2021
@openjdk
Copy link

openjdk bot commented Feb 23, 2021

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

  • security

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 security security-dev@openjdk.org label Feb 23, 2021
@mlbridge
Copy link

mlbridge bot commented Feb 23, 2021

Webrevs

@ziyiluo
Copy link
Member Author

ziyiluo commented Feb 23, 2021

/contributor add @SalusaSecondus

@openjdk
Copy link

openjdk bot commented Feb 23, 2021

@ziyiluo Could not parse @SalusaSecondus as a valid contributor.
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>

@jnimeh
Copy link
Member

jnimeh commented Feb 24, 2021

The fix itself makes sense and looks good to me. However I think it will cause two other tests to break. Please try running the following two tests with your changes and see if they fail for you as they did for me:
open/test/jdk/sun/security/rsa/TestKeyFactory.java
open/test/jdk/sun/security/rsa/pss/TestPSSKeySupport.java

Also just a minor nit: some of the modified files should have their copyright dates updated to 2021.

@ziyiluo
Copy link
Member Author

ziyiluo commented Mar 2, 2021

Hi Jamil,

Thanks for reviewing this PR.

The fix itself makes sense and looks good to me. However I think it will cause two other tests to break. Please try running the following two tests with your changes and see if they fail for you as they did for me:
open/test/jdk/sun/security/rsa/TestKeyFactory.java
open/test/jdk/sun/security/rsa/pss/TestPSSKeySupport.java

Nice catch. I updated both tests in rev-2.

Also just a minor nit: some of the modified files should have their copyright dates updated to 2021.

Done

Copy link
Member

@jnimeh jnimeh left a comment

Choose a reason for hiding this comment

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

Thanks for fixing those two tests and the nits. Looks good.

@openjdk
Copy link

openjdk bot commented Mar 2, 2021

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

8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

Reviewed-by: jnimeh

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

  • 84c93d5: 8257137: Revise smov and umov in aarch64 assembler
  • d93fa0d: 8253940: com/sun/jdi/JdwpAttachTest.java failed with "RuntimeException: ERROR: LingeredApp.startApp was able to attach"
  • 104a262: 8224775: test/jdk/com/sun/jdi/JdwpListenTest.java failed to attach
  • 2848938: 8262927: Explicitly state fields examined for BigDecimal.hashCode
  • b397472: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe
  • 268d9b7: 8261447: MethodInvocationCounters frequently run into overflow
  • 75aa154: 8259267: Refactor LoaderLeak shell test as java test.
  • a118185: 8261862: Expand discussion of rationale for BigDecimal equals/compareTo semantics
  • 2d2ef08: 8262885: Shenandoah: FullGC prologue does not need to save/restore heap has_forwarded_object flag
  • 1d2c1e6: 8248314: Parallel: Parallelize parallel full gc Adjust Roots phase
  • ... and 109 more: https://git.openjdk.java.net/jdk/compare/991f7c1303998b090cdc25f87b253afaf7302ec6...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jnimeh) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 2, 2021
@ziyiluo
Copy link
Member Author

ziyiluo commented Mar 3, 2021

Hi @jnimeh thanks for your review! Are you willing to sponsor this PR? Besides, would you recommend a second reviewer for this?

@jnimeh
Copy link
Member

jnimeh commented Mar 3, 2021

Hello @ziyiluo I'm happy to be the sponsor for this. This will be my first time doing a sponsor of a PR but it looks pretty straightforward. Per the instructions above you have to issue the integrate command first and then I'll send the sponsor command afterward. I don't believe you need another reviewer, my review should be sufficient.

@ziyiluo
Copy link
Member Author

ziyiluo commented Mar 4, 2021

@jnimeh Thank you very much. I'll integrate the PR in a second.

@ziyiluo
Copy link
Member Author

ziyiluo commented Mar 4, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 4, 2021
@openjdk
Copy link

openjdk bot commented Mar 4, 2021

@ziyiluo
Your change (at version d197230) is now ready to be sponsored by a Committer.

@jnimeh
Copy link
Member

jnimeh commented Mar 4, 2021

/sponsor

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

openjdk bot commented Mar 4, 2021

@jnimeh @ziyiluo Since your change was applied there have been 125 commits pushed to the master branch:

  • d2c4ed0: 8262000: jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java failed with "OutOfMemoryError: Java heap space"
  • 94f26e4: 8261450: JShell crashes with SIOOBE in tab completion
  • b817855: 8262935: Add missing logging to sun.net.httpserver.ServerImpl
  • 2251319: 8262828: Format of OS information is different on macOS
  • 4cfecce: 8261730: C2 compilation fails with assert(store->find_edge(load) != -1) failed: missing precedence edge
  • 7915a1f: 8262950: Restructure compiler/intrinsics/TestRotate.java for easier compilation
  • 84c93d5: 8257137: Revise smov and umov in aarch64 assembler
  • d93fa0d: 8253940: com/sun/jdi/JdwpAttachTest.java failed with "RuntimeException: ERROR: LingeredApp.startApp was able to attach"
  • 104a262: 8224775: test/jdk/com/sun/jdi/JdwpListenTest.java failed to attach
  • 2848938: 8262927: Explicitly state fields examined for BigDecimal.hashCode
  • ... and 115 more: https://git.openjdk.java.net/jdk/compare/991f7c1303998b090cdc25f87b253afaf7302ec6...master

Your commit was automatically rebased without conflicts.

Pushed as commit a777e82.

💡 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
integrated Pull request has been integrated security security-dev@openjdk.org
2 participants