[jdk11u-dev] RFR: 8288763: Pack200 extraction failure with invalid size

Tyler Steele tsteele at openjdk.org
Tue Jul 12 21:27:50 UTC 2022


On Wed, 29 Jun 2022 18:33:13 GMT, Volker Simonis <simonis at openjdk.org> wrote:

>> While running some internal testing, a college has discovered a failure related to the Pack200 archive format on the zLinux platform. The problematic code was removed in the current repo by [JDK-8234596](https://bugs.openjdk.org/browse/JDK-8234596), however that change was large, and required a CSR. I feel that it would be too risky and cumbersome to backport those changes to jdk11 (and ultimately jdk8 as well), so I'd like to propose this change as a new change to jdk11 rather than via the usual backport process.
>> 
>> ### Testing
>> These changes have been run against the failing test on zLinux and the Tier 1 tests completed successfully.
>
> This is all a little bit confusing. First of all I don't think that this issue is s390 related. I think it should be independent of the platform and only depend on the source zip file and the zlib version used by the JDK. Unless we can't proof that this is indeed s390 related, please remove the "[s390]" tag from the summary to avoid further confusion.
> 
> From the [JBS issue you've opened](https://bugs.openjdk.org/browse/JDK-8288763) I see that you're running JCK tests when you encountered this issue. You can find the source zip files of these tests under `tests/api/java_util/jar/Pack200/distributed/samples`. Can you please report the following:
> 
> - is the `libzip.so` of your JDK statically or dynamically linked against zlib (i.e. `ldd <path-to-jdk>/lib/libzip.so | grep libz`)
> - the version of the system zlib (i.e. `/lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.11`)
> 
> Then, do the following:
> - use `zipinfo -l <path-to-samples>/sample0X.jar` to verify the compressed size of the entries in the sample jar files
> - use `unzip <path-to-samples>/sample0X.jar` to extract their contents and `jar cfm new_sample.jar META-INF/MANIFEST.MF *` to regenerate them with your JDK under test
> - use `zipinfo -l new_sample.jar` again to verify the compressed sizes of the entries in the newly generated jar file
> 
> In the last step, if you find an entry with a compressed size which is different from the compressed size of that same entry in the original file then the root cause of your problem is indeed [JDK-8253952](https://bugs.openjdk.org/browse/JDK-8253952) as @RealCLanger suspected. I that case your fix is also correct and I'll be happy to approve it.
> 
> I agree with @RealCLanger that this issue is probably another variant of [JDK-8253952](https://bugs.openjdk.org/browse/JDK-8253952) (and that JBS issue has several links to other variants with the same root cause). I just want to make sure that we're really seeing the same issue here and don't have another hidden bug on s390.

It took me a bit longer than anticipated to get to this. Below is the output you requested @simonis.

> - is the libzip.so of your JDK statically or dynamically linked against zlib (i.e. ldd <path-to-jdk>/lib/libzip.so | grep libz)

Looks like it is dynamically linked:

root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted# ldd ../temurin/lib/libzip.so
...
	libz.so.1 => /lib/s390x-linux-gnu/libz.so.1 (0x000003ffaa900000)


> - the version of the system zlib (i.e. /lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.11)

You had the version right on.


 ls -al /lib/s390x-linux-gnu/libz.so.1
lrwxrwxrwx 1 root root 14 Mar 26 18:20 /lib/s390x-linux-gnu/libz.so.1 -> libz.so.1.2.11


Following the remaining steps shows a different compressed size.


root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted# zipinfo -l sample04.jar
Archive:  sample04.jar
Zip file size: 11392 bytes, number of entries: 7
-rw----     2.0 fat        0 bX        2 defN 04-Jan-30 13:34 META-INF/
-rw----     2.0 fat       68 bl       68 defN 04-Jan-30 13:34 META-INF/MANIFEST.MF
-rw----     2.0 fat      943 bl      502 defN 04-Jan-30 13:06 com/sun/java/help/impl/CustomKit$CustomDocument.class
-rw----     2.0 fat     3574 bl     1882 defN 04-Jan-30 13:06 com/sun/java/help/impl/CustomKit$ObjectView1.class
-rw----     2.0 fat      191 bl      154 defN 04-Jan-30 13:06 com/sun/java/help/impl/ViewAwareComponent.class
-rw----     2.0 fat     1009 bl      497 defN 04-Jan-30 13:06 com/sun/java/help/impl/JHSecondaryViewer$1.class
-rw----     2.0 fat    14175 bl     7067 defN 04-Jan-30 13:06 com/sun/java/help/impl/JHSecondaryViewer.class
7 files, 19960 bytes uncompressed, 10172 bytes compressed:  49.0%
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted# mkdir scratch
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted# cd scratch/
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted/scratch# cp ../sample04.jar .
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted/scratch# unzip sample04.jar
Archive:  sample04.jar
   creating: META-INF/
  inflating: META-INF/MANIFEST.MF
  inflating: com/sun/java/help/impl/CustomKit$CustomDocument.class
  inflating: com/sun/java/help/impl/CustomKit$ObjectView1.class
  inflating: com/sun/java/help/impl/ViewAwareComponent.class
  inflating: com/sun/java/help/impl/JHSecondaryViewer$1.class
  inflating: com/sun/java/help/impl/JHSecondaryViewer.class
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted/scratch# #../../temurin/bin/jar cfm new_sample.jar META-INF/MANIFEST.MF *
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted/scratch# rm sample04.jar
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted/scratch# ../../temurin/bin/jar cfm new_sample.jar META-INF/MANIFEST.MF *
root at 15d4a6cf6145:~/workspace/UnpackDistributedFailureExtracted/scratch# zipinfo -l new_sample.jar
Archive:  new_sample.jar
Zip file size: 13114 bytes, number of entries: 12
-rw----     2.0 fat        0 bX        2 defN 22-Jul-07 13:58 META-INF/
-rw----     2.0 fat       68 bl       71 defN 22-Jul-07 13:58 META-INF/MANIFEST.MF
-rw----     1.0 fat        0 b-        0 stor 22-Jul-07 13:57 com/
-rw----     1.0 fat        0 b-        0 stor 22-Jul-07 13:57 com/sun/
-rw----     1.0 fat        0 b-        0 stor 22-Jul-07 13:57 com/sun/java/
-rw----     1.0 fat        0 b-        0 stor 22-Jul-07 13:57 com/sun/java/help/
-rw----     1.0 fat        0 b-        0 stor 22-Jul-07 13:57 com/sun/java/help/impl/
-rw----     2.0 fat      191 bl      161 defN 04-Jan-30 13:06 com/sun/java/help/impl/ViewAwareComponent.class
-rw----     2.0 fat    14175 bl     7841 defN 04-Jan-30 13:06 com/sun/java/help/impl/JHSecondaryViewer.class
-rw----     2.0 fat     3574 bl     2219 defN 04-Jan-30 13:06 com/sun/java/help/impl/CustomKit$ObjectView1.class
-rw----     2.0 fat      943 bl      548 defN 04-Jan-30 13:06 com/sun/java/help/impl/CustomKit$CustomDocument.class
-rw----     2.0 fat     1009 bl      540 defN 04-Jan-30 13:06 com/sun/java/help/impl/JHSecondaryViewer$1.class
12 files, 19960 bytes uncompressed, 11382 bytes compressed:  43.0%

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

PR: https://git.openjdk.org/jdk11u-dev/pull/1163


More information about the jdk-updates-dev mailing list