-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8353185: Introduce the concept of upgradeable files in context of JEP 493 #24388
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
8353185: Introduce the concept of upgradeable files in context of JEP 493 #24388
Conversation
👋 Welcome back sgehwolf! A progress list of the required criteria for merging this PR into |
@jerboaa 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:
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 162 new commits pushed to the
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 |
Webrevs
|
What about changes to conf files, especially Java.security (for hardening TLS settings) - or at least pointing to a include? |
The opposite is where weaker or insecure algorithms are enabled, wouldn't want that copied by jlink into another run-time image. |
Well, shipping customized runtimes sounds like a valid usecase, but yes maybe it’s more important for jpackage. |
You can still do that after creating the custom runtime as you do today when linking using JMODs. The point of this fix is to be able to have a way to still run |
Part of me is concerned that the hidden option is a bit of an attractive nuisance. What would you think about just having a fixed list in a properties file in the repo, thus a resource in the jlink module. This would avoid the list in JRTArchive too. It wouldn't rule out introducing something more in the future. Right now the only examples we have are in java.base. In time it might be that some other modules might need something. I've like to know more about cacerts. Are the distros swapping this to a link after the run-time image is created or is it that the sym link is there from the startup and the hashing has followed the link? |
I'm not entirely sure what you are suggesting. Is it keeping a list of "upgradeable" files in a properties file. Files listed in that properties file aren't checked for hash sums (i.e. even if it's not modified)? That is, the explicit opt-in is not needed? Fine by me, but it's a weaker check. If we don't need the explicit opt-in, the patch becomes simpler as well.
Sure. I've considered that. The
Yes, that's one case. For example Fedora/RHEL distros have a Another use case is amending the cacerts store. For example with an enterprise internal CA, in a container. It's really not different to The option of not following symlinks, isn't an option, though, as certain distro packaging standards require one to install, say man pages - in a specific directory. To keep the JDK image whole, that is usually fixed by placing a symlink back in the JDK image directory. |
Yes, I think keep simple. We always want to allow tzdb.dat be upgraded by the TZ updater tool. I think treating cacerts the same way is okay. As you note, it has to be kept up to date too. I was thinking keytool import and wasn't sure if the Linux distros configure with Starting with a simple list of two files won't preclude us from re-visiting it again in the future. |
OK. Thanks. I'll update it then. |
…t of JEP 493" This reverts commit bfbfbcb.
@AlanBateman Updated the patch. Please take another look. Thanks! |
/label add build-dev |
@jerboaa |
It took me a while to find the magic trick to get the jlink resource file copied, so adding build-dev for their input too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few fly-by findings, no full review.
I see that you're actively on the upgradeable files. What about #24190? (@AlanBateman, what are your thoughts, how could we progress there?)
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JRTArchive.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JRTArchive.java
Outdated
Show resolved
Hide resolved
test/jdk/tools/jlink/runtimeImage/UpgradeableFileCacertsTest.java
Outdated
Show resolved
Hide resolved
test/jdk/tools/jlink/runtimeImage/UpgradeableFileCacertsTest.java
Outdated
Show resolved
Hide resolved
@@ -62,7 +68,38 @@ public static boolean isLinkableRuntime() { | |||
|
|||
private static InputStream getDiffInputStream(String module) throws IOException { | |||
String resourceName = String.format(DIFF_PATTERN, module); | |||
return LinkableRuntimeImage.class.getModule().getResourceAsStream(resourceName); | |||
return JDK_JLINK_MOD.getResourceAsStream(resourceName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI you can use LinkableRuntimeImage.class.getResourceAsStream here as the resource is in the current module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very odd, but when I attempt this then the resource is not found. It seems to fail on the module name verification. For example: jlink --help | tail -n2
shows as disabled
for an enabled linkable runtime image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without reproducing, I can't immediately say why Class.getResourceAsStream would fail here. This is a good API for locating resources in the caller's module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to find a reproducer outside this PR and will let you know if I find anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build changes look good now. Thanks!
/reviewers 2
@AlanBateman Any more thoughts on this? Thanks! |
@RealCLanger Are you OK with the latest patch (as far as your comments are concerned)? |
Yes, looks good. 😄 |
/integrate |
Going to push as commit 4e24dc0.
Your commit was automatically rebased without conflicts. |
For JEP 493-enabled builds there are no JMODs. Certain files come from the installed JDK image when a user creates a custom run-time from it. This is problematic for example for files that often come from a different package (e.g.
cacerts
file for Linux distro builds of OpenJDK packaged as RPMs), or more generally when they get updated out-of-band of the JDK build itself like the tzupdater tool.When that happens the hash sum recorded at JDK build time of those files no longer match, causing
jlink
to fail. I propose to allow for those files to get "upgraded" should this happen. The way this works is as follows:jdk.jlink
on a per module basis. Right now, only two files from thejava.base
module will be allowed to be upgraded with a link from the current run-time image.Testing
jdk/tools/jlink
jtreg tests (also on GHA)tzdb.dat
andcacerts
files.Thoughts?
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24388/head:pull/24388
$ git checkout pull/24388
Update a local copy of the PR:
$ git checkout pull/24388
$ git pull https://git.openjdk.org/jdk.git pull/24388/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24388
View PR using the GUI difftool:
$ git pr show -t 24388
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24388.diff
Using Webrev
Link to Webrev Comment