Skip to content

8312434: SPECjvm2008/xml.transform with CDS fails with "can't seal package nu.xom"#15339

Closed
calvinccheung wants to merge 3 commits intoopenjdk:masterfrom
calvinccheung:8312434-sealing-violation
Closed

8312434: SPECjvm2008/xml.transform with CDS fails with "can't seal package nu.xom"#15339
calvinccheung wants to merge 3 commits intoopenjdk:masterfrom
calvinccheung:8312434-sealing-violation

Conversation

@calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Aug 18, 2023

Problem:
A jar file containing classes in a sealed package and is signed with a "disabled" algorithm as indicated in the jdk.jar.disabledAlgorithms security property. Some of the classes are stored in a CDS archive. During runtime, if a class is loaded from the archive followed by loading a class from the jar file, resulting in sealing violation.

Cause:
During dump time, CDS considers the jar file as signed although it should be treated as unsigned due to the algorithm used is in the "disabled" list. Currently, CDS doesn't store the manifest of a signed jar in the archive since CDS doesn't support signed classes. During runtime, since there's no manifest info, when a class is loaded from the archive, a package entry is created without sealing information. When a subsequent class from the same package is loaded from the jar, an attempt to create a package entry with sealing information would fail.

Fix:
It is difficult in the hotspot code to determine if an algorithm for signing the jar is considered "disabled". The fix is to always store the jar manifest in the CDS archive.

Testing:
Passed tiers 1 - 4 (including the new test).


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-8312434: SPECjvm2008/xml.transform with CDS fails with "can't seal package nu.xom" (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15339

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

Using diff file

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

Webrev

Link to Webrev Comment

@calvinccheung
Copy link
Member Author

/label add hotspot-runtime

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 18, 2023

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

@calvinccheung calvinccheung marked this pull request as ready for review August 18, 2023 04:59
@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Aug 18, 2023
@openjdk
Copy link

openjdk bot commented Aug 18, 2023

@calvinccheung
The hotspot-runtime label was successfully added.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 18, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 18, 2023

Webrevs

Copy link
Member

@iklam iklam 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 to me with a small nit for the test case.

Also, can we remove the SharedClassPathEntry::is_signed() API as well?

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest using full spelling of signJarWithDisabledAlgorithm

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Also removed an extra import from the test.

@calvinccheung
Copy link
Member Author

Looks good to me with a small nit for the test case.

Also, can we remove the SharedClassPathEntry::is_signed() API as well?

Yes, I will also remove the signed_jar_entry enum.

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

LGTM

@openjdk
Copy link

openjdk bot commented Aug 21, 2023

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

8312434: SPECjvm2008/xml.transform with CDS fails with "can't seal package nu.xom"

Reviewed-by: iklam, matsaave

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 124 new commits pushed to 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 added the ready Pull request is ready to be integrated label Aug 21, 2023
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

LGTM!

@calvinccheung
Copy link
Member Author

Thanks @iklam and @matias9927.

/integrate

@openjdk
Copy link

openjdk bot commented Aug 22, 2023

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 22, 2023

@calvinccheung Pushed as commit 9f4a9fe.

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

@calvinccheung calvinccheung deleted the 8312434-sealing-violation branch August 23, 2023 04:09
@calvinccheung
Copy link
Member Author

/backport jdk21u

@openjdk
Copy link

openjdk bot commented Nov 3, 2023

@calvinccheung the backport was successfully created on the branch calvinccheung-backport-9f4a9fe4 in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9f4a9fe4 from the openjdk/jdk repository.

The commit being backported was authored by Calvin Cheung on 22 Aug 2023 and was reviewed by Ioi Lam and Matias Saavedra Silva.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u:

$ git fetch https://github.com/openjdk-bots/jdk21u.git calvinccheung-backport-9f4a9fe4:calvinccheung-backport-9f4a9fe4
$ git checkout calvinccheung-backport-9f4a9fe4
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u.git calvinccheung-backport-9f4a9fe4

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

Labels

hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants

Comments