Skip to content

Conversation

@GoeLin
Copy link
Member

@GoeLin GoeLin commented Feb 10, 2025

I think this is a valuable fix we need in 21. It secures deserialized data.

The code needed some resolves, but overall the change of
head fits well on the code in 21. In detail:

I resolved
src/java.base/share/classes/com/sun/crypto/provider/DHPrivateKey.java and
src/java.base/share/classes/com/sun/crypto/provider/DHPublicKey.java.
It does not apply as these changes are missing in 21:
8311170: Simplify and modernize equals and hashCode in security area
8315974: Make fields final in 'com.sun.crypto.provider' package
Both files have similar differences between head and 21:
In both files I resolved one larger chunk. Some of the removed code is different:

  • Initialization of this.l removed in original. This initialization is not in 21.
  • head has some coding initializing this.x/y. This is handled by a call to
    parseKeyBits() in 21, which executes similar code.
    The new code is the same as in head.

In src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java, changes
8327818: Implement Kerberos debug with sun.security.util.Debug and again
8311170: Simplify and modernize equals and hashCode in security area
are missing in 21.
This only requires trivial resolves due to context differences.

I based this backport on the commit to head.
The commit to 22.0.2 is identical to that, except that it skips
two unnecessary empty lines in KRBError.java. I rather go
with the head version as this will make further backports
fit better.

This passed our nightly testing which includes the tests for the security implementations.
We run headless tier 1-4 on 8 platform with fastdebug, jck and further internal tests.


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
  • JDK-8302111 needs maintainer approval

Issue

  • JDK-8302111: Serialization considerations (Bug - P4 - Approved)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1391

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 10, 2025

👋 Welcome back goetz! 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 Feb 10, 2025

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

8302111: Serialization considerations

Reviewed-by: andrew

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

  • 4e19a9b: 8339834: Replace usages of -mx and -ms in some tests
  • 4f4c3ce: 8347038: [JMH] jdk.incubator.vector.SpiltReplicate fails NoClassDefFoundError
  • eb82472: 8346587: Distrust TLS server certificates anchored by Camerfirma Root CAs
  • 37ad4db: 8346713: [testsuite] NeverActAsServerClassMachine breaks TestPLABAdaptToMinTLABSize.java TestPinnedHumongousFragmentation.java TestPinnedObjectContents.java
  • 3e55649: 8345368: java/io/File/createTempFile/SpecialTempFile.java fails on Windows Server 2025
  • e122829: 8346671: java/nio/file/Files/probeContentType/Basic.java fails on Windows 2025

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 changed the title Backport 369c573383a0120e0d85aeb89a211f38b5261013 8302111: Serialization considerations Feb 10, 2025
@openjdk
Copy link

openjdk bot commented Feb 10, 2025

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

@openjdk openjdk bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Feb 10, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 10, 2025

Webrevs

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

Backport mostly looks good. The initialisation differences for l, x and y are also from JDK-8315974: "Make fields final in 'com.sun.crypto.provider' package". I presume, because the fields were now final, there could not be code paths that didn't initialise l and the initialisation of x and y could no longer be delegated to parseKeyBits.

On the subject of parseKeyBits, I think this method can now be removed, as it is in JDK-8315974. It is a private method that I don't see being called from anywhere else in those files.

@GoeLin
Copy link
Member Author

GoeLin commented Feb 11, 2025

Hi @gnu-andrew,
thanks for your review. Good point to remove the function, done.

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

Thanks Goetz. I think this is good to go in now.

@openjdk
Copy link

openjdk bot commented Feb 11, 2025

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

@openjdk openjdk bot added approval Requires approval; will be removed when approval is received ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Feb 12, 2025
@GoeLin
Copy link
Member Author

GoeLin commented Feb 13, 2025

/integrate

@openjdk
Copy link

openjdk bot commented Feb 13, 2025

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

  • 072651a: 8319233: AArch64: Build failure with clang due to -Wformat-nonliteral warning
  • 4e19a9b: 8339834: Replace usages of -mx and -ms in some tests
  • 4f4c3ce: 8347038: [JMH] jdk.incubator.vector.SpiltReplicate fails NoClassDefFoundError
  • eb82472: 8346587: Distrust TLS server certificates anchored by Camerfirma Root CAs
  • 37ad4db: 8346713: [testsuite] NeverActAsServerClassMachine breaks TestPLABAdaptToMinTLABSize.java TestPinnedHumongousFragmentation.java TestPinnedObjectContents.java
  • 3e55649: 8345368: java/io/File/createTempFile/SpecialTempFile.java fails on Windows Server 2025
  • e122829: 8346671: java/nio/file/Files/probeContentType/Basic.java fails on Windows 2025

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 13, 2025

@GoeLin Pushed as commit 17cb53a.

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

@GoeLin GoeLin deleted the goetz_backport_8302111 branch February 13, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants