From ae996c44acfec7eff19b0ded975448cdb60a9a7b Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Fri, 17 Apr 2020 02:52:39 -0400 Subject: [PATCH] Add JDK-8228407 backport to resolve crashes during verification. --- java-11-openjdk.spec | 10 ++++- jdk8228407-shared_archive_crash.patch | 54 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 jdk8228407-shared_archive_crash.patch diff --git a/java-11-openjdk.spec b/java-11-openjdk.spec index 01827c6..06ce94d 100644 --- a/java-11-openjdk.spec +++ b/java-11-openjdk.spec @@ -1073,6 +1073,8 @@ Patch8: s390-8214206_fix.patch # able to be removed once that release is out # and used by this RPM. ############################################# +# JDK-8237879: make 4.3 breaks build +Patch9: jdk8237879-make_4_3_build_fixes.patch # JDK-8241296: Segfault in JNIHandleBlock::oops_do() Patch10: jdk8241296-jnihandleblock_segfault.patch @@ -1085,10 +1087,10 @@ Patch10: jdk8241296-jnihandleblock_segfault.patch # able to be removed once that release is out # and used by this RPM. ############################################# -# JDK-8237879: make 4.3 breaks build -Patch9: jdk8237879-make_4_3_build_fixes.patch # JDK-8237396: JvmtiTagMap::weak_oops_do() should not trigger barriers Patch11: jdk8237396-avoid_triggering_barriers.patch +# JDK-8228407: JVM crashes with shared archive file mismatch +Patch12: jdk8228407-shared_archive_crash.patch ############################################# # @@ -1327,6 +1329,7 @@ pushd %{top_level_dir_name} %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 popd # openjdk %patch1000 @@ -1872,6 +1875,9 @@ require "copy_jdk_configs.lua" %changelog +* Thu Apr 16 2020 Andrew John Hughes - 1:11.0.7.3-0.0.ea +- Add JDK-8228407 backport to resolve crashes during verification. + * Thu Apr 16 2020 Andrew John Hughes - 1:11.0.7.3-0.0.ea - Update to shenandoah-jdk-11.0.7+3 (EA) diff --git a/jdk8228407-shared_archive_crash.patch b/jdk8228407-shared_archive_crash.patch new file mode 100644 index 0000000..f3c8086 --- /dev/null +++ b/jdk8228407-shared_archive_crash.patch @@ -0,0 +1,54 @@ +# HG changeset patch +# User ccheung +# Date 1564075552 25200 +# Thu Jul 25 10:25:52 2019 -0700 +# Node ID 1edf6cc224fbf975eadf2a1810f67816a8607d30 +# Parent 73dbc713d4ddbdbeae71375db1603d85cef47f99 +8228407: JVM crashes with shared archive file mismatch +Summary: Stop processing other header fields if initial header check has failed. +Reviewed-by: dholmes, jiangli + +diff --git a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp +--- a/src/hotspot/share/memory/filemap.cpp ++++ b/src/hotspot/share/memory/filemap.cpp +@@ -1287,7 +1287,9 @@ + } + + init_from_file(_fd); +- if (!validate_header()) { ++ // UseSharedSpaces could be disabled if the checking of some of the header fields in ++ // init_from_file has failed. ++ if (!UseSharedSpaces || !validate_header()) { + return false; + } + return true; +diff --git a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java +--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java ++++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java +@@ -385,8 +385,16 @@ + output.shouldNotContain("Checksum verification failed"); + + copyFile(orgJsaFile, jsa); ++ // modify _jvm_ident and run with -Xshare:auto ++ System.out.println("\n2b. Corrupt _jvm_ident run with -Xshare:auto\n"); ++ modifyJvmIdent(); ++ output = TestCommon.execAuto(execArgs); ++ output.shouldContain("The shared archive file was created by a different version or build of HotSpot"); ++ output.shouldContain("Hello World"); ++ ++ copyFile(orgJsaFile, jsa); + // modify _magic and _paths_misc_info_size, test should fail +- System.out.println("\n2b. Corrupt _magic and _paths_misc_info_size, should fail\n"); ++ System.out.println("\n2c. Corrupt _magic and _paths_misc_info_size, should fail\n"); + modifyHeaderIntField(offset_magic, 0x00000000); + modifyHeaderIntField(offset_paths_misc_info_size, Integer.MAX_VALUE); + output = TestCommon.execCommon(execArgs); +@@ -395,7 +403,7 @@ + + copyFile(orgJsaFile, jsa); + // modify _version and _paths_misc_info_size, test should fail +- System.out.println("\n2c. Corrupt _version and _paths_misc_info_size, should fail\n"); ++ System.out.println("\n2d. Corrupt _version and _paths_misc_info_size, should fail\n"); + modifyHeaderIntField(offset_version, 0x00000000); + modifyHeaderIntField(offset_paths_misc_info_size, Integer.MAX_VALUE); + output = TestCommon.execCommon(execArgs);