sync master to openEuler-22.03-LTS-SP3

This commit is contained in:
佛系少年中二 2024-11-11 15:16:22 +08:00
parent 12ea96d2d0
commit c431680b40
18 changed files with 4791 additions and 681 deletions

View File

@ -38,13 +38,6 @@ diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java b/j
index 9d36d1e9e..571387e0c 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -138,6 +138,12 @@ class KeyImpl implements SecretKey, Destroyable, Serializable {
case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96:
return "aes256-cts-hmac-sha1-96";

View File

@ -8,192 +8,6 @@ Subject: 8193682: Infinite loop in ZipOutputStream.close()
4 files changed, 226 insertions(+), 64 deletions(-)
create mode 100644 jdk/test/java/util/zip/CloseDeflaterTest.java
diff --git a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
index a1f768cae..f4cf79693 100644
--- a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
@@ -235,9 +235,12 @@ class DeflaterOutputStream extends FilterOutputStream {
*/
public void close() throws IOException {
if (!closed) {
- finish();
- if (usesDefaultDeflater)
- def.end();
+ try {
+ finish();
+ } finally {
+ if (usesDefaultDeflater)
+ def.end();
+ }
out.close();
closed = true;
}
diff --git a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
index 2c1cd409b..1c3f8592e 100644
--- a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
@@ -154,24 +154,30 @@ class GZIPOutputStream extends DeflaterOutputStream {
*/
public void finish() throws IOException {
if (!def.finished()) {
- def.finish();
- while (!def.finished()) {
- int len = def.deflate(buf, 0, buf.length);
- if (def.finished() && len <= buf.length - TRAILER_SIZE) {
- // last deflater buffer. Fit trailer at the end
- writeTrailer(buf, len);
- len = len + TRAILER_SIZE;
- out.write(buf, 0, len);
- return;
+ try {
+ def.finish();
+ while (!def.finished()) {
+ int len = def.deflate(buf, 0, buf.length);
+ if (def.finished() && len <= buf.length - TRAILER_SIZE) {
+ // last deflater buffer. Fit trailer at the end
+ writeTrailer(buf, len);
+ len = len + TRAILER_SIZE;
+ out.write(buf, 0, len);
+ return;
+ }
+ if (len > 0)
+ out.write(buf, 0, len);
}
- if (len > 0)
- out.write(buf, 0, len);
+ // if we can't fit the trailer at the end of the last
+ // deflater buffer, we write it separately
+ byte[] trailer = new byte[TRAILER_SIZE];
+ writeTrailer(trailer, 0);
+ out.write(trailer);
+ } catch (IOException e) {
+ if (usesDefaultDeflater)
+ def.end();
+ throw e;
}
- // if we can't fit the trailer at the end of the last
- // deflater buffer, we write it separately
- byte[] trailer = new byte[TRAILER_SIZE];
- writeTrailer(trailer, 0);
- out.write(trailer);
}
}
diff --git a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
index 6b480aa1d..f001ddf00 100644
--- a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
@@ -247,59 +247,65 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
public void closeEntry() throws IOException {
ensureOpen();
if (current != null) {
- ZipEntry e = current.entry;
- switch (e.method) {
- case DEFLATED:
- def.finish();
- while (!def.finished()) {
- deflate();
- }
- if ((e.flag & 8) == 0) {
- // verify size, compressed size, and crc-32 settings
- if (e.size != def.getBytesRead()) {
- throw new ZipException(
- "invalid entry size (expected " + e.size +
- " but got " + def.getBytesRead() + " bytes)");
+ try {
+ ZipEntry e = current.entry;
+ switch (e.method) {
+ case DEFLATED:
+ def.finish();
+ while (!def.finished()) {
+ deflate();
}
- if (e.csize != def.getBytesWritten()) {
+ if ((e.flag & 8) == 0) {
+ // verify size, compressed size, and crc-32 settings
+ if (e.size != def.getBytesRead()) {
+ throw new ZipException(
+ "invalid entry size (expected " + e.size +
+ " but got " + def.getBytesRead() + " bytes)");
+ }
+ if (e.csize != def.getBytesWritten()) {
+ throw new ZipException(
+ "invalid entry compressed size (expected " +
+ e.csize + " but got " + def.getBytesWritten() + " bytes)");
+ }
+ if (e.crc != crc.getValue()) {
+ throw new ZipException(
+ "invalid entry CRC-32 (expected 0x" +
+ Long.toHexString(e.crc) + " but got 0x" +
+ Long.toHexString(crc.getValue()) + ")");
+ }
+ } else {
+ e.size = def.getBytesRead();
+ e.csize = def.getBytesWritten();
+ e.crc = crc.getValue();
+ writeEXT(e);
+ }
+ def.reset();
+ written += e.csize;
+ break;
+ case STORED:
+ // we already know that both e.size and e.csize are the same
+ if (e.size != written - locoff) {
throw new ZipException(
- "invalid entry compressed size (expected " +
- e.csize + " but got " + def.getBytesWritten() + " bytes)");
+ "invalid entry size (expected " + e.size +
+ " but got " + (written - locoff) + " bytes)");
}
if (e.crc != crc.getValue()) {
throw new ZipException(
- "invalid entry CRC-32 (expected 0x" +
- Long.toHexString(e.crc) + " but got 0x" +
- Long.toHexString(crc.getValue()) + ")");
+ "invalid entry crc-32 (expected 0x" +
+ Long.toHexString(e.crc) + " but got 0x" +
+ Long.toHexString(crc.getValue()) + ")");
}
- } else {
- e.size = def.getBytesRead();
- e.csize = def.getBytesWritten();
- e.crc = crc.getValue();
- writeEXT(e);
+ break;
+ default:
+ throw new ZipException("invalid compression method");
}
- def.reset();
- written += e.csize;
- break;
- case STORED:
- // we already know that both e.size and e.csize are the same
- if (e.size != written - locoff) {
- throw new ZipException(
- "invalid entry size (expected " + e.size +
- " but got " + (written - locoff) + " bytes)");
- }
- if (e.crc != crc.getValue()) {
- throw new ZipException(
- "invalid entry crc-32 (expected 0x" +
- Long.toHexString(e.crc) + " but got 0x" +
- Long.toHexString(crc.getValue()) + ")");
- }
- break;
- default:
- throw new ZipException("invalid compression method");
+ crc.reset();
+ current = null;
+ } catch (IOException e) {
+ if (usesDefaultDeflater && !(e instanceof ZipException))
+ def.end();
+ throw e;
}
- crc.reset();
- current = null;
}
}
diff --git a/jdk/test/java/util/zip/CloseDeflaterTest.java b/jdk/test/java/util/zip/CloseDeflaterTest.java
new file mode 100644
index 000000000..8aa4960f5

View File

@ -831,15 +831,7 @@ index bc06cac..67ef963 100644
int _n_threads;
TaskQueueSetSuper* _queue_set;
char _pad_before[DEFAULT_CACHE_LINE_SIZE];
@@ -634,14 +659,14 @@ public:
// else is. If returns "true", all threads are terminated. If returns
// "false", available work has been observed in one of the task queues,
// so the global task is not complete.
- bool offer_termination() {
+ virtual bool offer_termination() {
return offer_termination(NULL);
}
@@ -641,7 +666,7 @@ public:
// As above, but it also terminates if the should_exit_termination()
// method of the terminator parameter returns true. If terminator is
// NULL, then it is ignored.

View File

@ -1,238 +0,0 @@
From e5bf7f105c0066f770f5cdc65f94410d45d11f0f Mon Sep 17 00:00:00 2001
Subject: 8278794: Infinite loop in DeflaterOutputStream.finish()
---
.../share/classes/java/util/zip/Deflater.java | 10 ++
.../java/util/zip/DeflaterOutputStream.java | 14 +-
.../java/util/zip/ZipOutputStream.java | 4 +-
jdk/test/java/util/zip/CloseDeflaterTest.java | 147 ------------------
4 files changed, 22 insertions(+), 153 deletions(-)
delete mode 100644 jdk/test/java/util/zip/CloseDeflaterTest.java
diff --git a/jdk/src/share/classes/java/util/zip/Deflater.java b/jdk/src/share/classes/java/util/zip/Deflater.java
index 3bb5f9901..bffa397d9 100644
--- a/jdk/src/share/classes/java/util/zip/Deflater.java
+++ b/jdk/src/share/classes/java/util/zip/Deflater.java
@@ -559,6 +559,16 @@ class Deflater {
throw new NullPointerException("Deflater has been closed");
}
+ /**
+ * Returns the value of 'finish' flag.
+ * 'finish' will be set to true if def.finish() method is called.
+ */
+ boolean shouldFinish() {
+ synchronized (zsRef) {
+ return finish;
+ }
+ }
+
private static native void initIDs();
private native static long init(int level, int strategy, boolean nowrap);
private native static void setDictionary(long addr, byte[] b, int off, int len);
diff --git a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
index f4cf79693..c698a0147 100644
--- a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -221,9 +221,15 @@ class DeflaterOutputStream extends FilterOutputStream {
*/
public void finish() throws IOException {
if (!def.finished()) {
- def.finish();
- while (!def.finished()) {
- deflate();
+ try{
+ def.finish();
+ while (!def.finished()) {
+ deflate();
+ }
+ } catch(IOException e) {
+ if (usesDefaultDeflater)
+ def.end();
+ throw e;
}
}
}
diff --git a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
index f001ddf00..cd9194276 100644
--- a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -302,7 +302,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
crc.reset();
current = null;
} catch (IOException e) {
- if (usesDefaultDeflater && !(e instanceof ZipException))
+ if (def.shouldFinish() && usesDefaultDeflater && !(e instanceof ZipException))
def.end();
throw e;
}
diff --git a/jdk/test/java/util/zip/CloseDeflaterTest.java b/jdk/test/java/util/zip/CloseDeflaterTest.java
deleted file mode 100644
index 8aa4960f5..000000000
--- a/jdk/test/java/util/zip/CloseDeflaterTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 8193682
- * @summary Test Infinite loop while writing on closed GZipOutputStream , ZipOutputStream and JarOutputStream.
- * @run testng CloseDeflaterTest
- */
-import java.io.*;
-import java.util.Random;
-import java.util.jar.JarOutputStream;
-import java.util.zip.GZIPOutputStream;
-import java.util.zip.ZipOutputStream;
-import java.util.zip.ZipEntry;
-
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.Assert.fail;
-
-
-public class CloseDeflaterTest {
-
- //number of bytes to write
- private static final int INPUT_LENGTH= 512;
- //OutputStream that will throw an exception during a write operation
- private static OutputStream outStream = new OutputStream() {
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- //throw exception during write
- throw new IOException();
- }
- @Override
- public void write(byte b[]) throws IOException {}
- @Override
- public void write(int b) throws IOException {}
- };
- private static byte[] inputBytes = new byte[INPUT_LENGTH];
- private static Random rand = new Random();
-
- @DataProvider(name = "testgzipinput")
- public Object[][] testGZipInput() {
- //testGZip will close the GZipOutputStream using close() method when the boolean
- //useCloseMethod is set to true and finish() method if the value is set to false
- return new Object[][] {
- { GZIPOutputStream.class, true },
- { GZIPOutputStream.class, false },
- };
- }
-
- @DataProvider(name = "testzipjarinput")
- public Object[][] testZipAndJarInput() {
- //testZipAndJarInput will perfrom write/closeEntry operations on JarOutputStream when the boolean
- //useJar is set to true and on ZipOutputStream if the value is set to false
- return new Object[][] {
- { JarOutputStream.class, true },
- { ZipOutputStream.class, false },
- };
- }
-
- @BeforeTest
- public void before_test()
- {
- //add inputBytes array with random bytes to write into Zip
- rand.nextBytes(inputBytes);
- }
-
- //Test for infinite loop by writing bytes to closed GZIPOutputStream
- @Test(dataProvider = "testgzipinput")
- public void testGZip(Class<?> type, boolean useCloseMethod) throws IOException {
- GZIPOutputStream zip = new GZIPOutputStream(outStream);
- try {
- zip.write(inputBytes, 0, INPUT_LENGTH);
- //close zip
- if(useCloseMethod) {
- zip.close();
- } else {
- zip.finish();
- }
- } catch (IOException e) {
- //expected
- }
- for (int i = 0; i < 3; i++) {
- try {
- //write on a closed GZIPOutputStream
- zip.write(inputBytes, 0, INPUT_LENGTH);
- fail("Deflater closed exception not thrown");
- } catch (NullPointerException e) {
- //expected , Deflater has been closed exception
- }
- }
- }
-
- //Test for infinite loop by writing bytes to closed ZipOutputStream/JarOutputStream
- @Test(dataProvider = "testzipjarinput")
- public void testZipCloseEntry(Class<?> type,boolean useJar) throws IOException {
- ZipOutputStream zip = null;
- if(useJar) {
- zip = new JarOutputStream(outStream);
- } else {
- zip = new ZipOutputStream(outStream);
- }
- try {
- zip.putNextEntry(new ZipEntry(""));
- } catch (IOException e) {
- //expected to throw IOException since putNextEntry calls write method
- }
- try {
- zip.write(inputBytes, 0, INPUT_LENGTH);
- //close zip entry
- zip.closeEntry();
- } catch (IOException e) {
- //expected
- }
- for (int i = 0; i < 3; i++) {
- try {
- //write on a closed ZipOutputStream
- zip.write(inputBytes, 0, INPUT_LENGTH);
- fail("Deflater closed exception not thrown");
- } catch (NullPointerException e) {
- //expected , Deflater has been closed exception
- }
- }
- }
-
-}
--
2.22.0

View File

@ -9,28 +9,6 @@ Subject: 8313626: C2 crash due to unexpected exception control flow
create mode 100644 jdk/test/jdk/jfr/event/compiler/MissingSafepointOnTryCatch.jasm
create mode 100644 jdk/test/jdk/jfr/event/compiler/TestMissingSafepointOnTryCatch.java
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index 1b2b77c71..7a7aba359 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -892,6 +892,8 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
tty->print_cr(" Catching every inline exception bci:%d -> handler_bci:%d", bci(), handler_bci);
}
#endif
+ // If this is a backwards branch in the bytecodes, add safepoint
+ maybe_add_safepoint(handler_bci);
merge_exception(handler_bci); // jump to handler
return; // No more handling to be done here!
}
@@ -925,6 +927,8 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
tty->cr();
}
#endif
+ // If this is a backwards branch in the bytecodes, add safepoint
+ maybe_add_safepoint(handler_bci);
merge_exception(handler_bci);
}
set_control(not_subtype_ctrl);
diff --git a/jdk/test/jdk/jfr/event/compiler/MissingSafepointOnTryCatch.jasm b/jdk/test/jdk/jfr/event/compiler/MissingSafepointOnTryCatch.jasm
new file mode 100644
index 000000000..413736e59

View File

@ -340,185 +340,6 @@ index ff59c5ecc..8b0c08909 100644
while (length-- > 0)
h = 31*h + *s++;
return h;
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index 7e1d8c99d..1cd9e8bdb 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -1131,6 +1131,10 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
return;
}
num_bytes += sb->remaining_skip;
+ // Check for overflow if remaining_skip value is too large
+ if (num_bytes < 0) {
+ return;
+ }
sb->remaining_skip = 0;
/* First the easy case where we are skipping <= the current contents. */
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
index cea158e17..2f64d33cc 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
@@ -406,6 +406,10 @@ sun_jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
return;
}
num_bytes += src->remaining_skip;
+ // Check for overflow if remaining_skip value is too large
+ if (num_bytes < 0) {
+ return;
+ }
src->remaining_skip = 0;
ret = (int)src->pub.bytes_in_buffer; /* this conversion is safe, because capacity of the buffer is limited by jnit */
if (ret >= num_bytes) {
diff --git a/jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java b/jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java
new file mode 100644
index 000000000..1b82e2f73
--- /dev/null
+++ b/jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Track;
+
+/**
+ * @test
+ * @bug 8319598
+ * @summary SMFParser bug with running status, interrupted by Meta or SysEx messages
+ */
+public class SMFInterruptedRunningStatus {
+
+ public static void main(String[] args) throws Exception {
+
+ byte[][] files = new byte[][] {SMF_1, SMF_2, SMF_3};
+ for (int i = 0; i < files.length; i++) {
+ Sequence seq = MidiSystem.getSequence(
+ new ByteArrayInputStream(files[i]));
+ testSequence(seq, i + 1);
+ }
+
+ // no exception thrown, all files have been parsed correctly
+ System.out.println("Test passed");
+ }
+
+ private static void testSequence(Sequence seq, int fileNumber) {
+
+ // check number of tracks and number of events
+ Track[] tracks = seq.getTracks();
+ if (1 != tracks.length) {
+ throw new RuntimeException("file number "
+ + fileNumber + " fails (incorrect number of tracks: "
+ + tracks.length + ")");
+ }
+ Track track = tracks[0];
+ if (7 != track.size()) {
+ throw new RuntimeException("file number " + fileNumber
+ + " fails (incorrect number of events: "
+ + track.size() + ")");
+ }
+
+ // check status byte of each message
+ int[] expectedStatusBytes = new int[] {
+ 0x90, 0xFF, 0x90, 0x90, 0x90, 0xFF, 0xFF};
+ for (int i = 0; i < expectedStatusBytes.length; i++) {
+ int expected = expectedStatusBytes[i];
+ if (expected != track.get(i).getMessage().getStatus()) {
+ throw new RuntimeException("file number " + fileNumber
+ + " fails (wrong status byte in event " + i + ")");
+ }
+ }
+ }
+
+ // MIDI file without running status - should work equally before
+ // and after the bugfix
+ private static final byte[] SMF_1 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x24, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x20, // delta time
+ (byte) 0x90, 0x3C, 0x00, // Note-OFF (C)
+ 0x20, // delta time
+ (byte) 0x90, 0x3E, 0x7F, // Note-ON (D)
+ 0x60, // delta time
+ (byte) 0x90, 0x3E, 0x00, // Note-OFF (D)
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+
+ // MIDI file with running status, interrupted by a META message
+ // - failed before the bugfix
+ private static final byte[] SMF_2 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
+ 0x20, // delta time
+ 0x3C, 0x00, // Note-OFF (C) - running status
+ 0x20, // delta time
+ 0x3E, 0x7F, // Note-ON (D) - running status
+ 0x60, // delta time
+ 0x3E, 0x00, // Note-OFF (D) - running status
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+
+ // MIDI file with running status, interrupted by a META message
+ // - succeeded before the bugfix but with wrong interpretation of the data
+ private static final byte[] SMF_3 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
+ 0x20, // delta time
+ 0x3C, 0x00, // Note-OFF (C) - running status
+ 0x0D, // delta time
+ 0x3E, 0x7F, // Note-ON (D) - running status
+ 0x60, // delta time
+ 0x3E, 0x00, // Note-OFF (D) - running status
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+}
--
2.23.0

View File

@ -0,0 +1,67 @@
Subject: [PATCH][Huawei] Enhance SIGBUS and rlimit information in errlog
---
hotspot/src/os/posix/vm/os_posix.cpp | 26 ++++++++++++++++++++++
hotspot/src/share/vm/utilities/vmError.cpp | 2 +-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp
index f7dab3c7f..a83ae1476 100644
--- a/hotspot/src/os/posix/vm/os_posix.cpp
+++ b/hotspot/src/os/posix/vm/os_posix.cpp
@@ -207,6 +207,26 @@ void os::Posix::print_rlimit_info(outputStream* st) {
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
+ st->print(", DATA ");
+ getrlimit(RLIMIT_DATA, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%uk", rlim.rlim_cur >> 10);
+
+ st->print(", FSIZE ");
+ getrlimit(RLIMIT_FSIZE, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%u", rlim.rlim_cur >> 10);
+
+ st->print(", CPU ");
+ getrlimit(RLIMIT_CPU, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%uk seconds", rlim.rlim_cur >> 10);
+
+ st->print(", RSS ");
+ getrlimit(RLIMIT_RSS, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%u", rlim.rlim_cur >> 10);
+
// Isn't there on solaris
#if !defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix)
st->print(", NPROC ");
@@ -765,6 +785,12 @@ static bool get_signal_code_description(const siginfo_t* si, enum_sigcode_desc_t
{ SIGBUS, BUS_ADRALN, "BUS_ADRALN", "Invalid address alignment." },
{ SIGBUS, BUS_ADRERR, "BUS_ADRERR", "Nonexistent physical address." },
{ SIGBUS, BUS_OBJERR, "BUS_OBJERR", "Object-specific hardware error." },
+#ifdef BUS_MCEERR_AR
+ { SIGBUS, BUS_MCEERR_AR,"BUS_MCEERR_AR","hardware memory error consumed on a machine check: action required."},
+#endif
+#ifdef BUS_MCEERR_AO
+ { SIGBUS, BUS_MCEERR_AO,"BUS_MCEERR_AO","hardware memory error detected in process but not consumed: action optional."},
+#endif
{ SIGTRAP, TRAP_BRKPT, "TRAP_BRKPT", "Process breakpoint." },
{ SIGTRAP, TRAP_TRACE, "TRAP_TRACE", "Process trace trap." },
{ SIGCHLD, CLD_EXITED, "CLD_EXITED", "Child has exited." },
diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp
index 0c5c955bf..3233e4b31 100644
--- a/hotspot/src/share/vm/utilities/vmError.cpp
+++ b/hotspot/src/share/vm/utilities/vmError.cpp
@@ -813,7 +813,7 @@ void VMError::report(outputStream* st) {
#if defined(AARCH64) || defined(X86)
STEP(207, "(printing file descriptor)" )
- if (ExtensiveErrorReports && _verbose) {
+ if (_verbose) {
// File Descriptor
os::print_file_descriptor(st);
st->cr();
--
2.19.1

View File

@ -13,8 +13,8 @@ index 7dde7f096..d122f0eae 100644
WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
endif
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type
+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Wno-stringop-overflow
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual
+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual -Wno-stringop-overflow
ifeq ($(USE_CLANG),)
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit

View File

@ -0,0 +1,40 @@
Subject: Fix build failures due to wrap in x86
---
hotspot/make/linux/makefiles/adlc.make | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make
index a01aa1aaa..92728fbe7 100644
--- a/hotspot/make/linux/makefiles/adlc.make
+++ b/hotspot/make/linux/makefiles/adlc.make
@@ -70,8 +70,26 @@ CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
CFLAGS += $(CFLAGS_WARN)
# Extra flags from gnumake's invocation or environment
+# Adapt wrap for JDK-8281096:Flags introduced by configure script are not passed to ADLC build
+WRAP_STR := -Wl,--wrap
+WRAP_MEM := ,--wrap=memcpy
+WRAP_NULL :=
+WRAP_LIBPTHREAD := libpthread.so.0
+WRAP_LIBDL := libdl.so.2
+WRAP_LM := -lm
+HOST_LDFLAGS_ADOPT_WRAP := $(HOST_LDFLAGS)
+
+ifeq ($(findstring --wrap=,$(HOST_LDFLAGS)),--wrap=)
+ HOST_LDFLAGS_ADOPT_WRAP := $(subst $(WRAP_MEM),$(WRAP_NULL),$(HOST_LDFLAGS_ADOPT_WRAP))
+ HOST_LDFLAGS_ADOPT_WRAP := $(subst $(WRAP_LIBPTHREAD),$(WRAP_NULL),$(HOST_LDFLAGS_ADOPT_WRAP))
+ HOST_LDFLAGS_ADOPT_WRAP := $(subst $(WRAP_LIBDL),$(WRAP_NULL),$(HOST_LDFLAGS_ADOPT_WRAP))
+ HOST_LDFLAGS_ADOPT_WRAP := $(subst $(WRAP_LM),$(WRAP_NULL),$(HOST_LDFLAGS_ADOPT_WRAP))
+ FILTERED_WRAP := $(filter $(WRAP_STR)%,$(HOST_LDFLAGS_ADOPT_WRAP))
+ HOST_LDFLAGS_ADOPT_WRAP := $(patsubst %$(FILTERED_WRAP),$(WRAP_NULL),$(HOST_LDFLAGS_ADOPT_WRAP))
+endif
+
CFLAGS += $(HOST_CFLAGS)
-LFLAGS += $(HOST_CFLAGS) $(HOST_LDFLAGS)
+LFLAGS += $(HOST_CFLAGS) $(HOST_LDFLAGS_ADOPT_WRAP)
ASFLAGS += $(HOST_ASFLAGS)
OBJECTNAMES = \
--
2.37.7

View File

@ -0,0 +1,691 @@
---
jdk/make/mapfiles/libzip/mapfile-vers | 5 +-
.../share/classes/java/util/zip/Deflater.java | 36 +++++--
.../java/util/zip/GZIPInputStream.java | 73 +++++++++++---
.../java/util/zip/GZIPOutputStream.java | 44 +++++----
.../share/classes/java/util/zip/Inflater.java | 37 +++++---
.../java/util/zip/InflaterInputStream.java | 25 +++++
jdk/src/share/lib/security/java.policy | 2 +
jdk/src/share/native/java/util/zip/Deflater.c | 9 +-
jdk/src/share/native/java/util/zip/Inflater.c | 73 +-------------
.../java/util/zip/GZIP/TestAvailable.java | 94 +++++++++++++++++++
10 files changed, 272 insertions(+), 126 deletions(-)
create mode 100644 jdk/test/java/util/zip/GZIP/TestAvailable.java
diff --git a/jdk/make/mapfiles/libzip/mapfile-vers b/jdk/make/mapfiles/libzip/mapfile-vers
index 5c6d27d0d..79ef59e5f 100644
--- a/jdk/make/mapfiles/libzip/mapfile-vers
+++ b/jdk/make/mapfiles/libzip/mapfile-vers
@@ -38,16 +38,15 @@ SUNWprivate_1.1 {
Java_java_util_zip_Deflater_end;
Java_java_util_zip_Deflater_getAdler;
Java_java_util_zip_Deflater_init;
- Java_java_util_zip_Deflater_initKae;
+ Java_java_util_zip_Deflater_initKAE;
Java_java_util_zip_Deflater_initIDs;
Java_java_util_zip_Deflater_reset;
Java_java_util_zip_Deflater_setDictionary;
Java_java_util_zip_Inflater_end;
Java_java_util_zip_Inflater_getAdler;
Java_java_util_zip_Inflater_inflateBytes;
- Java_java_util_zip_Inflater_inflateBytesKAE;
Java_java_util_zip_Inflater_init;
- Java_java_util_zip_Inflater_initKae;
+ Java_java_util_zip_Inflater_initKAE;
Java_java_util_zip_Inflater_initIDs;
Java_java_util_zip_Inflater_reset;
Java_java_util_zip_Inflater_setDictionary;
diff --git a/jdk/src/share/classes/java/util/zip/Deflater.java b/jdk/src/share/classes/java/util/zip/Deflater.java
index a4ea40cf8..509808349 100644
--- a/jdk/src/share/classes/java/util/zip/Deflater.java
+++ b/jdk/src/share/classes/java/util/zip/Deflater.java
@@ -81,7 +81,6 @@ class Deflater {
private boolean finish, finished;
private long bytesRead;
private long bytesWritten;
- private boolean defalterUseKae;
/**
* Compression method for the deflate algorithm (the only one currently
@@ -169,13 +168,20 @@ class Deflater {
public Deflater(int level, boolean nowrap) {
this.level = level;
this.strategy = DEFAULT_STRATEGY;
- if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
- ("aarch64".equals(System.getProperty("os.arch")))) {
- this.defalterUseKae = true;
- }
- this.zsRef = defalterUseKae ?
- new ZStreamRef(initKae(level, DEFAULT_STRATEGY)) :
- new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap));
+ this.zsRef = new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap));
+ }
+
+ /**
+ * Creates a new compressor using the specified compression level
+ * and windowBits.
+ * This method is mainly used to support the KAE-zip feature.
+ * @param level the compression level (0-9)
+ * @param windowBits compression format (-15~31)
+ */
+ public Deflater(int level, int windowBits) {
+ this.level = level;
+ this.strategy = DEFAULT_STRATEGY;
+ this.zsRef = new ZStreamRef(initKAE(level, DEFAULT_STRATEGY, windowBits));
}
/**
@@ -535,6 +541,18 @@ class Deflater {
}
}
+ /**
+ * Resets deflater so that a new set of input data can be processed.
+ * Java fields are not initialized.
+ * This method is mainly used to support the KAE-zip feature.
+ */
+ public void resetKAE() {
+ synchronized (zsRef) {
+ ensureOpen();
+ reset(zsRef.address());
+ }
+ }
+
/**
* Closes the compressor and discards any unprocessed input.
* This method should be called when the compressor is no longer
@@ -578,7 +596,7 @@ class Deflater {
private static native void initIDs();
private native static long init(int level, int strategy, boolean nowrap);
- private native static long initKae(int level, int strategy);
+ private native static long initKAE(int level, int strategy, int windowBits);
private native static void setDictionary(long addr, byte[] b, int off, int len);
private native int deflateBytes(long addr, byte[] b, int off, int len,
int flush);
diff --git a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
index 7fb753729..10d044caf 100644
--- a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
+++ b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
@@ -54,10 +54,22 @@ class GZIPInputStream extends InflaterInputStream {
private boolean closed = false;
- /*
- * GZIP use KAE.
+ /**
+ * The field is mainly used to support the KAE-zip feature.
*/
- private boolean gzipUseKae = false;
+ private static boolean GZIP_USE_KAE = false;
+
+ private static int WINDOWBITS = 31;
+
+ private static int FLUSHKAE = 2;
+
+ static {
+ if ("aarch64".equals(System.getProperty("os.arch"))) {
+ GZIP_USE_KAE = Boolean.parseBoolean(System.getProperty("GZIP_USE_KAE", "false"));
+ WINDOWBITS = Integer.parseInt(System.getProperty("WINDOWBITS", "31"));
+ FLUSHKAE = Integer.parseInt(System.getProperty("FLUSHKAE", "2"));
+ }
+ }
/**
* Check to make sure that this stream has not been closed
@@ -79,14 +91,13 @@ class GZIPInputStream extends InflaterInputStream {
* @exception IllegalArgumentException if {@code size <= 0}
*/
public GZIPInputStream(InputStream in, int size) throws IOException {
- super(in, new Inflater(true), size);
+ super(in, GZIP_USE_KAE ? new Inflater(WINDOWBITS, FLUSHKAE) : new Inflater(true), size);
usesDefaultInflater = true;
- if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
- ("aarch64".equals(System.getProperty("os.arch")))) {
- gzipUseKae = true;
- }
- // file header will be readed by kae zlib when use kae
- if (gzipUseKae) return;
+
+ // When GZIP_USE_KAE is true, the header of the file is readed
+ // through the native zlib library, not in java code.
+ if (GZIP_USE_KAE) return;
+
readHeader(in);
}
@@ -127,13 +138,16 @@ class GZIPInputStream extends InflaterInputStream {
}
int n = super.read(buf, off, len);
if (n == -1) {
- if (readTrailer())
+ if (GZIP_USE_KAE ? readTrailerKAE() : readTrailer())
eos = true;
else
return this.read(buf, off, len);
} else {
crc.update(buf, off, n);
}
+ if (GZIP_USE_KAE && inf.finished()) {
+ if (readTrailerKAE()) eos = true;
+ }
return n;
}
@@ -220,9 +234,7 @@ class GZIPInputStream extends InflaterInputStream {
* data set)
*/
private boolean readTrailer() throws IOException {
- // file trailer will be readed by kae zlib when use kae
- if (gzipUseKae) return true;
-
+ if (GZIP_USE_KAE) return true;
InputStream in = this.in;
int n = inf.getRemaining();
if (n > 0) {
@@ -251,6 +263,39 @@ class GZIPInputStream extends InflaterInputStream {
return false;
}
+ /*
+ * Reads GZIP member trailer and returns true if the eos
+ * reached, false if there are more (concatenated gzip
+ * data set)
+ *
+ * This method is mainly used to support the KAE-zip feature.
+ */
+ private boolean readTrailerKAE() throws IOException {
+ InputStream in = this.in;
+ int n = inf.getRemaining();
+ if (n > 0) {
+ in = new SequenceInputStream(
+ new ByteArrayInputStream(buf, len - n, n),
+ new FilterInputStream(in) {
+ public void close() throws IOException {}
+ });
+ }
+ // If there are more bytes available in "in" or the leftover in the "inf" is > 18 bytes:
+ // next.header.min(10) + next.trailer(8), try concatenated case
+
+ if (n > 18) {
+ inf.reset();
+ inf.setInput(buf, len - n, n);
+ } else {
+ try {
+ fillKAE(n);
+ } catch (IOException e) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/*
* Reads unsigned integer in Intel byte order.
*/
diff --git a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
index 0f0be98bb..8eae40739 100644
--- a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
@@ -52,10 +52,19 @@ class GZIPOutputStream extends DeflaterOutputStream {
*/
private final static int TRAILER_SIZE = 8;
- /*
- * GZIP use KAE.
+ /**
+ * The field is mainly used to support the KAE-zip feature.
*/
- private boolean gzipUseKae = false;
+ private static boolean GZIP_USE_KAE = false;
+
+ private static int WINDOWBITS = 31;
+
+ static {
+ if ("aarch64".equals(System.getProperty("os.arch"))) {
+ GZIP_USE_KAE = Boolean.parseBoolean(System.getProperty("GZIP_USE_KAE", "false"));
+ WINDOWBITS = Integer.parseInt(System.getProperty("WINDOWBITS", "31"));
+ }
+ }
/**
* Creates a new output stream with the specified buffer size.
@@ -92,16 +101,15 @@ class GZIPOutputStream extends DeflaterOutputStream {
public GZIPOutputStream(OutputStream out, int size, boolean syncFlush)
throws IOException
{
- super(out, new Deflater(Deflater.DEFAULT_COMPRESSION, true),
+ super(out, GZIP_USE_KAE ? new Deflater(Deflater.DEFAULT_COMPRESSION, WINDOWBITS) :
+ new Deflater(Deflater.DEFAULT_COMPRESSION, true),
size,
syncFlush);
usesDefaultDeflater = true;
- if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
- ("aarch64".equals(System.getProperty("os.arch")))) {
- gzipUseKae = true;
- }
- // file header will be writed by kae zlib when use kae
- if (gzipUseKae) return;
+
+ // When GZIP_USE_KAE is true, the header of the file is written
+ // through the native zlib library, not in java code.
+ if (GZIP_USE_KAE) return;
writeHeader();
crc.reset();
}
@@ -171,9 +179,11 @@ class GZIPOutputStream extends DeflaterOutputStream {
int len = def.deflate(buf, 0, buf.length);
if (def.finished() && len <= buf.length - TRAILER_SIZE) {
// last deflater buffer. Fit trailer at the end
- // file trailer will be writed by kae zlib when use kae
- if (gzipUseKae) {
+ // When GZIP_USE_KAE is true, the trailer of the file is written
+ // through the native zlib library, not in java code.
+ if (GZIP_USE_KAE) {
out.write(buf, 0, len);
+ def.resetKAE();
return;
}
writeTrailer(buf, len);
@@ -184,12 +194,14 @@ class GZIPOutputStream extends DeflaterOutputStream {
if (len > 0)
out.write(buf, 0, len);
}
- // file trailer will be writed by kae zlib when use kae
- if (gzipUseKae) {
- return;
- }
// if we can't fit the trailer at the end of the last
// deflater buffer, we write it separately
+ // When GZIP_USE_KAE is true, the trailer of the file is written
+ // through the native zlib library, not in java code.
+ if (GZIP_USE_KAE) {
+ def.resetKAE();
+ return;
+ }
byte[] trailer = new byte[TRAILER_SIZE];
writeTrailer(trailer, 0);
out.write(trailer);
diff --git a/jdk/src/share/classes/java/util/zip/Inflater.java b/jdk/src/share/classes/java/util/zip/Inflater.java
index 42e90f525..d1074cd8d 100644
--- a/jdk/src/share/classes/java/util/zip/Inflater.java
+++ b/jdk/src/share/classes/java/util/zip/Inflater.java
@@ -80,7 +80,6 @@ class Inflater {
private boolean needDict;
private long bytesRead;
private long bytesWritten;
- private boolean inflaterUseKae;
private static final byte[] defaultBuf = new byte[0];
@@ -101,11 +100,18 @@ class Inflater {
* @param nowrap if true then support GZIP compatible compression
*/
public Inflater(boolean nowrap) {
- if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
- ("aarch64".equals(System.getProperty("os.arch")))) {
- inflaterUseKae = true;
- }
- zsRef = inflaterUseKae ? new ZStreamRef(initKae()): new ZStreamRef(init(nowrap));
+ zsRef = new ZStreamRef(init(nowrap));
+ }
+
+ /**
+ * Creates a new decompressor.
+ * This method is mainly used to support the KAE-zip feature.
+ *
+ * @param windowBits compression format (-15~31)
+ * @param flushKAE inflate flush type (0~6)
+ */
+ public Inflater(int windowBits, int flushKAE) {
+ this.zsRef = new ZStreamRef(initKAE(windowBits, flushKAE));
}
/**
@@ -261,9 +267,7 @@ class Inflater {
synchronized (zsRef) {
ensureOpen();
int thisLen = this.len;
- int n = this.inflaterUseKae ?
- inflateBytesKAE(zsRef.address(), b, off, len) :
- inflateBytes(zsRef.address(), b, off, len);
+ int n = inflateBytes(zsRef.address(), b, off, len);
bytesWritten += n;
bytesRead += (thisLen - this.len);
return n;
@@ -365,6 +369,17 @@ class Inflater {
}
}
+ /**
+ * Resets inflater so that a new set of input data can be processed.
+ * This method is mainly used to support the KAE-zip feature.
+ */
+ public void resetKAE() {
+ synchronized (zsRef) {
+ ensureOpen();
+ reset(zsRef.address());
+ }
+ }
+
/**
* Closes the decompressor and discards any unprocessed input.
* This method should be called when the decompressor is no longer
@@ -404,13 +419,11 @@ class Inflater {
private native static void initIDs();
private native static long init(boolean nowrap);
- private native static long initKae();
+ private native static long initKAE(int windowBits, int flushKAE);
private native static void setDictionary(long addr, byte[] b, int off,
int len);
private native int inflateBytes(long addr, byte[] b, int off, int len)
throws DataFormatException;
- private native int inflateBytesKAE(long addr, byte[] b, int off, int len)
- throws DataFormatException;
private native static int getAdler(long addr);
private native static void reset(long addr);
private native static void end(long addr);
diff --git a/jdk/src/share/classes/java/util/zip/InflaterInputStream.java b/jdk/src/share/classes/java/util/zip/InflaterInputStream.java
index 163f619c1..b0ac7dd26 100644
--- a/jdk/src/share/classes/java/util/zip/InflaterInputStream.java
+++ b/jdk/src/share/classes/java/util/zip/InflaterInputStream.java
@@ -179,6 +179,10 @@ class InflaterInputStream extends FilterInputStream {
ensureOpen();
if (reachEOF) {
return 0;
+ } else if (inf.finished()) {
+ // the end of the compressed data stream has been reached
+ reachEOF = true;
+ return 0;
} else {
return 1;
}
@@ -242,6 +246,27 @@ class InflaterInputStream extends FilterInputStream {
inf.setInput(buf, 0, len);
}
+ /**
+ * Fills input buffer with more data to decompress.
+ * This method is mainly used to support the KAE-zip feature.
+ * @param n Maximum Read Bytes
+ * @throws IOException if an I/O error has occurred
+ */
+ protected void fillKAE(int n) throws IOException {
+ ensureOpen();
+ byte[] buftmp = new byte[buf.length];
+ if (n != 0) {
+ System.arraycopy(buf, buf.length - n, buftmp, 0, n);
+ }
+ int kaelen = in.read(buftmp, n, buf.length - n);
+ if (kaelen == -1) {
+ throw new EOFException("Unexpected end of ZLIB input stream");
+ }
+ System.arraycopy(buftmp, 0, buf, buf.length - n - kaelen, n + kaelen);
+ inf.reset();
+ inf.setInput(buf, buf.length - n - kaelen, n + kaelen);
+ }
+
/**
* Tests if this input stream supports the <code>mark</code> and
* <code>reset</code> methods. The <code>markSupported</code>
diff --git a/jdk/src/share/lib/security/java.policy b/jdk/src/share/lib/security/java.policy
index baec2ea15..284e3e334 100644
--- a/jdk/src/share/lib/security/java.policy
+++ b/jdk/src/share/lib/security/java.policy
@@ -50,5 +50,7 @@ grant {
permission java.util.PropertyPermission "sun.security.pkcs11.disableKeyExtraction", "read";
permission java.util.PropertyPermission "GZIP_USE_KAE", "read";
+ permission java.util.PropertyPermission "WINDOWBITS", "read";
+ permission java.util.PropertyPermission "FLUSHKAE", "read";
};
diff --git a/jdk/src/share/native/java/util/zip/Deflater.c b/jdk/src/share/native/java/util/zip/Deflater.c
index 1b048e4f5..b26eb1392 100644
--- a/jdk/src/share/native/java/util/zip/Deflater.c
+++ b/jdk/src/share/native/java/util/zip/Deflater.c
@@ -37,7 +37,6 @@
#include "java_util_zip_Deflater.h"
#define DEF_MEM_LEVEL 8
-#define KAE_DEFLATER_WindowBit 31
static jfieldID levelID;
static jfieldID strategyID;
@@ -106,8 +105,8 @@ Java_java_util_zip_Deflater_init(JNIEnv *env, jclass cls, jint level,
}
JNIEXPORT jlong JNICALL
-Java_java_util_zip_Deflater_initKae(JNIEnv *env, jclass cls, jint level,
- jint strategy)
+Java_java_util_zip_Deflater_initKAE(JNIEnv *env, jclass cls, jint level,
+ jint strategy, jint windowBits)
{
z_stream *strm = calloc(1, sizeof(z_stream));
@@ -116,7 +115,9 @@ Java_java_util_zip_Deflater_initKae(JNIEnv *env, jclass cls, jint level,
return jlong_zero;
} else {
const char *msg;
- int ret = deflateInit2(strm, level, Z_DEFLATED, KAE_DEFLATER_WindowBit, DEF_MEM_LEVEL, strategy);
+ int ret = deflateInit2(strm, level, Z_DEFLATED,
+ windowBits,
+ DEF_MEM_LEVEL, strategy);
switch (ret) {
case Z_OK:
return ptr_to_jlong(strm);
diff --git a/jdk/src/share/native/java/util/zip/Inflater.c b/jdk/src/share/native/java/util/zip/Inflater.c
index fca207215..8317267ff 100644
--- a/jdk/src/share/native/java/util/zip/Inflater.c
+++ b/jdk/src/share/native/java/util/zip/Inflater.c
@@ -41,11 +41,11 @@
#define ThrowDataFormatException(env, msg) \
JNU_ThrowByName(env, "java/util/zip/DataFormatException", msg)
-#define KAE_INFLATER_WindowBit 31
static jfieldID needDictID;
static jfieldID finishedID;
static jfieldID bufID, offID, lenID;
+static jint inflaterFlushType = Z_PARTIAL_FLUSH;
JNIEXPORT void JNICALL
Java_java_util_zip_Inflater_initIDs(JNIEnv *env, jclass cls)
@@ -96,16 +96,17 @@ Java_java_util_zip_Inflater_init(JNIEnv *env, jclass cls, jboolean nowrap)
}
JNIEXPORT jlong JNICALL
-Java_java_util_zip_Inflater_initKae(JNIEnv *env, jclass cls)
+Java_java_util_zip_Inflater_initKAE(JNIEnv *env, jclass cls, jint windowBits, jint flushKAE)
{
z_stream *strm = calloc(1, sizeof(z_stream));
+ inflaterFlushType = flushKAE;
if (strm == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
return jlong_zero;
} else {
const char *msg;
- int ret = inflateInit2(strm, KAE_INFLATER_WindowBit);
+ int ret = inflateInit2(strm, windowBits);
switch (ret) {
case Z_OK:
return ptr_to_jlong(strm);
@@ -181,71 +182,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
strm->next_out = (Bytef *) (out_buf + off);
strm->avail_in = this_len;
strm->avail_out = len;
- ret = inflate(strm, Z_PARTIAL_FLUSH);
- (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
- (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
-
- switch (ret) {
- case Z_STREAM_END:
- (*env)->SetBooleanField(env, this, finishedID, JNI_TRUE);
- /* fall through */
- case Z_OK:
- this_off += this_len - strm->avail_in;
- (*env)->SetIntField(env, this, offID, this_off);
- (*env)->SetIntField(env, this, lenID, strm->avail_in);
- return (jint) (len - strm->avail_out);
- case Z_NEED_DICT:
- (*env)->SetBooleanField(env, this, needDictID, JNI_TRUE);
- /* Might have consumed some input here! */
- this_off += this_len - strm->avail_in;
- (*env)->SetIntField(env, this, offID, this_off);
- (*env)->SetIntField(env, this, lenID, strm->avail_in);
- return 0;
- case Z_BUF_ERROR:
- return 0;
- case Z_DATA_ERROR:
- ThrowDataFormatException(env, strm->msg);
- return 0;
- case Z_MEM_ERROR:
- JNU_ThrowOutOfMemoryError(env, 0);
- return 0;
- default:
- JNU_ThrowInternalError(env, strm->msg);
- return 0;
- }
-}
-
-JNIEXPORT jint JNICALL
-Java_java_util_zip_Inflater_inflateBytesKAE(JNIEnv *env, jobject this, jlong addr,
- jarray b, jint off, jint len)
-{
- z_stream *strm = jlong_to_ptr(addr);
- jarray this_buf = (jarray)(*env)->GetObjectField(env, this, bufID);
- jint this_off = (*env)->GetIntField(env, this, offID);
- jint this_len = (*env)->GetIntField(env, this, lenID);
-
- jbyte *in_buf;
- jbyte *out_buf;
- int ret;
-
- in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
- if (in_buf == NULL) {
- if (this_len != 0 && (*env)->ExceptionOccurred(env) == NULL)
- JNU_ThrowOutOfMemoryError(env, 0);
- return 0;
- }
- out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
- if (out_buf == NULL) {
- (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
- if (len != 0 && (*env)->ExceptionOccurred(env) == NULL)
- JNU_ThrowOutOfMemoryError(env, 0);
- return 0;
- }
- strm->next_in = (Bytef *) (in_buf + this_off);
- strm->next_out = (Bytef *) (out_buf + off);
- strm->avail_in = this_len;
- strm->avail_out = len;
- ret = inflate(strm, Z_SYNC_FLUSH);
+ ret = inflate(strm, inflaterFlushType);
(*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
(*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
diff --git a/jdk/test/java/util/zip/GZIP/TestAvailable.java b/jdk/test/java/util/zip/GZIP/TestAvailable.java
new file mode 100644
index 000000000..3dc9b3445
--- /dev/null
+++ b/jdk/test/java/util/zip/GZIP/TestAvailable.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @library /lib/testlibrary/
+ * @build jdk.testlibrary.*
+ * @run main TestAvailable
+ * @bug 7031075
+ * @summary Make sure that available() method behaves as expected.
+ * @key randomness
+ */
+
+import java.io.*;
+import java.util.Random;
+import java.util.zip.*;
+import jdk.testlibrary.RandomFactory;
+
+public class TestAvailable {
+
+ public static void main(String args[]) throws Throwable {
+ Random r = RandomFactory.getRandom();
+ for (int n = 0; n < 10; n++) {
+ byte[] src = new byte[r.nextInt(100)];
+ r.nextBytes(src);
+
+ // test InflaterInputStream
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (DeflaterOutputStream dos = new DeflaterOutputStream(baos)) {
+ dos.write(src);
+ }
+ try (InflaterInputStream iis = new InflaterInputStream(
+ new ByteArrayInputStream(baos.toByteArray()))) {
+ test(iis, src);
+ }
+
+ // test GZIPInputStream
+ baos = new ByteArrayOutputStream();
+ try (GZIPOutputStream dos = new GZIPOutputStream(baos)) {
+ dos.write(src);
+ }
+ try (GZIPInputStream gis = new GZIPInputStream(
+ new ByteArrayInputStream(baos.toByteArray()))) {
+ test(gis, src);
+ }
+ }
+ }
+
+ private static void test(InputStream is, byte[] expected) throws IOException {
+ int cnt = 0;
+ do {
+ int available = is.available();
+ if (available > 0) {
+ int b = is.read();
+ if (b == -1) {
+ throw new RuntimeException("available() > 0, read() == -1 : failed!");
+ }
+ if (expected[cnt++] != (byte)b) {
+ throw new RuntimeException("read() : failed!");
+ }
+ } else if (available == 0) {
+ if (is.read() != -1) {
+ throw new RuntimeException("available() == 0, read() != -1 : failed!");
+ }
+ break;
+ } else {
+ throw new RuntimeException("available() < 0 : failed!");
+ }
+ } while (true);
+ if (cnt != expected.length) {
+ throw new RuntimeException("read : failed!");
+ }
+ }
+
+}
\ No newline at end of file
--
2.19.1

View File

@ -72,7 +72,7 @@ index 151e5a109f..5072409dd4 100644
# Configure flags for the tools
FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 85eb8a16a2..86a533fe1f 100644
index 6f17436eff..aedd82e614 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -716,6 +716,9 @@ SET_EXECUTABLE_ORIGIN
@ -162,7 +162,7 @@ index 85eb8a16a2..86a533fe1f 100644
# Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
@@ -42436,6 +42467,47 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
@@ -42429,6 +42460,47 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
fi
@ -326,7 +326,7 @@ index f54942acf2..51cc28c312 100644
+AC_SUBST(HOST_NAME)
+])
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 9573bb2cbd..57a903229a 100644
index 9573bb2cbd..ad85aa346f 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -23,6 +23,12 @@
@ -352,7 +352,7 @@ index 9573bb2cbd..57a903229a 100644
+HOST_NAME:=@HOST_NAME@
+
+# Loongson OpenJDK Version info
+VER=8.1.19
+VER=8.1.20
+ifeq ($(HOST_NAME), )
+ HOST_NAME=unknown
+endif
@ -106551,7 +106551,7 @@ index 92b73e1c71..45da327efb 100644
bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
if (tmp->is_valid() && c > 0 && c < max_jint) {
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 54cfcdd116..c3d22ba5d3 100644
index 5629a640f6..68d5f514c0 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -22,6 +22,12 @@
@ -106588,8 +106588,8 @@ index 54cfcdd116..c3d22ba5d3 100644
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH
+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, __mips64, PARISC, M68K, AARCH64, LOONGARCH
- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH64
+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, __mips64, PARISC, M68K, AARCH64, LOONGARCH64
#endif
// Identify compatability class for VM's architecture and library's architecture
@ -112949,7 +112949,7 @@ index 7e22bbaa27..12aca7bf50 100644
# include "c1_MacroAssembler_aarch64.hpp"
#endif
diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
index aebc377527..f1253506f6 100644
index b2bff3809d..cfcdb43ddc 100644
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
@@ -22,6 +22,12 @@
@ -112965,7 +112965,7 @@ index aebc377527..f1253506f6 100644
#include "precompiled.hpp"
#include "asm/codeBuffer.hpp"
#include "c1/c1_CodeStubs.hpp"
@@ -710,6 +716,7 @@ JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread))
@@ -712,6 +718,7 @@ JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread))
// Return to the now deoptimized frame.
JRT_END
@ -112973,7 +112973,7 @@ index aebc377527..f1253506f6 100644
static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) {
Bytecode_field field_access(caller, bci);
@@ -1186,6 +1193,47 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
@@ -1188,6 +1195,47 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
}
JRT_END
@ -113985,7 +113985,7 @@ index 1dc7cb2983..92bbe6b440 100644
# include "interpreterGenerator_aarch64.hpp"
#endif
diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
index cad9d29008..85303e4b73 100644
index 425ad7f463..c428b91f5d 100644
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
@@ -22,6 +22,12 @@
@ -114001,7 +114001,7 @@ index cad9d29008..85303e4b73 100644
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
@@ -59,6 +65,12 @@
@@ -60,6 +66,12 @@
#ifdef TARGET_ARCH_x86
# include "vm_version_x86.hpp"
#endif
@ -114014,7 +114014,7 @@ index cad9d29008..85303e4b73 100644
#ifdef TARGET_ARCH_aarch64
# include "vm_version_aarch64.hpp"
#endif
@@ -1290,7 +1302,7 @@ IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Meth
@@ -1292,7 +1304,7 @@ IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Meth
// preparing the same method will be sure to see non-null entry & mirror.
IRT_END
@ -116029,7 +116029,7 @@ index 66392b75f1..5ced38d838 100644
} else {
base = os::reserve_memory(size, NULL, alignment);
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 32e3921b2b..c6cc4c4329 100644
index e0e9bcf7e9..3e4640e698 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -22,6 +22,12 @@

View File

@ -91,7 +91,7 @@ index 00000000..9b614024
--- /dev/null
+++ b/version.txt
@@ -0,0 +1 @@
+8.412.8.0.13
+8.432.8.0.13
--
2.23.0

View File

@ -90,14 +90,14 @@ index 54cfcdd1..88eb8acd 100644
#if (defined IA32)
@@ -2010,9 +2014,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
static Elf32_Half running_arch_code=EM_AARCH64;
#elif (defined LOONGARCH)
#elif (defined LOONGARCH64)
static Elf32_Half running_arch_code=EM_LOONGARCH;
+ #elif (defined RISCV)
+ static Elf32_Half running_arch_code=EM_RISCV;
#else
#error Method os::dll_load requires that one of following is defined:\
- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH
+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH, RISCV
- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH64
+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH64, RISCV
#endif
// Identify compatability class for VM's architecture and library's architecture

View File

@ -40,13 +40,13 @@ index 54e1bfa0d..c1423dc5b 100644
// The numbers of certs now.
- private static final int COUNT = 83;
+ private static final int COUNT = 104;
+ private static final int COUNT = 106;
// SHA-256 of cacerts, can be generated with
// shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
private static final String CHECKSUM
- = "2D:04:88:6C:52:53:54:EB:38:2D:BC:E0:AF:B7:82:F4:9E:32:A8:1A:1B:A3:AE:CF:25:CB:C2:F6:0F:4E:E1:20";
+ = "1C:10:89:F9:32:8C:05:D1:10:90:27:7F:66:21:28:71:79:8F:55:44:6C:08:BA:00:48:C0:D4:7A:0D:3B:9C:45";
+ = "73:5F:49:B0:EC:C0:E4:43:27:B1:5F:D1:9B:A7:8A:05:B4:25:84:A6:81:9F:FC:A7:A7:04:8F:86:82:97:FF:7C";
// map of cert alias to SHA-256 fingerprint
@SuppressWarnings("serial")

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,8 @@
%bcond_without slowdebug
# Enable release builds by default on relevant arches.
%bcond_without release
# Disable global LTO
%define _lto_cflags %{nil}
# The -g flag says to use strip -g instead of full strip on DSOs or EXEs.
# This fixes detailed NMT and other tools which need minimal debug info.
@ -132,6 +134,12 @@
%global stapinstall powerpc64le
%endif
# Need to support noarch for srpm build
%ifarch noarch
%global archinstall %{nil}
%global stapinstall %{nil}
%endif
%ifarch %{jit_arches}
%global with_systemtap 1
%else
@ -166,13 +174,13 @@
%global origin_nice OpenJDK
%global top_level_dir_name %{origin}
%global repo jdk8u
%global revision jdk8u422-b05
%global revision jdk8u432-b06
%global full_revision %{repo}-%{revision}
# Define IcedTea version used for SystemTap tapsets and desktop files
%global icedteaver 3.15.0
%global updatever 422
%global buildver b05
%global updatever 432
%global buildver b06
# priority must be 7 digits in total. The expression is workarounding tip
%global priority 1800%{updatever}
@ -613,7 +621,9 @@ exit 0
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libunpack.so
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libverify.so
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libzip.so
%ifnarch loongarch64
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libz.so
%endif
%{_jvmdir}/%{jredir -- %{?1}}/lib/charsets.jar
%{_jvmdir}/%{jredir -- %{?1}}/lib/classlist
%{_jvmdir}/%{jredir -- %{?1}}/lib/content-types.properties
@ -937,7 +947,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver}
Release: 6
Release: 0
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -1296,7 +1306,6 @@ Patch403: 8193682-Infinite-loop-in-ZipOutputStream.close.patch
Patch404: 8285516-clearPassword-should-be-called-in-a-finally-.patch
Patch405: 8148470-Metadata-print-routines-should-not-print-to-.patch
Patch406: 8293344-JDK-8242181-broke-stack-printing-for-non-att.patch
Patch407: 8278794-Infinite-loop-in-DeflaterOutputStream.finish.patch
Patch408: 8312065-Socket.connect-does-not-timeout-when-profili.patch
Patch409: Add-Problemlist.patch
Patch410: Fix-an-error-caused-by-anonymous-when-AppCDS-generat.patch
@ -1339,6 +1348,12 @@ Patch442: Huawei-Keep-objects-when-remove-unshareable-info.patch
Patch443: The-fast-serialization-function-of-sun.rmi.transport.patch
Patch445: Extending-the-IV-Length-Supported-by-KAEProvider-AES.patch
Patch446: 8137165-Tests-fail-in-SR_Handler-because-thread-is-n.patch
Patch447: heap-dump-redact-support.patch
Patch448: KAE-zip-support-streaming-data-decompression.patch
Patch449: Enhance-SIGBUS-and-rlimit-information-in-errlog.patch
#433
Patch450: Huawei-Fix-build-failures-due-to-wrap-in-x86.patch
#############################################
#
# Upstreamable patches
@ -1960,7 +1975,6 @@ pushd %{top_level_dir_name}
%patch404 -p1
%patch405 -p1
%patch406 -p1
%patch407 -p1
%patch408 -p1
%patch409 -p1
%patch410 -p1
@ -1989,7 +2003,9 @@ pushd %{top_level_dir_name}
%patch435 -p1
%patch436 -p1
%patch437 -p1
%ifnarch riscv64
%patch438 -p1
%endif
%patch439 -p1
%patch440 -p1
%patch441 -p1
@ -1997,6 +2013,10 @@ pushd %{top_level_dir_name}
%patch443 -p1
%patch445 -p1
%patch446 -p1
%patch447 -p1
%patch448 -p1
%patch449 -p1
%patch450 -p1
%endif
%ifarch loongarch64
@ -2131,18 +2151,16 @@ bash ${top_srcdir_abs_path}/configure \
--with-update-version=%{updatever} \
--with-build-number=%{buildver} \
%ifnarch loongarch64 ppc64le
--with-company-name="Bisheng" \
--with-vendor-name="Bisheng" \
--with-company-name="BiSheng" \
--with-vendor-name="BiSheng" \
%endif
--with-vendor-url="https://openeuler.org/" \
--with-vendor-bug-url="https://gitee.com/src-openeuler/openjdk-1.8.0/issues/" \
--with-vendor-vm-bug-url="https://gitee.com/src-openeuler/openjdk-1.8.0/issues/" \
--with-debug-level=$debugbuild \
--enable-unlimited-crypto \
%ifarch %{jit_arches}
%ifarch aarch64
--enable-kae \
%else
--disable-kae \
%endif
--with-stdc++lib=dynamic \
--with-extra-cflags="$EXTRA_CFLAGS" \
@ -2524,9 +2542,10 @@ end
-- run content of included file with fake args
arg = nil; -- it is better to null the arg up, no meter if they exists or not, and use cjc as module in unified way, instead of relaying on "main" method during require "copy_jdk_configs.lua"
cjc = require "copy_jdk_configs.lua"
arg = {"--currentjvm", "%{uniquesuffix %{nil}}", "--jvmdir", "%{_jvmdir %{nil}}", "--origname", "%{name}", "--origjavaver", "%{javaver}", "--arch", "%{_arch}", "--temp", "%{rpm_state_dir}/%{name}.%{_arch}"}
cjc.mainProgram(arg)
args = {"--currentjvm", "%{uniquesuffix %{nil}}", "--jvmdir", "%{_jvmdir %{nil}}", "--origname", "%{name}", "--origjavaver", "%{javaver}", "--arch", "%{_arch}", "--temp", "%{rpm_state_dir}/%{name}.%{_arch}"}
cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect this 'main', so it should run under all circumstances, except fatal error
%post
%{post_script %{nil}}
@ -2663,9 +2682,38 @@ cjc.mainProgram(arg)
%endif
%changelog
* Tue Aug 13 2024 wuyafang <wuyafang@huawei.com> -1:1.8.0.422-b05.6
* Thu Oct 17 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.432-b05.rolling
- modified 8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch
- modified 8193682-Infinite-loop-in-ZipOutputStream.close.patch
- modified 8313626-C2-crash-due-to-unexpected-exception-control.patch
- modified Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch
- modified GCC-12-reports-some-compiler-warnings.patch
- modified add-missing-test-case.patch
- modified fix_X509TrustManagerImpl_symantec_distrust.patch
- modified update-cacerts-and-VerifyCACerts.java-test.patch
- deleted 8278794-Infinite-loop-in-DeflaterOutputStream.finish.patch
* Fri Sep 6 2024 Benshuai5D <zhangyunbo7@huawei.com> -1:1.8.0.422-b05.11
- add Enhance-SIGBUS-and-rlimit-information-in-errlog.patch
* Wed Sep 4 2024 neu-mobi <liuyulong35@huawei.com> -1:1.8.0.422-b05.10
- Support KAE Zip
- rename Bisheng to BiSheng
* Mon Sep 2 2024 Dingli Zhang <dingli@iscas.ac.cn> -1:1.8.0.422-b05.9
- Fix build error on riscv64 because of patch438
* Thu Aug 29 2024 Dingli Zhang <dingli@iscas.ac.cn> -1:1.8.0.422-b05.8
- Fix build on riscv64 in prep stage for 8u422
* Tue Aug 20 2024 wuyafang <wuyafang@huawei.com> -1:1.8.0.422-b05.7
- modified add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch
* Wed Aug 7 2024 songliyang <songliyang@kylinos.cn> -1:1.8.0.422-b05.6
- let support-KAE-zip.patch not install libz.so on loongarch64
- update LoongArch64 port to 8u422
- fix changelog date error
* Tue Aug 6 2024 benshuai5D <zhangyunbo7@huawei.com> -1:1.8.0.422-b05.5
- modified add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch
@ -2952,10 +3000,10 @@ cjc.mainProgram(arg)
- 0054-Fix-jmap-heapdump-symbols-when-the-class-is-loaded-f.patch
- 0055-Fix-CodelistTest.java-Failed-to-Execute-CodelistTest.patch
* Fri May 11 2023 crash888 <wangmengqi13@huawei.com> - 1:1.8.0.372-b07.1
* Thu May 11 2023 crash888 <wangmengqi13@huawei.com> - 1:1.8.0.372-b07.1
- modified Fix-the-crash-that-occurs-when-the-process-exits-due.patch
* Fri May 6 2023 crash888 <wangmengqi13@huawei.com> - 1:1.8.0.372-b07.0
* Sat May 6 2023 crash888 <wangmengqi13@huawei.com> - 1:1.8.0.372-b07.0
- deleted Add-ability-to-configure-third-port-for-remote-JMX.patch
- deleted 8287109-Distrust-failed-with-CertificateExpired.patch
- deleted Huawei-fix-windows-build-Dynamic-CDS-failure.patch

View File

@ -257,13 +257,13 @@ index dd107fc..791ddb6 100644
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
- private static final int COUNT = 110;
- private static final int COUNT = 112;
+ private static final int COUNT = 83;
// SHA-256 of cacerts, can be generated with
// shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
private static final String CHECKSUM
- = "C1:68:B4:AC:51:BF:B5:C6:FD:20:69:17:E1:AF:E4:5B:01:9B:AA:3F:C3:9A:80:A8:51:53:74:2C:A2:04:B0:FF";
- = "8F:E0:6F:7F:21:59:33:A6:43:F3:48:FD:A3:4A:8E:28:35:AA:DD:6E:A5:43:56:F1:28:34:48:DF:5C:D2:7C:72";
+ = "2D:04:88:6C:52:53:54:EB:38:2D:BC:E0:AF:B7:82:F4:9E:32:A8:1A:1B:A3:AE:CF:25:CB:C2:F6:0F:4E:E1:20";
// map of cert alias to SHA-256 fingerprint