RFR: 8343839: Detect patched modules and abort run-time image link early [v3]

Severin Gehwolf sgehwolf at openjdk.org
Wed Nov 27 20:08:42 UTC 2024


On Wed, 27 Nov 2024 20:01:01 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Please review this fix to how patched modules are being handled when linking from the run-time image. During review of [JDK-8311302](https://bugs.openjdk.org/browse/JDK-8311302) it was pointed out that module patching should be detected earlier and the link should get aborted in that case.
>> 
>> This patch implements it, by using `ModuleBootstrap.patcher().hasPatches()`. After this patch module patching is being detected before any archives are being read or the actual linking process starts (contrary to the previous solution).
>> 
>> Testing:
>> - [x] GHA testing (mac aarch64 test failures are infra related)
>> - [x] Local testing of existing test, which covers it
>> 
>> Thoughts?
>
> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 15 additional commits since the last revision:
> 
>  - Merge branch 'master' into jdk-8343839-detect-patch-module
>  - Use ModuleBootStrap for detecting patches
>  - Revert "8344560: Add system property for patched runtime"
>    
>    This reverts commit 1d2395f39ee95a80937c63713e1f874ecc4ae76e.
>  - Revert "Move and amend test"
>    
>    This reverts commit c27c874b4c722aa4cfa5f6c71f9231e92a30db0c.
>  - Revert "Set the property to false for unpatched, expand tests"
>    
>    This reverts commit c635fdc0ad09c68ef652afb516c221b3c3a6299f.
>  - Revert "Mention jdk.patched in System class"
>    
>    This reverts commit a11e26637d89d5ae840753eabcfe6deb2ac025be.
>  - Merge branch 'jdk-8344560-jdk.patched-property' into jdk-8343839-detect-patch-module
>  - Mention jdk.patched in System class
>  - Set the property to false for unpatched, expand tests
>  - Move and amend test
>  - ... and 5 more: https://git.openjdk.org/jdk/compare/545951ea...77695cea

The latest version now uses the approach @mlchung suggested in #22277 (and doesn't depend on a public property any more). Please take another look.

The long-term plan would be to not need this at all. If we were to use the `jrt` FS throughout in `JRTArchive` I think module patches won't matter and wouldn't populate to the resulting image and this could get removed. But that would be for another enhancement. Thoughts?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22037#issuecomment-2504689964


More information about the core-libs-dev mailing list