Compare commits
12 Commits
0dd34b3b32
...
9b37d1d280
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b37d1d280 | ||
|
|
93b474e05d | ||
|
|
74d2a00388 | ||
|
|
99ebffa26f | ||
|
|
34112cafe4 | ||
|
|
4959486b0f | ||
|
|
957997cd87 | ||
|
|
e71135fc9d | ||
|
|
f5aa9e33c2 | ||
|
|
c04c656e68 | ||
|
|
78398464fe | ||
|
|
dbbd692128 |
@ -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";
|
||||
@ -1957,9 +1950,9 @@ index 6413e155b..b59832f73 100644
|
||||
- * @bug 7152176 8168518
|
||||
+ * @bug 7152176 8168518 8014628
|
||||
* @summary More krb5 tests
|
||||
* @library ../../../../java/security/testlibrary/
|
||||
* @library ../../../../java/security/testlibrary/ /test/lib
|
||||
* @compile -XDignore.symbol.file ReplayCacheTestProc.java
|
||||
@@ -126,8 +126,13 @@ public class ReplayCacheTestProc {
|
||||
@@ -139,8 +139,13 @@ public class ReplayCacheTestProc {
|
||||
kdc.addPrincipalRandKey(service(i));
|
||||
}
|
||||
|
||||
@ -1971,9 +1964,9 @@ index 6413e155b..b59832f73 100644
|
||||
+ // Write KTAB after krb5.conf so it contains no aes-sha2 keys
|
||||
kdc.writeKtab(OneKDC.KTAB);
|
||||
- KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
|
||||
|
||||
// User-provided libs
|
||||
String userLibs = System.getProperty("test.libs");
|
||||
|
||||
pi = Proc.create("ReplayCacheTestProc").debug("C")
|
||||
.args("initiator")
|
||||
diff --git a/jdk/test/sun/security/krb5/etype/ETypeOrder.java b/jdk/test/sun/security/krb5/etype/ETypeOrder.java
|
||||
index 9437b16ed..be36d6372 100644
|
||||
--- a/jdk/test/sun/security/krb5/etype/ETypeOrder.java
|
||||
|
||||
@ -2,8 +2,8 @@ diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c
|
||||
index 3c1ea7280..b8d866786 100644
|
||||
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp
|
||||
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
|
||||
@@ -542,7 +542,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
|
||||
exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||
@@ -544,7 +544,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
|
||||
p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
- NOT_PRODUCT(Exceptions::debug_check_abort(exception));
|
||||
|
||||
47
8136926-phi-NULL-assert-in-PhaseIdealLoop-try_move_s.patch
Normal file
47
8136926-phi-NULL-assert-in-PhaseIdealLoop-try_move_s.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 6a7fbf19d775ab8fa710a8f4913468c50a948314 Mon Sep 17 00:00:00 2001
|
||||
Subject: 8136926: phi == NULL assert in PhaseIdealLoop::try_move_store_after_loop
|
||||
|
||||
---
|
||||
hotspot/src/share/vm/opto/loopopts.cpp | 8 +++++---
|
||||
.../test/compiler/loopopts/TestMoveStoresOutOfLoops.java | 2 +-
|
||||
2 files changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp
|
||||
index cacad2a1a..aa838c1de 100644
|
||||
--- a/hotspot/src/share/vm/opto/loopopts.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/loopopts.cpp
|
||||
@@ -822,13 +822,15 @@ void PhaseIdealLoop::try_move_store_after_loop(Node* n) {
|
||||
}
|
||||
if (u->is_Phi() && u->in(0) == n_loop->_head) {
|
||||
assert(_igvn.type(u) == Type::MEMORY, "bad phi");
|
||||
- assert(phi == NULL, "already found");
|
||||
+ // multiple phis on the same slice are possible
|
||||
+ if (phi != NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
phi = u;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- phi = NULL;
|
||||
- break;
|
||||
+ return;
|
||||
}
|
||||
if (phi != NULL) {
|
||||
// Nothing in the loop before the store (next iteration)
|
||||
diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
|
||||
index 4eea5d5e4..0ed9a2925 100644
|
||||
--- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
|
||||
+++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
|
||||
@@ -26,7 +26,7 @@
|
||||
* @test
|
||||
* @bug 8080289
|
||||
* @summary Sink stores out of loops if possible
|
||||
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+PrintCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test* TestMoveStoresOutOfLoops
|
||||
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test* TestMoveStoresOutOfLoops
|
||||
*
|
||||
*/
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
72
8137165-Tests-fail-in-SR_Handler-because-thread-is-n.patch
Normal file
72
8137165-Tests-fail-in-SR_Handler-because-thread-is-n.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From 11116ea71b22635302759817b43c555ded53f882 Mon Sep 17 00:00:00 2001
|
||||
Subject: 8137165: Tests fail in SR_Handler because thread is not VMThread or JavaThread
|
||||
|
||||
---
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
index 6ee49eedc..773c746af 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
@@ -1070,6 +1070,13 @@ void os::free_thread(OSThread* osthread) {
|
||||
assert(osthread != NULL, "osthread not set");
|
||||
|
||||
if (Thread::current()->osthread() == osthread) {
|
||||
+#ifdef ASSERT
|
||||
+ sigset_t current;
|
||||
+ sigemptyset(¤t);
|
||||
+ pthread_sigmask(SIG_SETMASK, NULL, ¤t);
|
||||
+ assert(!sigismember(¤t, SR_signum), "SR signal should not be blocked!");
|
||||
+#endif
|
||||
+
|
||||
// Restore caller's signal mask
|
||||
sigset_t sigmask = osthread->caller_sigmask();
|
||||
pthread_sigmask(SIG_SETMASK, &sigmask, NULL);
|
||||
@@ -4723,7 +4730,8 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
// after sigsuspend.
|
||||
int old_errno = errno;
|
||||
|
||||
- Thread* thread = Thread::current();
|
||||
+ Thread* thread = Thread::current_or_null();
|
||||
+ assert(thread != NULL, "Missing current thread in SR_handler");
|
||||
OSThread* osthread = thread->osthread();
|
||||
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
|
||||
|
||||
@@ -4735,7 +4743,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
os::SuspendResume::State state = osthread->sr.suspended();
|
||||
if (state == os::SuspendResume::SR_SUSPENDED) {
|
||||
sigset_t suspend_set; // signals for sigsuspend()
|
||||
-
|
||||
+ sigemptyset(&suspend_set);
|
||||
// get current set of blocked signals and unblock resume signal
|
||||
pthread_sigmask(SIG_BLOCK, NULL, &suspend_set);
|
||||
sigdelset(&suspend_set, SR_signum);
|
||||
@@ -5025,6 +5033,7 @@ static bool call_chained_handler(struct sigaction *actp, int sig,
|
||||
|
||||
// try to honor the signal mask
|
||||
sigset_t oset;
|
||||
+ sigemptyset(&oset);
|
||||
pthread_sigmask(SIG_SETMASK, &(actp->sa_mask), &oset);
|
||||
|
||||
// call into the chained handler
|
||||
@@ -5035,7 +5044,7 @@ static bool call_chained_handler(struct sigaction *actp, int sig,
|
||||
}
|
||||
|
||||
// restore the signal mask
|
||||
- pthread_sigmask(SIG_SETMASK, &oset, 0);
|
||||
+ pthread_sigmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
// Tell jvm's signal handler the signal is taken care of.
|
||||
return true;
|
||||
@@ -6699,6 +6708,7 @@ void Parker::park(bool isAbsolute, jlong time) {
|
||||
// Don't catch signals while blocked; let the running threads have the signals.
|
||||
// (This allows a debugger to break into the running thread.)
|
||||
sigset_t oldsigs;
|
||||
+ sigemptyset(&oldsigs);
|
||||
sigset_t* allowdebug_blocked = os::Linux::allowdebug_blocked_signals();
|
||||
pthread_sigmask(SIG_BLOCK, allowdebug_blocked, &oldsigs);
|
||||
#endif
|
||||
--
|
||||
2.19.1
|
||||
|
||||
226
8159461-8288556-getComponentType.patch
Normal file
226
8159461-8288556-getComponentType.patch
Normal file
@ -0,0 +1,226 @@
|
||||
From 372039cd8e13b946a93c56a98b019552e4944ee1 Mon Sep 17 00:00:00 2001
|
||||
Subject: 8159461-8288556-getComponentType
|
||||
|
||||
---
|
||||
hotspot/src/os/aix/vm/os_aix.cpp | 37 ++++++++++++++++++++---
|
||||
hotspot/src/os/bsd/vm/os_bsd.cpp | 38 ++++++++++++++++++++----
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 35 +++++++++++++++++++---
|
||||
hotspot/src/share/vm/opto/c2compiler.cpp | 1 +
|
||||
hotspot/src/share/vm/runtime/thread.cpp | 6 ++--
|
||||
5 files changed, 102 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
|
||||
index c6ccec8a8..f7520dedd 100644
|
||||
--- a/hotspot/src/os/aix/vm/os_aix.cpp
|
||||
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
|
||||
@@ -3066,7 +3066,8 @@ void os::hint_no_preempt() {}
|
||||
// - sets target osthread state to continue
|
||||
// - sends signal to end the sigsuspend loop in the SR_handler
|
||||
//
|
||||
-// Note that the SR_lock plays no role in this suspend/resume protocol.
|
||||
+// Note that the SR_lock plays no role in this suspend/resume protocol,
|
||||
+// but is checked for NULL in SR_handler as a thread termination indicator.
|
||||
//
|
||||
|
||||
static void resume_clear_context(OSThread *osthread) {
|
||||
@@ -3098,10 +3099,38 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
// after sigsuspend.
|
||||
int old_errno = errno;
|
||||
|
||||
- Thread* thread = Thread::current();
|
||||
- OSThread* osthread = thread->osthread();
|
||||
+ Thread* thread = Thread::current_or_null();
|
||||
+
|
||||
+ // The suspend/resume signal may have been sent from outside the process, deliberately or
|
||||
+ // accidentally. In that case the receiving thread may not be attached to the VM. We handle
|
||||
+ // that case by asserting (debug VM) resp. writing a diagnostic message to tty and
|
||||
+ // otherwise ignoring the stray signal (release VMs).
|
||||
+ // We print the siginfo as part of the diagnostics, which also contains the sender pid of
|
||||
+ // the stray signal.
|
||||
+ if (thread == NULL) {
|
||||
+ bufferedStream st;
|
||||
+ st.print_raw("Non-attached thread received stray SR signal (");
|
||||
+ os::Posix::print_siginfo_brief(&st, siginfo);
|
||||
+ st.print_raw(").");
|
||||
+ assert(thread != NULL, st.base());
|
||||
+ warning("%s", st.base());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // On some systems we have seen signal delivery get "stuck" until the signal
|
||||
+ // mask is changed as part of thread termination. Check that the current thread
|
||||
+ // has not already terminated (via SR_lock()) - else the following assertion
|
||||
+ // will fail because the thread is no longer a JavaThread as the ~JavaThread
|
||||
+ // destructor has completed.
|
||||
+
|
||||
+ if (thread->SR_lock() == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
|
||||
|
||||
+ OSThread* osthread = thread->osthread();
|
||||
+
|
||||
os::SuspendResume::State current = osthread->sr.state();
|
||||
if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
|
||||
suspend_save_context(osthread, siginfo, context);
|
||||
@@ -5299,4 +5328,4 @@ void TestReserveMemorySpecial_test() {
|
||||
// stubbed-out trim-native support
|
||||
bool os::can_trim_native_heap() { return false; }
|
||||
bool os::should_trim_native_heap() { return false; }
|
||||
-bool os::trim_native_heap(os::size_change_t* rss_change) { return false; }
|
||||
\ No newline at end of file
|
||||
+bool os::trim_native_heap(os::size_change_t* rss_change) { return false; }
|
||||
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
|
||||
index 7942c8545..223222602 100644
|
||||
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
|
||||
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
|
||||
@@ -2902,8 +2902,8 @@ void os::hint_no_preempt() {}
|
||||
// - sets target osthread state to continue
|
||||
// - sends signal to end the sigsuspend loop in the SR_handler
|
||||
//
|
||||
-// Note that the SR_lock plays no role in this suspend/resume protocol.
|
||||
-//
|
||||
+// Note that the SR_lock plays no role in this suspend/resume protocol,
|
||||
+// but is checked for NULL in SR_handler as a thread termination indicator.
|
||||
|
||||
static void resume_clear_context(OSThread *osthread) {
|
||||
osthread->set_ucontext(NULL);
|
||||
@@ -2934,10 +2934,38 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
// after sigsuspend.
|
||||
int old_errno = errno;
|
||||
|
||||
- Thread* thread = Thread::current();
|
||||
- OSThread* osthread = thread->osthread();
|
||||
+ Thread* thread = Thread::current_or_null();
|
||||
+
|
||||
+ // The suspend/resume signal may have been sent from outside the process, deliberately or
|
||||
+ // accidentally. In that case the receiving thread may not be attached to the VM. We handle
|
||||
+ // that case by asserting (debug VM) resp. writing a diagnostic message to tty and
|
||||
+ // otherwise ignoring the stray signal (release VMs).
|
||||
+ // We print the siginfo as part of the diagnostics, which also contains the sender pid of
|
||||
+ // the stray signal.
|
||||
+ if (thread == NULL) {
|
||||
+ bufferedStream st;
|
||||
+ st.print_raw("Non-attached thread received stray SR signal (");
|
||||
+ os::Posix::print_siginfo_brief(&st, siginfo);
|
||||
+ st.print_raw(").");
|
||||
+ assert(thread != NULL, st.base());
|
||||
+ warning("%s", st.base());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // On some systems we have seen signal delivery get "stuck" until the signal
|
||||
+ // mask is changed as part of thread termination. Check that the current thread
|
||||
+ // has not already terminated (via SR_lock()) - else the following assertion
|
||||
+ // will fail because the thread is no longer a JavaThread as the ~JavaThread
|
||||
+ // destructor has completed.
|
||||
+
|
||||
+ if (thread->SR_lock() == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
|
||||
|
||||
+ OSThread* osthread = thread->osthread();
|
||||
+
|
||||
os::SuspendResume::State current = osthread->sr.state();
|
||||
if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
|
||||
suspend_save_context(osthread, siginfo, context);
|
||||
@@ -4911,4 +4939,4 @@ void TestReserveMemorySpecial_test() {
|
||||
// stubbed-out trim-native support
|
||||
bool os::can_trim_native_heap() { return false; }
|
||||
bool os::should_trim_native_heap() { return false; }
|
||||
-bool os::trim_native_heap(os::size_change_t* rss_change) { return false; }
|
||||
\ No newline at end of file
|
||||
+bool os::trim_native_heap(os::size_change_t* rss_change) { return false; }
|
||||
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
index 8d846b57b..ec4222d42 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
@@ -4698,8 +4698,8 @@ void os::hint_no_preempt() {}
|
||||
// - sets target osthread state to continue
|
||||
// - sends signal to end the sigsuspend loop in the SR_handler
|
||||
//
|
||||
-// Note that the SR_lock plays no role in this suspend/resume protocol.
|
||||
-//
|
||||
+// Note that the SR_lock plays no role in this suspend/resume protocol,
|
||||
+// but is checked for NULL in SR_handler as a thread termination indicator.
|
||||
|
||||
static void resume_clear_context(OSThread *osthread) {
|
||||
osthread->set_ucontext(NULL);
|
||||
@@ -4731,10 +4731,37 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
int old_errno = errno;
|
||||
|
||||
Thread* thread = Thread::current_or_null();
|
||||
- assert(thread != NULL, "Missing current thread in SR_handler");
|
||||
- OSThread* osthread = thread->osthread();
|
||||
+
|
||||
+ // The suspend/resume signal may have been sent from outside the process, deliberately or
|
||||
+ // accidentally. In that case the receiving thread may not be attached to the VM. We handle
|
||||
+ // that case by asserting (debug VM) resp. writing a diagnostic message to tty and
|
||||
+ // otherwise ignoring the stray signal (release VMs).
|
||||
+ // We print the siginfo as part of the diagnostics, which also contains the sender pid of
|
||||
+ // the stray signal.
|
||||
+ if (thread == NULL) {
|
||||
+ bufferedStream st;
|
||||
+ st.print_raw("Non-attached thread received stray SR signal (");
|
||||
+ os::Posix::print_siginfo_brief(&st, siginfo);
|
||||
+ st.print_raw(").");
|
||||
+ assert(thread != NULL, st.base());
|
||||
+ warning("%s", st.base());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // On some systems we have seen signal delivery get "stuck" until the signal
|
||||
+ // mask is changed as part of thread termination. Check that the current thread
|
||||
+ // has not already terminated (via SR_lock()) - else the following assertion
|
||||
+ // will fail because the thread is no longer a JavaThread as the ~JavaThread
|
||||
+ // destructor has completed.
|
||||
+
|
||||
+ if (thread->SR_lock() == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
|
||||
|
||||
+ OSThread* osthread = thread->osthread();
|
||||
+
|
||||
os::SuspendResume::State current = osthread->sr.state();
|
||||
if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
|
||||
suspend_save_context(osthread, siginfo, context);
|
||||
diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp
|
||||
index d2485ddfc..8fdbb93f1 100644
|
||||
--- a/hotspot/src/share/vm/opto/c2compiler.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp
|
||||
@@ -435,6 +435,7 @@ bool C2Compiler::is_intrinsic_supported(methodHandle method, bool is_virtual) {
|
||||
case vmIntrinsics::_dgemm_dgemm:
|
||||
case vmIntrinsics::_dgemv_dgemv:
|
||||
case vmIntrinsics::_f2jblas_ddot:
|
||||
+ case vmIntrinsics::_getComponentType:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
|
||||
index 95dbb77fb..a5758734b 100644
|
||||
--- a/hotspot/src/share/vm/runtime/thread.cpp
|
||||
+++ b/hotspot/src/share/vm/runtime/thread.cpp
|
||||
@@ -380,11 +380,13 @@ Thread::~Thread() {
|
||||
delete handle_area();
|
||||
delete metadata_handles();
|
||||
|
||||
+ // SR_handler uses this as a termination indicator -
|
||||
+ delete _SR_lock;
|
||||
+ _SR_lock = NULL;
|
||||
+
|
||||
// osthread() can be NULL, if creation of thread failed.
|
||||
if (osthread() != NULL) os::free_thread(osthread());
|
||||
|
||||
- delete _SR_lock;
|
||||
-
|
||||
// clear thread local storage if the Thread is deleting itself
|
||||
if (this == Thread::current()) {
|
||||
ThreadLocalStorage::set_thread(NULL);
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
From 6456acbb0412f0a0f3e7374b27e66a504ece36ff Mon Sep 17 00:00:00 2001
|
||||
From: c00229008 <chenshanyao@huawei.com>
|
||||
Date: Wed, 4 Aug 2021 09:43:49 +0800
|
||||
Subject: [PATCH 01/23] 8167014: jdeps failed with "Missing message:
|
||||
warn.skipped.entry"
|
||||
|
||||
Summary: <langtools>: jdeps failed with "Missing message: warn.skipped.entry"
|
||||
LLT: tomcat-websocket-10.0.8.jar
|
||||
Patch Type: backport
|
||||
Bug url: https://bugs.openjdk.java.net/browse/JDK-8167014
|
||||
---
|
||||
.../share/classes/com/sun/tools/jdeps/ClassFileReader.java | 5 ++++-
|
||||
.../src/share/classes/com/sun/tools/jdeps/JdepsTask.java | 6 ++++--
|
||||
.../classes/com/sun/tools/jdeps/resources/jdeps.properties | 1 +
|
||||
3 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
|
||||
index f41f2d0ba..07da40357 100644
|
||||
--- a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
|
||||
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
|
||||
@@ -337,7 +337,10 @@ public class ClassFileReader {
|
||||
cf = reader.readClassFile(jf, nextEntry);
|
||||
return true;
|
||||
} catch (ClassFileError | IOException ex) {
|
||||
- skippedEntries.add(nextEntry.getName());
|
||||
+ skippedEntries.add(String.format("%s: %s (%s)",
|
||||
+ ex.getMessage(),
|
||||
+ nextEntry.getName(),
|
||||
+ jf.getName()));
|
||||
}
|
||||
nextEntry = nextEntry();
|
||||
}
|
||||
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java
|
||||
index 91002d319..97dba138e 100644
|
||||
--- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java
|
||||
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java
|
||||
@@ -559,8 +559,10 @@ class JdepsTask {
|
||||
a.addClass(d.getOrigin());
|
||||
}
|
||||
}
|
||||
- for (String name : a.reader().skippedEntries()) {
|
||||
- warning("warn.skipped.entry", name, a.getPathName());
|
||||
+ if (!options.nowarning) {
|
||||
+ for (String name : a.reader().skippedEntries()) {
|
||||
+ warning("warn.skipped.entry", name, a.getPathName());
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties b/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
|
||||
index 51d11b88a..501c4d6cd 100644
|
||||
--- a/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
|
||||
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
|
||||
@@ -92,6 +92,7 @@ err.option.unsupported={0} not supported: {1}
|
||||
err.profiles.msg=No profile information
|
||||
err.invalid.path=invalid path: {0}
|
||||
warn.invalid.arg=Invalid classname or pathname not exist: {0}
|
||||
+warn.skipped.entry={0}
|
||||
warn.split.package=package {0} defined in {1} {2}
|
||||
warn.replace.useJDKInternals=\
|
||||
JDK internal APIs are unsupported and private to JDK implementation that are\n\
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
From da7a2005a2c181737b163f60dd705acc00002463 Mon Sep 17 00:00:00 2001
|
||||
From: hedongbo <hedongbo@huawei.com>
|
||||
Date: Thu, 5 Jan 2023 10:22:15 +0000
|
||||
Subject: 8185736: missing default exception handler in calls to
|
||||
rethrow_Stub
|
||||
|
||||
---
|
||||
hotspot/src/share/vm/opto/doCall.cpp | 9 +++++++++
|
||||
hotspot/src/share/vm/opto/output.cpp | 1 +
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
|
||||
index 366769356..1b2b77c71 100644
|
||||
--- a/hotspot/src/share/vm/opto/doCall.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/doCall.cpp
|
||||
@@ -702,6 +702,7 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
|
||||
GrowableArray<const Type*>* extypes = new (C->node_arena()) GrowableArray<const Type*>(C->node_arena(), 8, 0, NULL);
|
||||
GrowableArray<int>* saw_unloaded = new (C->node_arena()) GrowableArray<int>(C->node_arena(), 8, 0, 0);
|
||||
|
||||
+ bool default_handler = false;
|
||||
for (; !handlers.is_done(); handlers.next()) {
|
||||
ciExceptionHandler* h = handlers.handler();
|
||||
int h_bci = h->handler_bci();
|
||||
@@ -724,6 +725,14 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
|
||||
// Note: It's OK if the BCIs repeat themselves.
|
||||
bcis->append(h_bci);
|
||||
extypes->append(h_extype);
|
||||
+ if (h_bci == -1) {
|
||||
+ default_handler = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!default_handler) {
|
||||
+ bcis->append(-1);
|
||||
+ extypes->append(TypeOopPtr::make_from_klass(env()->Throwable_klass())->is_instptr());
|
||||
}
|
||||
|
||||
int len = bcis->length();
|
||||
diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp
|
||||
index 5c9566e1e..6032b72a9 100644
|
||||
--- a/hotspot/src/share/vm/opto/output.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/output.cpp
|
||||
@@ -1761,6 +1761,7 @@ void Compile::FillExceptionTables(uint cnt, uint *call_returns, uint *inct_start
|
||||
}
|
||||
|
||||
// Set the offset of the return from the call
|
||||
+ assert(handler_bcis.find(-1) != -1, "must have default handler");
|
||||
_handler_table.add_subtable(call_return, &handler_bcis, NULL, &handler_pcos);
|
||||
continue;
|
||||
}
|
||||
--
|
||||
2.12.3
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
23
8253072-XERCES-version-is-displayed-incorrect.patch
Normal file
23
8253072-XERCES-version-is-displayed-incorrect.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From 65ed72e0f53dbadc8f79150c078eeb27f7184382 Mon Sep 17 00:00:00 2001
|
||||
Subject: 8253072: XERCES version is displayed incorrect
|
||||
|
||||
---
|
||||
jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java
|
||||
index 41a2b620b..cb3408a31 100644
|
||||
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java
|
||||
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java
|
||||
@@ -75,7 +75,7 @@ public class Version {
|
||||
* @deprecated getVersion() should be used instead. */
|
||||
public static final String fVersion = getVersion();
|
||||
|
||||
- private static final String fImmutableVersion = "Xerces-J 2.7.1";
|
||||
+ private static final String fImmutableVersion = "Xerces-J 2.10.0";
|
||||
|
||||
// public methods
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
diff --git a/jdk/src/share/instrument/InvocationAdapter.c b/jdk/src/share/instrument/InvocationAdapter.c
|
||||
index 5aa189b0..b06cf5cb 100644
|
||||
--- a/jdk/src/share/instrument/InvocationAdapter.c
|
||||
+++ b/jdk/src/share/instrument/InvocationAdapter.c
|
||||
@@ -829,6 +829,7 @@ appendBootClassPath( JPLISAgent* agent,
|
||||
|
||||
resolved = resolve(parent, path);
|
||||
jvmtierr = (*jvmtienv)->AddToBootstrapClassLoaderSearch(jvmtienv, resolved);
|
||||
+ free(resolved);
|
||||
}
|
||||
|
||||
/* print warning if boot class path not updated */
|
||||
25
8269934-RunThese24H.java-failed-with-EXCEPTION_ACCES.patch
Normal file
25
8269934-RunThese24H.java-failed-with-EXCEPTION_ACCES.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 40dbc47814533cbe0f9db99e4a848e503b87f476 Mon Sep 17 00:00:00 2001
|
||||
Subject: 8269934: RunThese24H.java failed with EXCEPTION_ACCESS_VIOLATION in java_lang_Thread::get_thread_status
|
||||
|
||||
---
|
||||
hotspot/src/share/vm/services/threadService.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/services/threadService.cpp b/hotspot/src/share/vm/services/threadService.cpp
|
||||
index 3bfd6b538..b290ad548 100644
|
||||
--- a/hotspot/src/share/vm/services/threadService.cpp
|
||||
+++ b/hotspot/src/share/vm/services/threadService.cpp
|
||||
@@ -791,7 +791,9 @@ ThreadSnapshot::ThreadSnapshot(JavaThread* thread) {
|
||||
_blocker_object = NULL;
|
||||
_blocker_object_owner = NULL;
|
||||
|
||||
- _thread_status = java_lang_Thread::get_thread_status(_threadObj);
|
||||
+ // If thread is still attaching then threadObj will be NULL.
|
||||
+ _thread_status = _threadObj == NULL ? java_lang_Thread::NEW
|
||||
+ : java_lang_Thread::get_thread_status(_threadObj);
|
||||
_is_ext_suspended = thread->is_being_ext_suspended();
|
||||
_is_in_native = (thread->thread_state() == _thread_in_native);
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -0,0 +1,168 @@
|
||||
From b9649e772450f25e3c5d47ce1a15b3e1afa12017 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 17 Apr 2024 10:43:54 +0000
|
||||
Subject: [PATCH] [Backport]6956385: URLConnection.getLastModified() leaks file handles
|
||||
for jar:file and file: URLs
|
||||
---
|
||||
.../www/protocol/file/FileURLConnection.java | 6 ++
|
||||
.../www/protocol/jar/JarURLConnection.java | 13 ++-
|
||||
.../protocol/jar/FileURLConnectionLeak.java | 100 ++++++++++++++++++
|
||||
3 files changed, 117 insertions(+), 2 deletions(-)
|
||||
create mode 100644 jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java
|
||||
|
||||
diff --git a/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java
|
||||
index 1997cb08c..16f404988 100644
|
||||
--- a/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java
|
||||
+++ b/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java
|
||||
@@ -103,6 +103,12 @@ public class FileURLConnection extends URLConnection {
|
||||
}
|
||||
}
|
||||
|
||||
+ public synchronized void closeInputStream() throws IOException {
|
||||
+ if (is != null) {
|
||||
+ is.close();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private boolean initializedHeaders = false;
|
||||
|
||||
private void initializeHeaders() {
|
||||
diff --git a/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
|
||||
index d7c442442..f1757da78 100644
|
||||
--- a/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
|
||||
+++ b/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package sun.net.www.protocol.jar;
|
||||
|
||||
+import sun.net.www.protocol.file.FileURLConnection;
|
||||
+
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -107,8 +109,15 @@ public class JarURLConnection extends java.net.JarURLConnection {
|
||||
try {
|
||||
super.close();
|
||||
} finally {
|
||||
- if (!getUseCaches()) {
|
||||
- jarFile.close();
|
||||
+ try {
|
||||
+ if (!getUseCaches()) {
|
||||
+ jarFile.close();
|
||||
+ }
|
||||
+ } finally {
|
||||
+ if (jarFileURLConnection instanceof FileURLConnection) {
|
||||
+ FileURLConnection fileURLConnection = (FileURLConnection) jarFileURLConnection;
|
||||
+ fileURLConnection.closeInputStream();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java b/jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java
|
||||
new file mode 100644
|
||||
index 000000000..4a5f9d7e2
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java
|
||||
@@ -0,0 +1,100 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 6956385
|
||||
+ * @summary JarURLConnection may fail to close its underlying FileURLConnection
|
||||
+ * @run main/othervm FileURLConnectionLeak
|
||||
+ */
|
||||
+
|
||||
+import java.io.InputStream;
|
||||
+import java.io.OutputStream;
|
||||
+import java.lang.management.ManagementFactory;
|
||||
+import java.lang.management.RuntimeMXBean;
|
||||
+import java.net.URI;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLConnection;
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import java.nio.file.Paths;
|
||||
+import java.util.jar.Attributes;
|
||||
+import java.util.jar.JarOutputStream;
|
||||
+import java.util.jar.Manifest;
|
||||
+
|
||||
+public class FileURLConnectionLeak {
|
||||
+ public static void main(String[] args) throws Exception {
|
||||
+ Path jar = Paths.get("x.jar").toAbsolutePath();
|
||||
+ Manifest mani = new Manifest();
|
||||
+ mani.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
||||
+ try (OutputStream os = Files.newOutputStream(jar); OutputStream jos = new JarOutputStream(os, mani)) {}
|
||||
+ URL u = URI.create("jar:" + jar.toUri() + "!/META-INF/MANIFEST.MF").toURL();
|
||||
+ URLConnection urlConnection = u.openConnection();
|
||||
+ urlConnection.setDefaultUseCaches(false);
|
||||
+ // FileURLConnection.is not used, so was always fine:
|
||||
+ try (InputStream is = u.openStream()) {
|
||||
+ byte[] buffer = new byte[1024];
|
||||
+ int bytesRead;
|
||||
+ while ((bytesRead = is.read(buffer)) != -1) {
|
||||
+ System.out.write(buffer, 0, bytesRead);
|
||||
+ }
|
||||
+ }
|
||||
+ // FileURLConnection.is opened implicitly:
|
||||
+ URLConnection conn = u.openConnection();
|
||||
+ conn.getLastModified();
|
||||
+ // Idiom to close URLConnection (cf. JDK-8224095), which must also close the other stream:
|
||||
+ conn.getInputStream().close();
|
||||
+ Path fds = Paths.get("/proc/" + getPid() + "/fd");
|
||||
+ if (Files.isDirectory(fds)) {
|
||||
+ // Linux: verify that x.jar is not open
|
||||
+ for (Path fd : (Iterable<Path>) Files.list(fds)::iterator) {
|
||||
+ if (Files.isSymbolicLink(fd)) {
|
||||
+ Path file = Files.readSymbolicLink(fd);
|
||||
+ if (file.equals(jar)) {
|
||||
+ throw new IllegalStateException("Still held open " + jar + " from " + fd);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Windows: verify that mandatory file locks do not prevent deletion
|
||||
+ Files.delete(jar);
|
||||
+ }
|
||||
+
|
||||
+ private static int getPid() {
|
||||
+ try {
|
||||
+ // get runtime MXBean
|
||||
+ RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
|
||||
+ // get pid
|
||||
+ String name = runtime.getName();
|
||||
+ int index = name.indexOf('@');
|
||||
+ if (index != -1) {
|
||||
+ return Integer.parseInt(name.substring(0, index));
|
||||
+ }
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,169 @@
|
||||
From 8f3c271e9d34a1105f069fb9d3081c72e1c48180 Mon Sep 17 00:00:00 2001
|
||||
Date: Tue, 28 May 2024 02:31:27 +0000
|
||||
Subject: [PATCH] [Backport]7036144:GZIPInputStream readTrailer uses faulty available()
|
||||
test for end-of-stream
|
||||
---
|
||||
.../java/util/zip/GZIPInputStream.java | 24 ++--
|
||||
.../zip/GZIP/GZIPInputStreamAvailable.java | 112 ++++++++++++++++++
|
||||
2 files changed, 121 insertions(+), 15 deletions(-)
|
||||
create mode 100644 jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
index b3d9240ba..0d57e8ab3 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
@@ -224,23 +224,17 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
(readUInt(in) != (inf.getBytesWritten() & 0xffffffffL)))
|
||||
throw new ZipException("Corrupt GZIP trailer");
|
||||
|
||||
- // If there are more bytes available in "in" or
|
||||
- // the leftover in the "inf" is > 26 bytes:
|
||||
- // this.trailer(8) + next.header.min(10) + next.trailer(8)
|
||||
// try concatenated case
|
||||
- if (this.in.available() > 0 || n > 26) {
|
||||
- int m = 8; // this.trailer
|
||||
- try {
|
||||
- m += readHeader(in); // next.header
|
||||
- } catch (IOException ze) {
|
||||
- return true; // ignore any malformed, do nothing
|
||||
- }
|
||||
- inf.reset();
|
||||
- if (n > m)
|
||||
- inf.setInput(buf, len - n + m, n - m);
|
||||
- return false;
|
||||
+ int m = 8; // this.trailer
|
||||
+ try {
|
||||
+ m += readHeader(in); // next.header
|
||||
+ } catch (IOException ze) {
|
||||
+ return true; // ignore any malformed, do nothing
|
||||
}
|
||||
- return true;
|
||||
+ inf.reset();
|
||||
+ if (n > m)
|
||||
+ inf.setInput(buf, len - n + m, n - m);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java b/jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java
|
||||
new file mode 100644
|
||||
index 000000000..265050b17
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java
|
||||
@@ -0,0 +1,112 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+/* @test
|
||||
+ * @bug 7036144
|
||||
+ * @summary Test concatenated gz streams when available() returns zero
|
||||
+ */
|
||||
+
|
||||
+import java.io.*;
|
||||
+import java.util.*;
|
||||
+import java.util.zip.*;
|
||||
+
|
||||
+public class GZIPInputStreamAvailable {
|
||||
+
|
||||
+ public static final int NUM_COPIES = 100;
|
||||
+ public static void main(String[] args) throws Throwable {
|
||||
+ testZeroAvailable();
|
||||
+ }
|
||||
+
|
||||
+ public static void testZeroAvailable() throws IOException {
|
||||
+
|
||||
+ // Create some uncompressed data and then repeat it NUM_COPIES times
|
||||
+ byte[] uncompressed1 = "this is a test".getBytes("ASCII");
|
||||
+ byte[] uncompressedN = repeat(uncompressed1, NUM_COPIES);
|
||||
+
|
||||
+ // Compress the original data and then repeat that NUM_COPIES times
|
||||
+ byte[] compressed1 = deflate(uncompressed1);
|
||||
+ byte[] compressedN = repeat(compressed1, NUM_COPIES);
|
||||
+
|
||||
+ // (a) Read back inflated data from a stream where available() is accurate and verify
|
||||
+ byte[] readback1 = inflate(new ByteArrayInputStream(compressedN), uncompressedN.length);
|
||||
+ assertArrayEquals(uncompressedN, readback1);
|
||||
+
|
||||
+ // (b) Read back inflated data from a stream where available() always returns zero and verify
|
||||
+ byte[] readback2 = inflate(new ZeroAvailableStream(new ByteArrayInputStream(compressedN)), uncompressedN.length);
|
||||
+ assertArrayEquals(uncompressedN, readback2);
|
||||
+ }
|
||||
+
|
||||
+ public static byte[] repeat(byte[] data, int count) {
|
||||
+ byte[] repeat = new byte[data.length * count];
|
||||
+ int off = 0;
|
||||
+ for (int i = 0; i < count; i++) {
|
||||
+ System.arraycopy(data, 0, repeat, off, data.length);
|
||||
+ off += data.length;
|
||||
+ }
|
||||
+ return repeat;
|
||||
+ }
|
||||
+
|
||||
+ public static byte[] deflate(byte[] data) throws IOException {
|
||||
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||
+ try (GZIPOutputStream out = new GZIPOutputStream(buf)) {
|
||||
+ out.write(data);
|
||||
+ }
|
||||
+ return buf.toByteArray();
|
||||
+ }
|
||||
+
|
||||
+ public static byte[] inflate(InputStream in, int bufferLen) throws IOException {
|
||||
+ GZIPInputStream gzipInputStream = new GZIPInputStream(in);
|
||||
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
+ byte[] buffer = new byte[bufferLen];
|
||||
+ int len;
|
||||
+ while ((len = gzipInputStream.read(buffer)) != -1) {
|
||||
+ bos.write(buffer, 0, len);
|
||||
+ }
|
||||
+ gzipInputStream.close();
|
||||
+ bos.close();
|
||||
+ return bos.toByteArray();
|
||||
+ }
|
||||
+
|
||||
+ public static class ZeroAvailableStream extends FilterInputStream {
|
||||
+ public ZeroAvailableStream(InputStream in) {
|
||||
+ super(in);
|
||||
+ }
|
||||
+ @Override
|
||||
+ public int available() {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void assertArrayEquals(byte[] arr1, byte[] arr2) {
|
||||
+ if (arr1 == null && arr2 == null) return;
|
||||
+ if (arr1 != null && arr2 != null && arr1.length == arr2.length) {
|
||||
+ for (int i = 0; i < arr1.length; i++) {
|
||||
+ if (arr1[i] != arr2[i]) {
|
||||
+ throw new AssertionError(Arrays.toString(arr1) + " != " + Arrays.toString(arr2));
|
||||
+ }
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ throw new AssertionError(Arrays.toString(arr1) + " != " + Arrays.toString(arr2));
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.23.0
|
||||
|
||||
26
Backport-8057910-G1-BOT-verification-should-not-pass.patch
Normal file
26
Backport-8057910-G1-BOT-verification-should-not-pass.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 07dabe012b6e9cddd9fef59551bc3d6f6962bbf7 Mon Sep 17 00:00:00 2001
|
||||
Subject: Backport-8057910: G1: BOT verification should not pass
|
||||
top
|
||||
|
||||
---
|
||||
.../src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp
|
||||
index b908e8faf..b0b891d85 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp
|
||||
@@ -371,8 +371,9 @@ void G1BlockOffsetArray::alloc_block_work2(HeapWord** threshold_, size_t* index_
|
||||
}
|
||||
|
||||
void G1BlockOffsetArray::verify() const {
|
||||
+ assert(gsp()->bottom() < gsp()->top(), "Only non-empty regions should be verified.");
|
||||
size_t start_card = _array->index_for(gsp()->bottom());
|
||||
- size_t end_card = _array->index_for(gsp()->top());
|
||||
+ size_t end_card = _array->index_for(gsp()->top() - 1);
|
||||
|
||||
for (size_t current_card = start_card; current_card < end_card; current_card++) {
|
||||
u_char entry = _array->offset_array(current_card);
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
From 7af1eca9cf66942bf9e54a582f3046ae9b96a8eb Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 23 May 2024 11:28:10 +0800
|
||||
Subject: [PATCH] [Backport]8068864: C2 failed: modified node is not on
|
||||
IGVN._worklist
|
||||
---
|
||||
hotspot/src/share/vm/opto/loopTransform.cpp | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
|
||||
index 414edc26b..0aca095ce 100644
|
||||
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
|
||||
@@ -2006,10 +2006,9 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
|
||||
}
|
||||
Node *main_cmp = main_bol->in(1);
|
||||
if( main_cmp->outcnt() > 1 ) { // CmpNode shared?
|
||||
- _igvn.hash_delete(main_bol);
|
||||
main_cmp = main_cmp->clone();// Clone a private CmpNode
|
||||
register_new_node( main_cmp, main_cle->in(0) );
|
||||
- main_bol->set_req(1,main_cmp);
|
||||
+ _igvn.replace_input_of(main_bol, 1, main_cmp);
|
||||
}
|
||||
// Hack the now-private loop bounds
|
||||
_igvn.replace_input_of(main_cmp, 2, main_limit);
|
||||
--
|
||||
2.19.1
|
||||
|
||||
8916
Backport-8069330-and-adapt-G1GC-related-optimization.patch
Normal file
8916
Backport-8069330-and-adapt-G1GC-related-optimization.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,39 @@
|
||||
From 005d0a4e518c2f41aa1d5fc76110214001532df8 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 29 May 2024 14:52:13 +0800
|
||||
Subject: [PATCH] [Backport]8151845: Comment in globals.hpp for MetaspaceSize is
|
||||
incorrect.
|
||||
---
|
||||
hotspot/src/share/vm/memory/metaspace.cpp | 2 +-
|
||||
hotspot/src/share/vm/runtime/globals.hpp | 3 ++-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
|
||||
index d08bfba84..1df9eb606 100644
|
||||
--- a/hotspot/src/share/vm/memory/metaspace.cpp
|
||||
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
|
||||
@@ -2599,7 +2599,7 @@ void MetaspaceGC::compute_new_size() {
|
||||
if (PrintGCDetails && Verbose) {
|
||||
gclog_or_tty->print_cr(" "
|
||||
" shrinking:"
|
||||
- " initSize: %.1fK"
|
||||
+ " initThreshold: %.1fK"
|
||||
" maximum_desired_capacity: %.1fK",
|
||||
MetaspaceSize / (double) K,
|
||||
maximum_desired_capacity / (double) K);
|
||||
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
index 6aa53d2d2..f3daa12a6 100644
|
||||
--- a/hotspot/src/share/vm/runtime/globals.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
@@ -3332,7 +3332,8 @@ class CommandLineFlags {
|
||||
"non-daemon thread (in bytes)") \
|
||||
\
|
||||
product_pd(uintx, MetaspaceSize, \
|
||||
- "Initial size of Metaspaces (in bytes)") \
|
||||
+ "Initial threshold (in bytes) at which a garbage collection " \
|
||||
+ "is done to reduce Metaspace usage") \
|
||||
\
|
||||
product(uintx, MaxMetaspaceSize, max_uintx, \
|
||||
"Maximum size of Metaspaces (in bytes)") \
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,305 @@
|
||||
From 50df8472137e95ff6f64fe4136bbad64db8b46e7 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 27 May 2024 15:12:37 +0800
|
||||
Subject: [PATCH] 8209362: sun/security/ssl/SSLSocketImpl/ReuseAddr.java failed
|
||||
due to "BindException: Address already in use (Bind failed)"
|
||||
---
|
||||
.../net/ssl/templates/SSLSocketTemplate.java | 6 +-
|
||||
.../security/ssl/SSLSocketImpl/ReuseAddr.java | 237 ++----------------
|
||||
2 files changed, 17 insertions(+), 226 deletions(-)
|
||||
|
||||
diff --git a/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java b/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java
|
||||
index 9e09a0e35..e62f57eba 100644
|
||||
--- a/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java
|
||||
+++ b/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java
|
||||
@@ -224,12 +224,12 @@ public class SSLSocketTemplate {
|
||||
/*
|
||||
* What's the server port? Use any free port by default
|
||||
*/
|
||||
- private volatile int serverPort = 0;
|
||||
+ protected volatile int serverPort = 0;
|
||||
|
||||
/*
|
||||
* Define the server side of the test.
|
||||
*/
|
||||
- private void doServerSide() throws Exception {
|
||||
+ protected void doServerSide() throws Exception {
|
||||
// kick start the server side service
|
||||
SSLContext context = createServerSSLContext();
|
||||
SSLServerSocketFactory sslssf = context.getServerSocketFactory();
|
||||
@@ -290,7 +290,7 @@ public class SSLSocketTemplate {
|
||||
/*
|
||||
* Define the client side of the test.
|
||||
*/
|
||||
- private void doClientSide() throws Exception {
|
||||
+ protected void doClientSide() throws Exception {
|
||||
|
||||
// Wait for server to get started.
|
||||
//
|
||||
diff --git a/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java b/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java
|
||||
index 650c30988..abad01099 100644
|
||||
--- a/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java
|
||||
+++ b/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2001, 2018, 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
|
||||
@@ -25,240 +25,31 @@
|
||||
* @test
|
||||
* @bug 4482446
|
||||
* @summary java.net.SocketTimeoutException on 98, NT, 2000 for JSSE
|
||||
- * @run main/othervm ReuseAddr
|
||||
+ * @library /javax/net/ssl/templates
|
||||
+ * @run main ReuseAddr
|
||||
*
|
||||
* SunJSSE does not support dynamic system properties, no way to re-use
|
||||
* system properties in samevm/agentvm mode.
|
||||
* @author Brad Wetmore
|
||||
*/
|
||||
|
||||
-import java.io.*;
|
||||
-import java.net.*;
|
||||
-import javax.net.ssl.*;
|
||||
+import java.net.ServerSocket;
|
||||
|
||||
-public class ReuseAddr {
|
||||
+public class ReuseAddr extends SSLSocketTemplate {
|
||||
|
||||
- /*
|
||||
- * =============================================================
|
||||
- * Set the various variables needed for the tests, then
|
||||
- * specify what tests to run on each side.
|
||||
- */
|
||||
+ @Override
|
||||
+ protected void doServerSide() throws Exception {
|
||||
+ super.doServerSide();
|
||||
|
||||
- /*
|
||||
- * Should we run the client or server in a separate thread?
|
||||
- * Both sides can throw exceptions, but do you have a preference
|
||||
- * as to which side should be the main thread.
|
||||
- */
|
||||
- static boolean separateServerThread = true;
|
||||
-
|
||||
- /*
|
||||
- * Where do we find the keystores?
|
||||
- */
|
||||
- private final static String pathToStores = "../../../../javax/net/ssl/etc";
|
||||
- static String keyStoreFile = "keystore";
|
||||
- static String trustStoreFile = "truststore";
|
||||
- static String passwd = "passphrase";
|
||||
-
|
||||
- /*
|
||||
- * Is the server ready to serve?
|
||||
- */
|
||||
- volatile static boolean serverReady = false;
|
||||
-
|
||||
- /*
|
||||
- * Turn on SSL debugging?
|
||||
- */
|
||||
- static boolean debug = false;
|
||||
-
|
||||
- /*
|
||||
- * If the client or server is doing some kind of object creation
|
||||
- * that the other side depends on, and that thread prematurely
|
||||
- * exits, you may experience a hang. The test harness will
|
||||
- * terminate all hung threads after its timeout has expired,
|
||||
- * currently 3 minutes by default, but you might try to be
|
||||
- * smart about it....
|
||||
- */
|
||||
-
|
||||
- /*
|
||||
- * Define the server side of the test.
|
||||
- *
|
||||
- * If the server prematurely exits, serverReady will be set to true
|
||||
- * to avoid infinite hangs.
|
||||
- */
|
||||
- void doServerSide() throws Exception {
|
||||
- SSLServerSocketFactory sslssf =
|
||||
- (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
|
||||
- SSLServerSocket sslServerSocket =
|
||||
- (SSLServerSocket) sslssf.createServerSocket(serverPort);
|
||||
- serverPort = sslServerSocket.getLocalPort();
|
||||
-
|
||||
- /*
|
||||
- * Signal Client, we're ready for his connect.
|
||||
- */
|
||||
- serverReady = true;
|
||||
-
|
||||
- SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
|
||||
- InputStream sslIS = sslSocket.getInputStream();
|
||||
- OutputStream sslOS = sslSocket.getOutputStream();
|
||||
-
|
||||
- sslIS.read();
|
||||
- sslOS.write(85);
|
||||
- sslOS.flush();
|
||||
-
|
||||
- sslSocket.close();
|
||||
-
|
||||
- // Close original server socket
|
||||
- sslServerSocket.close();
|
||||
-
|
||||
- // Try rebinding to same port
|
||||
- sslServerSocket =
|
||||
- (SSLServerSocket) sslssf.createServerSocket(serverPort);
|
||||
- sslServerSocket.close();
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Define the client side of the test.
|
||||
- *
|
||||
- * If the server prematurely exits, serverReady will be set to true
|
||||
- * to avoid infinite hangs.
|
||||
- */
|
||||
- void doClientSide() throws Exception {
|
||||
-
|
||||
- /*
|
||||
- * Wait for server to get started.
|
||||
- */
|
||||
- while (!serverReady) {
|
||||
- Thread.sleep(50);
|
||||
+ // Note that if this port is already used by another test,
|
||||
+ // this test will fail.
|
||||
+ System.out.println("Try rebinding to same port: " + serverPort);
|
||||
+ try (ServerSocket server = new ServerSocket(serverPort)) {
|
||||
+ System.out.println("Server port: " + server.getLocalPort());
|
||||
}
|
||||
-
|
||||
- SSLSocketFactory sslsf =
|
||||
- (SSLSocketFactory) SSLSocketFactory.getDefault();
|
||||
- SSLSocket sslSocket = (SSLSocket)
|
||||
- sslsf.createSocket("localhost", serverPort);
|
||||
-
|
||||
- InputStream sslIS = sslSocket.getInputStream();
|
||||
- OutputStream sslOS = sslSocket.getOutputStream();
|
||||
-
|
||||
- sslOS.write(280);
|
||||
- sslOS.flush();
|
||||
- sslIS.read();
|
||||
-
|
||||
- sslSocket.close();
|
||||
}
|
||||
|
||||
- /*
|
||||
- * =============================================================
|
||||
- * The remainder is just support stuff
|
||||
- */
|
||||
-
|
||||
- // use any free port by default
|
||||
- volatile int serverPort = 0;
|
||||
-
|
||||
- volatile Exception serverException = null;
|
||||
- volatile Exception clientException = null;
|
||||
-
|
||||
public static void main(String[] args) throws Exception {
|
||||
- String keyFilename =
|
||||
- System.getProperty("test.src", "./") + "/" + pathToStores +
|
||||
- "/" + keyStoreFile;
|
||||
- String trustFilename =
|
||||
- System.getProperty("test.src", "./") + "/" + pathToStores +
|
||||
- "/" + trustStoreFile;
|
||||
-
|
||||
- System.setProperty("javax.net.ssl.keyStore", keyFilename);
|
||||
- System.setProperty("javax.net.ssl.keyStorePassword", passwd);
|
||||
- System.setProperty("javax.net.ssl.trustStore", trustFilename);
|
||||
- System.setProperty("javax.net.ssl.trustStorePassword", passwd);
|
||||
-
|
||||
- if (debug)
|
||||
- System.setProperty("javax.net.debug", "all");
|
||||
-
|
||||
- /*
|
||||
- * Start the tests.
|
||||
- */
|
||||
- new ReuseAddr();
|
||||
- }
|
||||
-
|
||||
- Thread clientThread = null;
|
||||
- Thread serverThread = null;
|
||||
-
|
||||
- /*
|
||||
- * Primary constructor, used to drive remainder of the test.
|
||||
- *
|
||||
- * Fork off the other side, then do your work.
|
||||
- */
|
||||
- ReuseAddr() throws Exception {
|
||||
- if (separateServerThread) {
|
||||
- startServer(true);
|
||||
- startClient(false);
|
||||
- } else {
|
||||
- startClient(true);
|
||||
- startServer(false);
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Wait for other side to close down.
|
||||
- */
|
||||
- if (separateServerThread) {
|
||||
- serverThread.join();
|
||||
- } else {
|
||||
- clientThread.join();
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * When we get here, the test is pretty much over.
|
||||
- *
|
||||
- * If the main thread excepted, that propagates back
|
||||
- * immediately. If the other thread threw an exception, we
|
||||
- * should report back.
|
||||
- */
|
||||
- if (serverException != null)
|
||||
- throw serverException;
|
||||
- if (clientException != null)
|
||||
- throw clientException;
|
||||
- }
|
||||
-
|
||||
- void startServer(boolean newThread) throws Exception {
|
||||
- if (newThread) {
|
||||
- serverThread = new Thread() {
|
||||
- public void run() {
|
||||
- try {
|
||||
- doServerSide();
|
||||
- } catch (Exception e) {
|
||||
- /*
|
||||
- * Our server thread just died.
|
||||
- *
|
||||
- * Release the client, if not active already...
|
||||
- */
|
||||
- System.err.println("Server died...");
|
||||
- serverReady = true;
|
||||
- serverException = e;
|
||||
- }
|
||||
- }
|
||||
- };
|
||||
- serverThread.start();
|
||||
- } else {
|
||||
- doServerSide();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- void startClient(boolean newThread) throws Exception {
|
||||
- if (newThread) {
|
||||
- clientThread = new Thread() {
|
||||
- public void run() {
|
||||
- try {
|
||||
- doClientSide();
|
||||
- } catch (Exception e) {
|
||||
- /*
|
||||
- * Our client thread just died.
|
||||
- */
|
||||
- System.err.println("Client died...");
|
||||
- clientException = e;
|
||||
- }
|
||||
- }
|
||||
- };
|
||||
- clientThread.start();
|
||||
- } else {
|
||||
- doClientSide();
|
||||
- }
|
||||
+ new ReuseAddr().run();
|
||||
}
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -0,0 +1,171 @@
|
||||
From 8e53927b6739a935dc833f7e9527dacb71bae1a8 Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 30 May 2024 07:02:40 +0000
|
||||
Subject: [PATCH] [Backport]8210706: G1 may deadlock when starting a concurrent cycle at
|
||||
shutdown
|
||||
---
|
||||
.../gc_implementation/g1/concurrentMark.cpp | 20 +++++++++++--------
|
||||
.../gc_implementation/g1/concurrentMark.hpp | 4 ++++
|
||||
.../g1/concurrentMarkThread.cpp | 8 +++++++-
|
||||
.../gc_implementation/g1/g1CollectedHeap.cpp | 14 +++++++------
|
||||
.../shared/concurrentGCThread.hpp | 2 ++
|
||||
5 files changed, 33 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
|
||||
index 1347a7e16..cad474b83 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
|
||||
@@ -477,6 +477,16 @@ HeapRegion* CMRootRegions::claim_next() {
|
||||
return res;
|
||||
}
|
||||
|
||||
+void CMRootRegions::notify_scan_done() {
|
||||
+ MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
+ _scan_in_progress = false;
|
||||
+ RootRegionScan_lock->notify_all();
|
||||
+}
|
||||
+
|
||||
+void CMRootRegions::cancel_scan() {
|
||||
+ notify_scan_done();
|
||||
+}
|
||||
+
|
||||
void CMRootRegions::scan_finished() {
|
||||
assert(scan_in_progress(), "pre-condition");
|
||||
|
||||
@@ -486,11 +496,7 @@ void CMRootRegions::scan_finished() {
|
||||
}
|
||||
_next_survivor = NULL;
|
||||
|
||||
- {
|
||||
- MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
- _scan_in_progress = false;
|
||||
- RootRegionScan_lock->notify_all();
|
||||
- }
|
||||
+ notify_scan_done();
|
||||
}
|
||||
|
||||
bool CMRootRegions::wait_until_scan_finished() {
|
||||
@@ -1224,13 +1230,11 @@ public:
|
||||
};
|
||||
|
||||
void ConcurrentMark::scanRootRegions() {
|
||||
- // Start of concurrent marking.
|
||||
- ClassLoaderDataGraph::clear_claimed_marks();
|
||||
-
|
||||
// scan_in_progress() will have been set to true only if there was
|
||||
// at least one root region to scan. So, if it's false, we
|
||||
// should not attempt to do any further work.
|
||||
if (root_regions()->scan_in_progress()) {
|
||||
+ assert(!has_aborted(), "Aborting before root region scanning is finished not supported.");
|
||||
_parallel_marking_threads = calc_parallel_marking_threads();
|
||||
assert(parallel_marking_threads() <= max_parallel_marking_threads(),
|
||||
"Maximum number of marking threads exceeded");
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
|
||||
index bbd5d590a..172caef29 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
|
||||
@@ -333,6 +333,8 @@ private:
|
||||
volatile bool _should_abort;
|
||||
HeapRegion* volatile _next_survivor;
|
||||
|
||||
+ void notify_scan_done();
|
||||
+
|
||||
public:
|
||||
CMRootRegions();
|
||||
// We actually do most of the initialization in this method.
|
||||
@@ -352,6 +354,8 @@ public:
|
||||
// all have been claimed.
|
||||
HeapRegion* claim_next();
|
||||
|
||||
+ void cancel_scan();
|
||||
+
|
||||
// Flag that we're done with root region scanning and notify anyone
|
||||
// who's waiting on it. If aborted is false, assume that all regions
|
||||
// have been claimed.
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
|
||||
index 9b0452f92..3c4553bf7 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
+#include "classfile/classLoaderData.hpp"
|
||||
#include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
|
||||
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
|
||||
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
|
||||
@@ -100,6 +101,10 @@ void ConcurrentMarkThread::run() {
|
||||
HandleMark hm;
|
||||
double cycle_start = os::elapsedVTime();
|
||||
|
||||
+ {
|
||||
+ ClassLoaderDataGraph::clear_claimed_marks();
|
||||
+ }
|
||||
+
|
||||
// We have to ensure that we finish scanning the root regions
|
||||
// before the next GC takes place. To ensure this we have to
|
||||
// make sure that we do not join the STS until the root regions
|
||||
@@ -109,7 +114,7 @@ void ConcurrentMarkThread::run() {
|
||||
// correctness issue.
|
||||
|
||||
double scan_start = os::elapsedTime();
|
||||
- if (!cm()->has_aborted()) {
|
||||
+ {
|
||||
if (G1Log::fine()) {
|
||||
gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
|
||||
gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]");
|
||||
@@ -297,6 +302,7 @@ void ConcurrentMarkThread::run() {
|
||||
}
|
||||
}
|
||||
assert(_should_terminate, "just checking");
|
||||
+ _cm->root_regions()->cancel_scan();
|
||||
|
||||
terminate();
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
|
||||
index 5b156f99d..3ff5586c1 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
|
||||
@@ -1346,8 +1346,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
|
||||
ref_processor_cm()->verify_no_references_recorded();
|
||||
|
||||
// Abandon current iterations of concurrent marking and concurrent
|
||||
- // refinement, if any are in progress. We have to do this before
|
||||
- // wait_until_scan_finished() below.
|
||||
+ // refinement, if any are in progress.
|
||||
concurrent_mark()->abort();
|
||||
|
||||
// Make sure we'll choose a new allocation region afterwards.
|
||||
@@ -4032,10 +4031,13 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
verify_region_sets_optional();
|
||||
verify_dirty_young_regions();
|
||||
|
||||
- // This call will decide whether this pause is an initial-mark
|
||||
- // pause. If it is, during_initial_mark_pause() will return true
|
||||
- // for the duration of this pause.
|
||||
- g1_policy()->decide_on_conc_mark_initiation();
|
||||
+ // We should not be doing initial mark unless the conc mark thread is running
|
||||
+ if (!_cmThread->should_terminate()) {
|
||||
+ // This call will decide whether this pause is an initial-mark
|
||||
+ // pause. If it is, during_initial_mark_pause() will return true
|
||||
+ // for the duration of this pause.
|
||||
+ g1_policy()->decide_on_conc_mark_initiation();
|
||||
+ }
|
||||
|
||||
// We do not allow initial-mark to be piggy-backed on a mixed GC.
|
||||
assert(!g1_policy()->during_initial_mark_pause() ||
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
|
||||
index 1e16bf726..ceb65b029 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
// Tester
|
||||
bool is_ConcurrentGC_thread() const { return true; }
|
||||
+
|
||||
+ bool should_terminate() { return _should_terminate; }
|
||||
};
|
||||
|
||||
// The SurrogateLockerThread is used by concurrent GC threads for
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,345 @@
|
||||
From d9cb35d747e5f38210a3207d6821e333dcf45a8b Mon Sep 17 00:00:00 2001
|
||||
Date: Fri, 31 May 2024 15:39:38 +0800
|
||||
Subject: [PATCH] [Backport]8318889: Backport Important Fixed Issues in Later Versions
|
||||
2024_5_30
|
||||
---
|
||||
hotspot/src/os/linux/vm/os_perf_linux.cpp | 2 +-
|
||||
hotspot/src/share/vm/opto/loopnode.cpp | 8 +-
|
||||
hotspot/src/share/vm/prims/jni.cpp | 5 +
|
||||
.../abstractMethod/AbstractMethodClass.jasm | 43 ++++++
|
||||
.../abstractMethod/TestJNIAbstractMethod.java | 68 +++++++++
|
||||
.../jni/abstractMethod/libJNIAbstractMethod.c | 43 ++++++
|
||||
.../media/sound/StandardMidiFileReader.java | 13 +-
|
||||
.../classes/javax/swing/text/html/CSS.java | 6 +-
|
||||
jdk/src/share/native/java/util/zip/zip_util.c | 2 +-
|
||||
.../native/sun/awt/image/jpeg/imageioJPEG.c | 4 +
|
||||
.../native/sun/awt/image/jpeg/jpegdecoder.c | 4 +
|
||||
.../File/SMFInterruptedRunningStatus.java | 143 ++++++++++++++++++
|
||||
12 files changed, 331 insertions(+), 10 deletions(-)
|
||||
create mode 100644 hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm
|
||||
create mode 100644 hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java
|
||||
create mode 100644 hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c
|
||||
create mode 100644 jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
||||
|
||||
diff --git a/hotspot/src/os/linux/vm/os_perf_linux.cpp b/hotspot/src/os/linux/vm/os_perf_linux.cpp
|
||||
index 0d1f75810..6a92675a6 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_perf_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_perf_linux.cpp
|
||||
@@ -941,7 +941,7 @@ SystemProcessInterface::SystemProcesses::ProcessIterator::ProcessIterator() {
|
||||
bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
|
||||
_dir = os::opendir("/proc");
|
||||
_entry = NULL;
|
||||
- _valid = true;
|
||||
+ _valid = _dir != NULL; // May be null if /proc is not accessible.
|
||||
next_process();
|
||||
|
||||
return true;
|
||||
diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp
|
||||
index 5e6d53a48..351e6888b 100644
|
||||
--- a/hotspot/src/share/vm/opto/loopnode.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/loopnode.cpp
|
||||
@@ -2571,6 +2571,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool skip_loop_opts)
|
||||
NOT_PRODUCT( C->verify_graph_edges(); )
|
||||
worklist.push( C->top() );
|
||||
build_loop_late( visited, worklist, nstack );
|
||||
+ if (C->failing()) { return; }
|
||||
|
||||
if (_verify_only) {
|
||||
// restore major progress flag
|
||||
@@ -3781,6 +3782,7 @@ void PhaseIdealLoop::build_loop_late( VectorSet &visited, Node_List &worklist, N
|
||||
} else {
|
||||
// All of n's children have been processed, complete post-processing.
|
||||
build_loop_late_post(n);
|
||||
+ if (C->failing()) { return; }
|
||||
if (nstack.is_empty()) {
|
||||
// Finished all nodes on stack.
|
||||
// Process next node on the worklist.
|
||||
@@ -3884,13 +3886,15 @@ void PhaseIdealLoop::build_loop_late_post( Node *n ) {
|
||||
Node *legal = LCA; // Walk 'legal' up the IDOM chain
|
||||
Node *least = legal; // Best legal position so far
|
||||
while( early != legal ) { // While not at earliest legal
|
||||
-#ifdef ASSERT
|
||||
if (legal->is_Start() && !early->is_Root()) {
|
||||
+#ifdef ASSERT
|
||||
// Bad graph. Print idom path and fail.
|
||||
dump_bad_graph("Bad graph detected in build_loop_late", n, early, LCA);
|
||||
assert(false, "Bad graph detected in build_loop_late");
|
||||
- }
|
||||
#endif
|
||||
+ C->record_method_not_compilable("Bad graph detected in build_loop_late");
|
||||
+ return;
|
||||
+ }
|
||||
// Find least loop nesting depth
|
||||
legal = idom(legal); // Bump up the IDOM tree
|
||||
// Check for lower nesting depth
|
||||
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
|
||||
index de0aae9b4..cccb578ea 100644
|
||||
--- a/hotspot/src/share/vm/prims/jni.cpp
|
||||
+++ b/hotspot/src/share/vm/prims/jni.cpp
|
||||
@@ -1380,6 +1380,11 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
||||
}
|
||||
}
|
||||
|
||||
+ if (selected_method->is_abstract()) {
|
||||
+ ResourceMark rm(THREAD);
|
||||
+ THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), selected_method->name()->as_C_string());
|
||||
+ }
|
||||
+
|
||||
methodHandle method(THREAD, selected_method);
|
||||
|
||||
// Create object to hold arguments for the JavaCall, and associate it with
|
||||
diff --git a/hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm b/hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm
|
||||
new file mode 100644
|
||||
index 000000000..24c53f203
|
||||
--- /dev/null
|
||||
+++ b/hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm
|
||||
@@ -0,0 +1,43 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2024, 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.
|
||||
+ *
|
||||
+ */
|
||||
+/*
|
||||
+ * This is a non-abstract class with an abstract method.
|
||||
+ *
|
||||
+ */
|
||||
+super public class AbstractMethodClass
|
||||
+ extends java/lang/Object
|
||||
+ version 51:0 // Java 7 version
|
||||
+{
|
||||
+
|
||||
+ public Method "<init>":"()V"
|
||||
+ stack 1 locals 1
|
||||
+ {
|
||||
+ aload_0;
|
||||
+ invokespecial Method java/lang/Object."<init>":"()V";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ public abstract Method "abstractM":"()V";
|
||||
+
|
||||
+}
|
||||
diff --git a/hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java b/hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java
|
||||
new file mode 100644
|
||||
index 000000000..2384f6d5a
|
||||
--- /dev/null
|
||||
+++ b/hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java
|
||||
@@ -0,0 +1,68 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2024, 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 8323243
|
||||
+ * @summary Test that invocation of an abstract method from JNI works correctly
|
||||
+ * @compile AbstractMethodClass.jasm
|
||||
+ * @run main/othervm/native TestJNIAbstractMethod
|
||||
+ */
|
||||
+
|
||||
+/**
|
||||
+ * We are testing invocation of an abstract method from JNI - which should
|
||||
+ * simply result in throwning AbstractMethodError. To invoke an abstract method
|
||||
+ * we must have an instance method (as abstract static methods are illegal),
|
||||
+ * but instantiating an abstract class is also illegal at the Java language
|
||||
+ * level, so we have to use a custom jasm class that contains an abstract method
|
||||
+ * declaration, but which is not itself declared as an abstract class.
|
||||
+ */
|
||||
+public class TestJNIAbstractMethod {
|
||||
+
|
||||
+ // Invokes an abstract method from JNI and throws AbstractMethodError.
|
||||
+ private static native void invokeAbstractM(Class<?> AMclass,
|
||||
+ AbstractMethodClass receiver);
|
||||
+
|
||||
+ static {
|
||||
+ System.loadLibrary("JNIAbstractMethod");
|
||||
+ }
|
||||
+
|
||||
+ public static void main(String[] args) {
|
||||
+ AbstractMethodClass obj = new AbstractMethodClass();
|
||||
+ try {
|
||||
+ System.out.println("Attempting direct invocation via Java");
|
||||
+ obj.abstractM();
|
||||
+ throw new RuntimeException("Did not get AbstractMethodError from Java!");
|
||||
+ } catch (AbstractMethodError expected) {
|
||||
+ System.out.println("ok - got expected exception: " + expected);
|
||||
+ }
|
||||
+ try {
|
||||
+ System.out.println("Attempting direct invocation via JNI");
|
||||
+ invokeAbstractM(obj.getClass(), obj);
|
||||
+ throw new RuntimeException("Did not get AbstractMethodError from JNI!");
|
||||
+ } catch (AbstractMethodError expected) {
|
||||
+ System.out.println("ok - got expected exception: " + expected);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c b/hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c
|
||||
new file mode 100644
|
||||
index 000000000..35a28f702
|
||||
--- /dev/null
|
||||
+++ b/hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2024, 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.
|
||||
+ *
|
||||
+ */
|
||||
+#include <jni.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+JNIEXPORT void JNICALL Java_TestJNIAbstractMethod_invokeAbstractM(JNIEnv* env,
|
||||
+ jclass this_cls,
|
||||
+ jclass target_cls,
|
||||
+ jobject receiver) {
|
||||
+
|
||||
+ jmethodID mid = (*env)->GetMethodID(env, target_cls, "abstractM", "()V");
|
||||
+ if (mid == NULL) {
|
||||
+ fprintf(stderr, "Error looking up method abstractM\n");
|
||||
+ (*env)->ExceptionDescribe(env);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ printf("Invoking abstract method ...\n");
|
||||
+ (*env)->CallVoidMethod(env, receiver, mid); // Should raise exception
|
||||
+
|
||||
+}
|
||||
diff --git a/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
|
||||
index 20ebe4f06..ba7f344a4 100644
|
||||
--- a/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
|
||||
+++ b/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
|
||||
@@ -326,10 +326,10 @@ final class SMFParser {
|
||||
// reset current tick to 0
|
||||
long tick = 0;
|
||||
|
||||
- // reset current status byte to 0 (invalid value).
|
||||
+ // reset current running status byte to 0 (invalid value).
|
||||
// this should cause us to throw an InvalidMidiDataException if we don't
|
||||
// get a valid status byte from the beginning of the track.
|
||||
- int status = 0;
|
||||
+ int runningStatus = 0;
|
||||
boolean endOfTrackFound = false;
|
||||
|
||||
while (!trackFinished() && !endOfTrackFound) {
|
||||
@@ -346,10 +346,17 @@ final class SMFParser {
|
||||
// check for new status
|
||||
int byteValue = readUnsigned();
|
||||
|
||||
+ int status;
|
||||
if (byteValue >= 0x80) {
|
||||
status = byteValue;
|
||||
+
|
||||
+ // update running status (only for channel messages)
|
||||
+ if ((status & 0xF0) != 0xF0) {
|
||||
+ runningStatus = status;
|
||||
+ }
|
||||
} else {
|
||||
- data1 = byteValue;
|
||||
+ status = runningStatus;
|
||||
+ data1 = byteValue;
|
||||
}
|
||||
|
||||
switch (status & 0xF0) {
|
||||
diff --git a/jdk/src/share/classes/javax/swing/text/html/CSS.java b/jdk/src/share/classes/javax/swing/text/html/CSS.java
|
||||
index 4a944d381..4713bcd60 100644
|
||||
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java
|
||||
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java
|
||||
@@ -2581,8 +2581,8 @@ public class CSS implements Serializable {
|
||||
* Used for BackgroundImages.
|
||||
*/
|
||||
static class BackgroundImage extends CssValue {
|
||||
- private boolean loadedImage;
|
||||
- private ImageIcon image;
|
||||
+ private volatile boolean loadedImage;
|
||||
+ private ImageIcon image;
|
||||
|
||||
Object parseCssValue(String value) {
|
||||
BackgroundImage retValue = new BackgroundImage();
|
||||
@@ -2600,7 +2600,6 @@ public class CSS implements Serializable {
|
||||
synchronized(this) {
|
||||
if (!loadedImage) {
|
||||
URL url = CSS.getURL(base, svalue);
|
||||
- loadedImage = true;
|
||||
if (url != null) {
|
||||
image = new ImageIcon();
|
||||
Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
|
||||
@@ -2608,6 +2607,7 @@ public class CSS implements Serializable {
|
||||
image.setImage(tmpImg);
|
||||
}
|
||||
}
|
||||
+ loadedImage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c
|
||||
index ff59c5ecc..8b0c08909 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/zip_util.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/zip_util.c
|
||||
@@ -443,7 +443,7 @@ hash(const char *s)
|
||||
static unsigned int
|
||||
hashN(const char *s, int length)
|
||||
{
|
||||
- int h = 0;
|
||||
+ unsigned int h = 0;
|
||||
while (length-- > 0)
|
||||
h = 31*h + *s++;
|
||||
return h;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -3070,12 +3070,13 @@ index 8dd4e6b21..6a2d8077f 100644
|
||||
// We take care not to be blocking while holding the
|
||||
// SymbolTable_lock. Otherwise, the system might deadlock, since the
|
||||
// symboltable is used during compilation (VM_thread) The lock free
|
||||
@@ -236,12 +267,32 @@ unsigned int SymbolTable::hash_symbol(const char* s, int len) {
|
||||
// entries in the symbol table during normal execution (only during
|
||||
// safepoints).
|
||||
@@ -251,13 +282,33 @@ unsigned int SymbolTable::hash_symbol(const char* s, int len) {
|
||||
return len;
|
||||
}
|
||||
|
||||
-Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
|
||||
+Symbol* SymbolTable::lookup_common(const char* name, int len) {
|
||||
len = check_length(name, len);
|
||||
unsigned int hashValue = hash_symbol(name, len);
|
||||
int index = the_table()->hash_to_index(hashValue);
|
||||
+ Symbol* s;
|
||||
|
||||
67
Enhance-SIGBUS-and-rlimit-information-in-errlog.patch
Normal file
67
Enhance-SIGBUS-and-rlimit-information-in-errlog.patch
Normal 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
|
||||
|
||||
135
Extending-the-IV-Length-Supported-by-KAEProvider-AES.patch
Normal file
135
Extending-the-IV-Length-Supported-by-KAEProvider-AES.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From f4b0357c01f51e813642c3ac5c8ff33c1576eb72 Mon Sep 17 00:00:00 2001
|
||||
Subject: Extending the IV Length Supported by KAEProvider AES/Gcm
|
||||
---
|
||||
.../security/openssl/kae_symmetric_cipher.c | 23 ++++++--
|
||||
.../security/openssl/KAEGcmIvLenTest.java | 52 +++++++++++++++++++
|
||||
2 files changed, 72 insertions(+), 3 deletions(-)
|
||||
create mode 100644 jdk/test/org/openeuler/security/openssl/KAEGcmIvLenTest.java
|
||||
|
||||
diff --git a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_symmetric_cipher.c b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_symmetric_cipher.c
|
||||
index ec8894f1a..7618d6e16 100644
|
||||
--- a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_symmetric_cipher.c
|
||||
+++ b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_symmetric_cipher.c
|
||||
@@ -146,6 +146,7 @@ Java_org_openeuler_security_openssl_KAESymmetricCipherBase_nativeInit(JNIEnv* en
|
||||
const EVP_CIPHER* cipher = NULL;
|
||||
ENGINE* kaeEngine = NULL;
|
||||
int keyLength = (*env)->GetArrayLength(env, key);
|
||||
+ int ivLength = 0;
|
||||
|
||||
const char* algo = (*env)->GetStringUTFChars(env, cipherType, 0);
|
||||
if (StartsWith("aes", algo)) {
|
||||
@@ -158,7 +159,6 @@ Java_org_openeuler_security_openssl_KAESymmetricCipherBase_nativeInit(JNIEnv* en
|
||||
|
||||
KAE_TRACE("KAESymmetricCipherBase_nativeInit: kaeEngine => %p", kaeEngine);
|
||||
|
||||
- (*env)->ReleaseStringUTFChars(env, cipherType, algo);
|
||||
if (cipher == NULL) {
|
||||
KAE_ThrowOOMException(env, "create EVP_CIPHER fail");
|
||||
goto cleanup;
|
||||
@@ -170,19 +170,35 @@ Java_org_openeuler_security_openssl_KAESymmetricCipherBase_nativeInit(JNIEnv* en
|
||||
|
||||
if (iv != NULL) {
|
||||
ivBytes = (*env)->GetByteArrayElements(env, iv, NULL);
|
||||
+ ivLength = (*env)->GetArrayLength(env, iv);
|
||||
}
|
||||
if (key != NULL) {
|
||||
keyBytes = (*env)->GetByteArrayElements(env, key, NULL);
|
||||
}
|
||||
|
||||
- if (!EVP_CipherInit_ex(ctx, cipher, kaeEngine, (const unsigned char*)keyBytes,
|
||||
- (const unsigned char*)ivBytes, encrypt ? 1 : 0)) {
|
||||
+ if (!EVP_CipherInit_ex(ctx, cipher, kaeEngine, NULL,
|
||||
+ NULL, encrypt ? 1 : 0)) {
|
||||
KAE_ThrowFromOpenssl(env, "EVP_CipherInit_ex failed", KAE_ThrowRuntimeException);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ if (strcasecmp(algo + 8, "gcm") == 0) {
|
||||
+ /* Set IV length if default 12 bytes (96 bits) is not appropriate */
|
||||
+ if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, ivLength, NULL)) {
|
||||
+ KAE_ThrowFromOpenssl(env, "EVP_CIPHER_CTX_ctrl failed", KAE_ThrowRuntimeException);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!EVP_CipherInit_ex(ctx, NULL, kaeEngine, (const unsigned char*)keyBytes,
|
||||
+ (const unsigned char*)ivBytes, encrypt ? 1 : 0)) {
|
||||
+ KAE_ThrowFromOpenssl(env, "EVP_CipherInit_ex int key & iv failed", KAE_ThrowRuntimeException);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
EVP_CIPHER_CTX_set_padding(ctx, padding ? 1 : 0);
|
||||
|
||||
+ (*env)->ReleaseStringUTFChars(env, cipherType, algo);
|
||||
FreeMemoryFromInit(env, iv, ivBytes, key, keyBytes, keyLength);
|
||||
return (jlong)ctx;
|
||||
|
||||
@@ -190,6 +206,7 @@ cleanup:
|
||||
if (ctx != NULL) {
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
}
|
||||
+ (*env)->ReleaseStringUTFChars(env, cipherType, algo);
|
||||
FreeMemoryFromInit(env, iv, ivBytes, key, keyBytes, keyLength);
|
||||
return 0;
|
||||
}
|
||||
diff --git a/jdk/test/org/openeuler/security/openssl/KAEGcmIvLenTest.java b/jdk/test/org/openeuler/security/openssl/KAEGcmIvLenTest.java
|
||||
new file mode 100644
|
||||
index 000000000..c9e2257aa
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/org/openeuler/security/openssl/KAEGcmIvLenTest.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+import org.openeuler.security.openssl.KAEProvider;
|
||||
+
|
||||
+import javax.crypto.Cipher;
|
||||
+import javax.crypto.spec.GCMParameterSpec;
|
||||
+import javax.crypto.spec.SecretKeySpec;
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+import java.security.Security;
|
||||
+import java.util.Arrays;
|
||||
+
|
||||
+/**
|
||||
+ * @test
|
||||
+ * @summary Basic test for AES/GCM Iv
|
||||
+ * @requires os.arch=="aarch64"
|
||||
+ * @run main KAEGcmIvLenTest
|
||||
+ */
|
||||
+public class KAEGcmIvLenTest {
|
||||
+ private static String plainText = "helloworldhellow"; // 16bytes for NoPadding
|
||||
+ private static String shortPlainText = "helloworld"; // 5 bytes for padding
|
||||
+ private static SecretKeySpec ks = new SecretKeySpec("AESEncryptionKey".getBytes(StandardCharsets.UTF_8), "AES"); // key has 16 bytes
|
||||
+ private static int[] ivLens = {12, 16};
|
||||
+ public static void main(String[] args) throws Exception {
|
||||
+ Security.addProvider(new KAEProvider());
|
||||
+ for (int ivLen : ivLens) {
|
||||
+ testGcm(plainText,"AES/GCM/NoPadding", "KAEProvider", "SunJCE", ivLen);
|
||||
+ testGcm(plainText,"AES/GCM/NoPadding", "SunJCE", "KAEProvider", ivLen);
|
||||
+ testGcm(shortPlainText,"AES/GCM/PKCS5Padding", "KAEProvider", "SunJCE", ivLen);
|
||||
+ testGcm(shortPlainText,"AES/GCM/PKCS5Padding", "SunJCE", "KAEProvider", ivLen);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ private static void testGcm(String plainText, String algo, String encryptProvider, String decryptProvider, int ivLen) throws Exception {
|
||||
+ Cipher enCipher = Cipher.getInstance(algo, encryptProvider);
|
||||
+ enCipher.init(Cipher.ENCRYPT_MODE, ks, getIv(ivLen));
|
||||
+ byte[] cipherText = enCipher.doFinal(plainText.getBytes());
|
||||
+
|
||||
+ Cipher deCipher = Cipher.getInstance(algo, decryptProvider);
|
||||
+ deCipher.init(Cipher.DECRYPT_MODE, ks, getIv(ivLen));
|
||||
+ byte[] origin = deCipher.doFinal(cipherText);
|
||||
+
|
||||
+ if (!Arrays.equals(plainText.getBytes(), origin)) {
|
||||
+ throw new RuntimeException("gcm decryption failed, algo = " + algo);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static GCMParameterSpec getIv(int ivLen) {
|
||||
+ if (ivLen == 16) {
|
||||
+ return new GCMParameterSpec(128, "abcdefghabcdefgh".getBytes(StandardCharsets.UTF_8));
|
||||
+ }
|
||||
+ return new GCMParameterSpec(96, "abcdefghabcd".getBytes(StandardCharsets.UTF_8));
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -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
|
||||
|
||||
1316
Huawei-Add-Aggressive-CDS.patch
Normal file
1316
Huawei-Add-Aggressive-CDS.patch
Normal file
File diff suppressed because it is too large
Load Diff
40
Huawei-Fix-build-failures-due-to-wrap-in-x86.patch
Normal file
40
Huawei-Fix-build-failures-due-to-wrap-in-x86.patch
Normal 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
|
||||
97
Huawei-Keep-objects-when-remove-unshareable-info.patch
Normal file
97
Huawei-Keep-objects-when-remove-unshareable-info.patch
Normal file
@ -0,0 +1,97 @@
|
||||
From 844511f2b4b6a4be079fc5ac2f2d5b56826df85a Mon Sep 17 00:00:00 2001
|
||||
Date: Tue, 4 Jun 2024 19:09:40 +0800
|
||||
Subject: [PATCH] [Huawei]Keep objects when remove unshareable info
|
||||
---
|
||||
hotspot/src/share/vm/oops/instanceKlass.cpp | 18 +++---------------
|
||||
.../Thread/TestThreadDumpClassInitMonitor.java | 15 +++++++++++----
|
||||
2 files changed, 14 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
index 833cf9afe..df9aaabfb 100644
|
||||
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
@@ -2467,21 +2467,6 @@ void InstanceKlass::remove_unshareable_info() {
|
||||
m->remove_unshareable_info();
|
||||
}
|
||||
|
||||
- if (UseAppCDS || DynamicDumpSharedSpaces) {
|
||||
- if (_oop_map_cache != NULL) {
|
||||
- delete _oop_map_cache;
|
||||
- _oop_map_cache = NULL;
|
||||
- }
|
||||
-
|
||||
- JNIid::deallocate(jni_ids());
|
||||
- set_jni_ids(NULL);
|
||||
-
|
||||
- jmethodID* jmeths = methods_jmethod_ids_acquire();
|
||||
- if (jmeths != (jmethodID*)NULL) {
|
||||
- release_set_methods_jmethod_ids(NULL);
|
||||
- FreeHeap(jmeths);
|
||||
- }
|
||||
- }
|
||||
// do array classes also.
|
||||
array_klasses_do(remove_unshareable_in_class);
|
||||
// These are not allocated from metaspace. They are safe to set to NULL.
|
||||
@@ -2489,6 +2474,9 @@ void InstanceKlass::remove_unshareable_info() {
|
||||
_member_names = NULL;
|
||||
_osr_nmethods_head = NULL;
|
||||
_init_thread = NULL;
|
||||
+ _oop_map_cache = NULL;
|
||||
+ _jni_ids = NULL;
|
||||
+ _methods_jmethod_ids = NULL;
|
||||
}
|
||||
|
||||
void InstanceKlass::remove_java_mirror() {
|
||||
diff --git a/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java b/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java
|
||||
index 8aa218efb..a2111c362 100644
|
||||
--- a/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java
|
||||
+++ b/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java
|
||||
@@ -148,34 +148,41 @@ public class TestThreadDumpClassInitMonitor {
|
||||
throw new Error("Unexpected thread state line: " + line);
|
||||
}
|
||||
if (isProduct) {
|
||||
- foundLines += 3;
|
||||
+ foundLines += 4;
|
||||
} else {
|
||||
foundLines++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 2: { // Debug build
|
||||
+ if (!line.trim().equals(JAVATHREAD_STATE)) {
|
||||
+ throw new Error("Unexpected JavaThread state line: " + line);
|
||||
+ }
|
||||
+ foundLines++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ case 3: { // Debug build
|
||||
if (!line.startsWith(THREAD_INFO)) {
|
||||
throw new Error("Unexpected thread info line: " + line);
|
||||
}
|
||||
foundLines++;
|
||||
continue;
|
||||
}
|
||||
- case 3: { // Debug build
|
||||
+ case 4: { // Debug build
|
||||
if (!line.trim().equals(JAVATHREAD_STATE)) {
|
||||
throw new Error("Unexpected JavaThread state line: " + line);
|
||||
}
|
||||
foundLines++;
|
||||
continue;
|
||||
}
|
||||
- case 4: {
|
||||
+ case 5: {
|
||||
if (!line.trim().startsWith(CURRENT_METHOD)) {
|
||||
throw new Error("Unexpected current method line: " + line);
|
||||
}
|
||||
foundLines++;
|
||||
continue;
|
||||
}
|
||||
- case 5: {
|
||||
+ case 6: {
|
||||
if (!line.trim().equals(WAIT_INFO)) {
|
||||
throw new Error("Unexpected monitor information line: " + line);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
62
Huawei-improve-GCTR-performance.patch
Normal file
62
Huawei-improve-GCTR-performance.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From ac1502ff943911bd4d7332bd6531ed0a2454cf05 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 27 May 2024 12:06:03 +0800
|
||||
Subject: [PATCH 2/2] improve GCTR performance
|
||||
---
|
||||
.../classes/com/sun/crypto/provider/GCTR.java | 21 +++++++++++++++++--
|
||||
1 file changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java b/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java
|
||||
index 1ab0f63db..12af359b0 100644
|
||||
--- a/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java
|
||||
+++ b/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java
|
||||
@@ -29,6 +29,10 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
+import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
+import com.sun.management.VMOption;
|
||||
+import sun.management.ManagementFactoryHelper;
|
||||
+
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
@@ -54,13 +58,26 @@ import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE;
|
||||
*/
|
||||
final class GCTR extends CounterMode {
|
||||
|
||||
+ private static final String AES_CTR_INTRINSICS_PARAM = "UseAESCTRIntrinsics";
|
||||
+ private static boolean aesctrIntrinsicEnabled = false;
|
||||
+
|
||||
+ static {
|
||||
+ HotSpotDiagnosticMXBean diagnostic
|
||||
+ = ManagementFactoryHelper.getDiagnosticMXBean();
|
||||
+ VMOption vmOption;
|
||||
+ try {
|
||||
+ vmOption = diagnostic.getVMOption(AES_CTR_INTRINSICS_PARAM);
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ vmOption = null;
|
||||
+ }
|
||||
+ aesctrIntrinsicEnabled = Boolean.valueOf(vmOption == null ? null : vmOption.getValue());
|
||||
+ }
|
||||
GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) {
|
||||
super(cipher);
|
||||
if (initialCounterBlk.length != AES_BLOCK_SIZE) {
|
||||
throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length +
|
||||
") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")");
|
||||
}
|
||||
-
|
||||
iv = initialCounterBlk;
|
||||
reset();
|
||||
}
|
||||
@@ -93,7 +110,7 @@ final class GCTR extends CounterMode {
|
||||
|
||||
long blocksLeft = blocksUntilRollover();
|
||||
int numOfCompleteBlocks = inLen / AES_BLOCK_SIZE;
|
||||
- if (numOfCompleteBlocks >= blocksLeft) {
|
||||
+ if (!aesctrIntrinsicEnabled || numOfCompleteBlocks >= blocksLeft) {
|
||||
// Counter Mode encryption cannot be used because counter will
|
||||
// roll over incorrectly. Use GCM-specific code instead.
|
||||
byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
|
||||
--
|
||||
2.19.1
|
||||
|
||||
691
KAE-zip-support-streaming-data-decompression.patch
Normal file
691
KAE-zip-support-streaming-data-decompression.patch
Normal 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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
524
SA-redact-support-password.patch
Normal file
524
SA-redact-support-password.patch
Normal file
@ -0,0 +1,524 @@
|
||||
From 1ff9622f74d77baed3dc477b43759472b950d630 Mon Sep 17 00:00:00 2001
|
||||
Date: Sat, 9 Nov 2024 16:25:10 +0800
|
||||
Subject: SA redact support password
|
||||
|
||||
---
|
||||
.../sun/jvm/hotspot/tools/HeapDumper.java | 18 ++-
|
||||
.../jvm/hotspot/utilities/HeapRedactor.java | 14 +-
|
||||
hotspot/src/share/vm/runtime/arguments.cpp | 15 +-
|
||||
hotspot/src/share/vm/runtime/arguments.hpp | 4 -
|
||||
hotspot/src/share/vm/runtime/globals.hpp | 4 +-
|
||||
.../src/share/vm/services/heapRedactor.cpp | 8 +-
|
||||
.../src/share/vm/services/heapRedactor.hpp | 1 +
|
||||
.../share/classes/sun/tools/jmap/JMap.java | 150 +++++++++++++-----
|
||||
8 files changed, 150 insertions(+), 64 deletions(-)
|
||||
|
||||
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java
|
||||
index be503fe06..32c91d300 100644
|
||||
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java
|
||||
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java
|
||||
@@ -40,6 +40,9 @@ public class HeapDumper extends Tool {
|
||||
|
||||
private static String DEFAULT_DUMP_FILE = "heap.bin";
|
||||
|
||||
+ // encrypt
|
||||
+ private static int SALT_MIN_LENGTH = 8;
|
||||
+
|
||||
private String dumpFile;
|
||||
|
||||
private HeapRedactor redactor;
|
||||
@@ -78,8 +81,19 @@ public class HeapDumper extends Tool {
|
||||
public void run() {
|
||||
System.out.println("Dumping heap to " + dumpFile + " ...");
|
||||
try {
|
||||
+ String redactAuth = getVMRedactParameter("RedactPassword");
|
||||
+ boolean redactAuthFlag = true;
|
||||
+ if(redactAuth != null) {
|
||||
+ String[] auths = redactAuth.split(",");
|
||||
+ if(auths.length == 2) {
|
||||
+ byte[] saltBytes = auths[1].getBytes("UTF-8");
|
||||
+ if(saltBytes.length >= SALT_MIN_LENGTH) {
|
||||
+ redactAuthFlag = (this.redactor != null && auths[0].equals(this.redactor.getRedactPassword()));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
HeapHprofBinWriter writer = new HeapHprofBinWriter();
|
||||
- if(this.redactor != null){
|
||||
+ if(this.redactor != null && redactAuthFlag) {
|
||||
writer.setHeapRedactor(this.redactor);
|
||||
if(writer.getHeapDumpRedactLevel() != HeapRedactor.HeapDumpRedactLevel.REDACT_UNKNOWN){
|
||||
System.out.println("HeapDump Redact Level = " + this.redactor.getRedactLevelString());
|
||||
@@ -133,7 +147,7 @@ public class HeapDumper extends Tool {
|
||||
}
|
||||
}
|
||||
|
||||
- HeapDumper dumper = heapRedactor == null? new HeapDumper(file):new HeapDumper(file, heapRedactor);
|
||||
+ HeapDumper dumper = heapRedactor == null? new HeapDumper(file) : new HeapDumper(file, heapRedactor);
|
||||
dumper.execute(args);
|
||||
}
|
||||
|
||||
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java
|
||||
index 26782b879..c71340255 100644
|
||||
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java
|
||||
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java
|
||||
@@ -51,7 +51,8 @@ public class HeapRedactor {
|
||||
private HeapDumpRedactLevel redactLevel;
|
||||
private Map<String, String> redactNameTable;
|
||||
private Map<String, Map<String, String>> redactClassTable;
|
||||
- private String redactClassFullName = null;
|
||||
+ private String redactClassFullName = null;
|
||||
+ private String redactPassword = null;
|
||||
private Map<Long, String> redactValueTable;
|
||||
private RedactVectorNode headerNode;
|
||||
private RedactVectorNode currentNode;
|
||||
@@ -62,6 +63,7 @@ public class HeapRedactor {
|
||||
public static final String REDACT_MAP_PREFIX = "RedactMap=";
|
||||
public static final String REDACT_MAP_FILE_PREFIX = "RedactMapFile=";
|
||||
public static final String REDACT_CLASS_PATH_PREFIX = "RedactClassPath=";
|
||||
+ public static final String REDACT_PASSWORD_PREFIX = "RedactPassword=";
|
||||
|
||||
public static final String REDACT_UNKNOWN_STR = "UNKNOWN";
|
||||
public static final String REDACT_OFF_STR = "OFF";
|
||||
@@ -170,6 +172,10 @@ public class HeapRedactor {
|
||||
return redactParams.getRedactClassPath();
|
||||
}
|
||||
|
||||
+ public String getRedactPassword(){
|
||||
+ return redactPassword;
|
||||
+ }
|
||||
+
|
||||
public Optional<Map<String, String>> getRedactRulesTable(String key) {
|
||||
return Optional.<Map<String, String>>ofNullable(redactClassTable == null ? null: redactClassTable.get(key));
|
||||
}
|
||||
@@ -231,9 +237,11 @@ public class HeapRedactor {
|
||||
params.setRedactMap(option.substring(REDACT_MAP_PREFIX.length()));
|
||||
} else if (option.startsWith(REDACT_MAP_FILE_PREFIX)) {
|
||||
params.setRedactMapFile(option.substring(REDACT_MAP_FILE_PREFIX.length()));
|
||||
- } else if (option.startsWith(REDACT_CLASS_PATH_PREFIX)) {
|
||||
+ } else if (option.startsWith(REDACT_CLASS_PATH_PREFIX)) {
|
||||
params.setRedactClassPath(option.substring(REDACT_CLASS_PATH_PREFIX.length()));
|
||||
- }else{
|
||||
+ } else if (option.startsWith(REDACT_PASSWORD_PREFIX)) {
|
||||
+ redactPassword = option.substring(REDACT_PASSWORD_PREFIX.length());
|
||||
+ } else{
|
||||
// None matches
|
||||
}
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
|
||||
index 360a87159..a50aa1866 100644
|
||||
--- a/hotspot/src/share/vm/runtime/arguments.cpp
|
||||
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
|
||||
@@ -152,8 +152,6 @@ char* Arguments::_meta_index_dir = NULL;
|
||||
|
||||
bool Arguments::_transletEnhance = false;
|
||||
|
||||
-char* Arguments::_heap_dump_redact_auth = NULL;
|
||||
-
|
||||
// Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
|
||||
|
||||
static bool match_option(const JavaVMOption *option, const char* name,
|
||||
@@ -4183,14 +4181,13 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||
if(match_option(option, "-XX:RedactPassword=", &tail)) {
|
||||
if(tail == NULL || strlen(tail) == 0) {
|
||||
VerifyRedactPassword = false;
|
||||
- jio_fprintf(defaultStream::output_stream(), "redact password is null, disable verify heap dump authority.\n");
|
||||
} else {
|
||||
- VerifyRedactPassword = true;
|
||||
- size_t redact_password_len = strlen(tail);
|
||||
- _heap_dump_redact_auth = NEW_C_HEAP_ARRAY(char, redact_password_len+1, mtInternal);
|
||||
- memcpy(_heap_dump_redact_auth, tail, redact_password_len);
|
||||
- _heap_dump_redact_auth[redact_password_len] = '\0';
|
||||
- memset((void*)tail, '0', redact_password_len);
|
||||
+ char* split_char = strstr(const_cast<char*>(tail), ",");
|
||||
+ VerifyRedactPassword = !(split_char == NULL || strlen(split_char) < SALT_LEN);
|
||||
+ }
|
||||
+
|
||||
+ if(!VerifyRedactPassword) {
|
||||
+ jio_fprintf(defaultStream::output_stream(), "redact auth is null or with incorrect format, disable verify heap dump authority.\n");
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
|
||||
index 945f487e1..fdd1d14b0 100644
|
||||
--- a/hotspot/src/share/vm/runtime/arguments.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
|
||||
@@ -449,8 +449,6 @@ class Arguments : AllStatic {
|
||||
|
||||
static char* SharedDynamicArchivePath;
|
||||
|
||||
- static char* _heap_dump_redact_auth;
|
||||
-
|
||||
public:
|
||||
// Parses the arguments, first phase
|
||||
static jint parse(const JavaVMInitArgs* args);
|
||||
@@ -564,8 +562,6 @@ class Arguments : AllStatic {
|
||||
|
||||
static const char* GetSharedDynamicArchivePath() { return SharedDynamicArchivePath; }
|
||||
|
||||
- static const char* get_heap_dump_redact_auth() { return _heap_dump_redact_auth; }
|
||||
-
|
||||
static bool init_shared_archive_paths();
|
||||
|
||||
static void extract_shared_archive_paths(const char* archive_path,
|
||||
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
index 28bdd336f..b3c2f5af6 100644
|
||||
--- a/hotspot/src/share/vm/runtime/globals.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
@@ -1007,8 +1007,8 @@ class CommandLineFlags {
|
||||
product(bool, VerifyRedactPassword, false, \
|
||||
"verify authority for operating heapDump redact feature") \
|
||||
\
|
||||
- product(ccstr, RedactPassword, "", \
|
||||
- "authority for operating heapDump redact feature") \
|
||||
+ product(ccstr, RedactPassword, NULL, \
|
||||
+ "authority for operating heapDump redact feature, format {password,salt}, salt length >= 8") \
|
||||
\
|
||||
develop(uintx, SegmentedHeapDumpThreshold, 2*G, \
|
||||
"Generate a segmented heap dump (JAVA PROFILE 1.0.2 format) " \
|
||||
diff --git a/hotspot/src/share/vm/services/heapRedactor.cpp b/hotspot/src/share/vm/services/heapRedactor.cpp
|
||||
index 6120e9458..8d620431e 100644
|
||||
--- a/hotspot/src/share/vm/services/heapRedactor.cpp
|
||||
+++ b/hotspot/src/share/vm/services/heapRedactor.cpp
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "../runtime/globals.hpp"
|
||||
#include "../runtime/os.hpp"
|
||||
-#include "../runtime/arguments.hpp"
|
||||
#include "../utilities/ostream.hpp"
|
||||
#include "../memory/allocation.hpp"
|
||||
#include "../memory/allocation.inline.hpp"
|
||||
@@ -182,12 +181,15 @@ void HeapRedactor::init(outputStream* out) {
|
||||
* if HeapDumpRedact is NULL , jmap operation can not open redact feature without password
|
||||
* if HeapDumpRedact is not NULL, jmap operation can not change redact level without password
|
||||
**/
|
||||
- if(Arguments::get_heap_dump_redact_auth() == NULL) {
|
||||
+ char* split_char = NULL;
|
||||
+ if(RedactPassword == NULL || (split_char = strstr(const_cast<char*>(RedactPassword), ",")) == NULL || strlen(split_char) < SALT_LEN) {
|
||||
VerifyRedactPassword = false;
|
||||
}
|
||||
if(VerifyRedactPassword && !_use_sys_params) {
|
||||
+ size_t auth_len = strlen(RedactPassword);
|
||||
+ size_t suffix_len = strlen(split_char);
|
||||
if(_redact_params.redact_password == NULL ||
|
||||
- strcmp(_redact_params.redact_password, Arguments::get_heap_dump_redact_auth()) ) {
|
||||
+ strncmp(_redact_params.redact_password, RedactPassword, auth_len-suffix_len) ) {
|
||||
// no password or wrong password;
|
||||
_use_sys_params = true;
|
||||
if(out != NULL) {
|
||||
diff --git a/hotspot/src/share/vm/services/heapRedactor.hpp b/hotspot/src/share/vm/services/heapRedactor.hpp
|
||||
index 06ffcc830..ed53d7a03 100644
|
||||
--- a/hotspot/src/share/vm/services/heapRedactor.hpp
|
||||
+++ b/hotspot/src/share/vm/services/heapRedactor.hpp
|
||||
@@ -32,6 +32,7 @@
|
||||
#endif
|
||||
|
||||
#define MAX_MAP_FILE_LENGTH 1024
|
||||
+#define SALT_LEN 9
|
||||
|
||||
enum HeapDumpRedactLevel {
|
||||
REDACT_UNKNOWN,
|
||||
diff --git a/jdk/src/share/classes/sun/tools/jmap/JMap.java b/jdk/src/share/classes/sun/tools/jmap/JMap.java
|
||||
index b184beb74..319f577bd 100644
|
||||
--- a/jdk/src/share/classes/sun/tools/jmap/JMap.java
|
||||
+++ b/jdk/src/share/classes/sun/tools/jmap/JMap.java
|
||||
@@ -31,14 +31,19 @@ import java.lang.reflect.Method;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
-import java.nio.charset.StandardCharsets;
|
||||
-import java.security.MessageDigest;
|
||||
+import java.security.NoSuchAlgorithmException;
|
||||
+import java.security.spec.InvalidKeySpecException;
|
||||
+import java.security.spec.KeySpec;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.sun.tools.attach.VirtualMachine;
|
||||
import com.sun.tools.attach.AttachNotSupportedException;
|
||||
import sun.tools.attach.HotSpotVirtualMachine;
|
||||
|
||||
+import javax.crypto.SecretKey;
|
||||
+import javax.crypto.SecretKeyFactory;
|
||||
+import javax.crypto.spec.PBEKeySpec;
|
||||
+
|
||||
/*
|
||||
* This class is the main class for the JMap utility. It parses its arguments
|
||||
* and decides if the command should be satisfied using the VM attach mechanism
|
||||
@@ -64,6 +69,11 @@ public class JMap {
|
||||
// Default option (if nothing provided)
|
||||
private static String DEFAULT_OPTION = "-pmap";
|
||||
|
||||
+ // encrypt
|
||||
+ private static int SALT_MIN_LENGTH = 8;
|
||||
+ private static int HASH_BIT_SIZE = 256;
|
||||
+ private static int HASH_ITERATIONS_COUNT = 10000;
|
||||
+
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
usage(1); // no arguments
|
||||
@@ -169,7 +179,8 @@ public class JMap {
|
||||
if (option.startsWith(DUMP_OPTION_PREFIX)) {
|
||||
// first check that the option can be parsed
|
||||
RedactParams redactParams = new RedactParams();
|
||||
- String fn = parseDumpOptions(option, redactParams);
|
||||
+ String pid = args.length == 1 ? args[0] : null;
|
||||
+ String fn = parseDumpOptions(option, redactParams, pid);
|
||||
if (fn == null) {
|
||||
usage(1);
|
||||
}
|
||||
@@ -258,16 +269,10 @@ public class JMap {
|
||||
private static void dump(String pid, String options) throws IOException {
|
||||
RedactParams redactParams = new RedactParams();
|
||||
// parse the options to get the dump filename
|
||||
- String filename = parseDumpOptions(options,redactParams);
|
||||
+ String filename = parseDumpOptions(options, redactParams, pid);
|
||||
if (filename == null) {
|
||||
usage(1); // invalid options or no filename
|
||||
}
|
||||
-
|
||||
- String redactPassword = ",RedactPassword=";
|
||||
- if (options.contains("RedactPassword,") || options.contains(",RedactPassword")) {
|
||||
- // heap dump may need a password
|
||||
- redactPassword = getRedactPassword();
|
||||
- }
|
||||
// get the canonical path - important to avoid just passing
|
||||
// a "heap.bin" and having the dump created in the target VM
|
||||
// working directory rather than the directory where jmap
|
||||
@@ -282,12 +287,12 @@ public class JMap {
|
||||
InputStream in = ((HotSpotVirtualMachine)vm).
|
||||
dumpHeap((Object)filename,
|
||||
(live ? LIVE_OBJECTS_OPTION : ALL_OBJECTS_OPTION),
|
||||
- redactParams.isEnableRedact() ? redactParams.toDumpArgString() + redactPassword : "");
|
||||
+ redactParams.isEnableRedact() ? redactParams.toDumpArgString() : "");
|
||||
drain(vm, in);
|
||||
}
|
||||
|
||||
- private static String getRedactPassword() {
|
||||
- String redactPassword = ",RedactPassword=";
|
||||
+ private static String getRedactPassword(String pid) {
|
||||
+ String redactPassword = "";
|
||||
Console console = System.console();
|
||||
char[] passwords = null;
|
||||
if (console == null) {
|
||||
@@ -305,53 +310,97 @@ public class JMap {
|
||||
String password = new String(passwords);
|
||||
Arrays.fill(passwords, '0');
|
||||
String passwordPattern = "^[0-9a-zA-Z!@#$]{1,9}$";
|
||||
- if(!password.matches(passwordPattern)) {
|
||||
- return redactPassword;
|
||||
- }
|
||||
|
||||
String digestStr = null;
|
||||
- byte[] passwordBytes = null;
|
||||
char[] passwordValue = null;
|
||||
try {
|
||||
Field valueField = password.getClass().getDeclaredField("value");
|
||||
valueField.setAccessible(true);
|
||||
passwordValue = (char[])valueField.get(password);
|
||||
|
||||
- passwordBytes= password.getBytes(StandardCharsets.UTF_8);
|
||||
- StringBuilder digestStrBuilder = new StringBuilder();
|
||||
- MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
- byte[] digestBytes = messageDigest.digest(passwordBytes);
|
||||
- for(byte b : digestBytes) {
|
||||
- String hex = Integer.toHexString(0xff & b);
|
||||
- if(hex.length() == 1) {
|
||||
- digestStrBuilder.append('0');
|
||||
- }
|
||||
- digestStrBuilder.append(hex);
|
||||
+ if(!password.matches(passwordPattern)) {
|
||||
+ return redactPassword;
|
||||
+ }
|
||||
+
|
||||
+ String salt = getSalt(pid);
|
||||
+ if(salt == null) {
|
||||
+ return redactPassword;
|
||||
+ }
|
||||
+ byte[] saltBytes = salt.getBytes("UTF-8");
|
||||
+ if(saltBytes.length < SALT_MIN_LENGTH) {
|
||||
+ return redactPassword;
|
||||
}
|
||||
- digestStr = digestStrBuilder.toString();
|
||||
+
|
||||
+ digestStr = getEncryptValue(passwordValue, saltBytes);
|
||||
} catch (Exception e) {
|
||||
}finally {
|
||||
// clear all password
|
||||
- if(passwordBytes != null) {
|
||||
- Arrays.fill(passwordBytes, (byte) 0);
|
||||
- }
|
||||
if(passwordValue != null) {
|
||||
Arrays.fill(passwordValue, '0');
|
||||
}
|
||||
}
|
||||
|
||||
- redactPassword += (digestStr == null ? "" : digestStr);
|
||||
+ redactPassword = (digestStr == null ? "" : digestStr);
|
||||
return redactPassword;
|
||||
}
|
||||
|
||||
+ private static String getSalt(String pid) throws Exception {
|
||||
+ String salt = null;
|
||||
+ StringBuilder redactAuth = new StringBuilder();
|
||||
+
|
||||
+ VirtualMachine vm = VirtualMachine.attach(pid);
|
||||
+ HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
|
||||
+ String flag = "RedactPassword";
|
||||
+ try (InputStream in = hvm.printFlag(flag)) {
|
||||
+ byte b[] = new byte[256];
|
||||
+ int n;
|
||||
+ do {
|
||||
+ n = in.read(b);
|
||||
+ if (n > 0) {
|
||||
+ redactAuth.append(new String(b, 0, n, "UTF-8"));
|
||||
+ }
|
||||
+ } while (n > 0);
|
||||
+ }
|
||||
+ vm.detach();
|
||||
+
|
||||
+ if(redactAuth.length() > 0) {
|
||||
+ String[] auths = redactAuth.toString().split(",");
|
||||
+ if(auths.length != 2) {
|
||||
+ return salt;
|
||||
+ }
|
||||
+ return auths[1].trim();
|
||||
+ }
|
||||
+
|
||||
+ return salt;
|
||||
+ }
|
||||
+
|
||||
+ private static String getEncryptValue(char[] passwordValue, byte[] saltBytes) throws InvalidKeySpecException, NoSuchAlgorithmException {
|
||||
+ StringBuilder digestStrBuilder = new StringBuilder();
|
||||
+
|
||||
+ KeySpec spec = new PBEKeySpec(passwordValue, saltBytes, HASH_ITERATIONS_COUNT, HASH_BIT_SIZE);
|
||||
+ SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||
+ SecretKey secretKey = secretKeyFactory.generateSecret(spec);
|
||||
+ byte[] digestBytes = secretKey.getEncoded();
|
||||
+ for (byte b : digestBytes) {
|
||||
+ String hex = Integer.toHexString(0xff & b);
|
||||
+ if (hex.length() == 1) {
|
||||
+ digestStrBuilder.append('0');
|
||||
+ }
|
||||
+ digestStrBuilder.append(hex);
|
||||
+ }
|
||||
+ String digestStr = digestStrBuilder.toString();
|
||||
+
|
||||
+ return digestStr;
|
||||
+ }
|
||||
+
|
||||
// Parse the options to the -dump option. Valid options are format=b and
|
||||
// file=<file>. Returns <file> if provided. Returns null if <file> not
|
||||
// provided, or invalid option.
|
||||
private static String parseDumpOptions(String arg){
|
||||
- return parseDumpOptions(arg, null);
|
||||
+ return parseDumpOptions(arg, null, null);
|
||||
}
|
||||
|
||||
- private static String parseDumpOptions(String arg, RedactParams redactParams) {
|
||||
+ private static String parseDumpOptions(String arg, RedactParams redactParams, String pid) {
|
||||
assert arg.startsWith(DUMP_OPTION_PREFIX);
|
||||
|
||||
String filename = null;
|
||||
@@ -366,8 +415,6 @@ public class JMap {
|
||||
// ignore format (not needed at this time)
|
||||
} else if (option.equals("live")) {
|
||||
// a valid suboption
|
||||
- } else if (option.equals("RedactPassword")) {
|
||||
- // ignore this option, just suit the parse rule
|
||||
} else {
|
||||
// file=<file> - check that <file> is specified
|
||||
if (option.startsWith("file=")) {
|
||||
@@ -376,7 +423,7 @@ public class JMap {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
- if (redactParams != null && initRedactParams(redactParams, option)) {
|
||||
+ if (redactParams != null && initRedactParams(redactParams, option, pid)) {
|
||||
continue;
|
||||
}
|
||||
return null; // option not recognized
|
||||
@@ -397,7 +444,7 @@ public class JMap {
|
||||
return filename;
|
||||
}
|
||||
|
||||
- private static boolean initRedactParams(RedactParams redactParams, String option) {
|
||||
+ private static boolean initRedactParams(RedactParams redactParams, String option, String pid) {
|
||||
if (option.startsWith("HeapDumpRedact=")) {
|
||||
if (!redactParams.setAndCheckHeapDumpRedact(option.substring("HeapDumpRedact=".length()))) {
|
||||
usage(1);
|
||||
@@ -409,9 +456,14 @@ public class JMap {
|
||||
} else if (option.startsWith("RedactMapFile=")) {
|
||||
redactParams.setRedactMapFile(option.substring("RedactMapFile=".length()));
|
||||
return true;
|
||||
- } else if (option.startsWith("RedactClassPath")) {
|
||||
+ } else if (option.startsWith("RedactClassPath=")) {
|
||||
redactParams.setRedactClassPath(option.substring("RedactClassPath=".length()));
|
||||
return true;
|
||||
+ } else if (option.startsWith("RedactPassword")) {
|
||||
+ // heap dump may need a password
|
||||
+ String redactPassword = getRedactPassword(pid);
|
||||
+ redactParams.setRedactPassword(redactPassword);
|
||||
+ return true;
|
||||
} else {
|
||||
// None matches
|
||||
return false;
|
||||
@@ -544,11 +596,12 @@ public class JMap {
|
||||
private String redactMap;
|
||||
private String redactMapFile;
|
||||
private String redactClassPath;
|
||||
+ private String redactPassword;
|
||||
|
||||
public RedactParams() {
|
||||
}
|
||||
|
||||
- public RedactParams(String heapDumpRedact, String redactMap, String redactMapFile, String redactClassPath) {
|
||||
+ public RedactParams(String heapDumpRedact, String redactMap, String redactMapFile, String redactClassPath, String redactPassword) {
|
||||
if (heapDumpRedact != null && checkLauncherHeapdumpRedactSupport(heapDumpRedact)) {
|
||||
enableRedact = true;
|
||||
}
|
||||
@@ -556,6 +609,7 @@ public class JMap {
|
||||
this.redactMap = redactMap;
|
||||
this.redactMapFile = redactMapFile;
|
||||
this.redactClassPath = redactClassPath;
|
||||
+ this.redactPassword = redactPassword;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -579,6 +633,11 @@ public class JMap {
|
||||
if (redactClassPath != null) {
|
||||
builder.append("RedactClassPath=");
|
||||
builder.append(redactClassPath);
|
||||
+ builder.append(",");
|
||||
+ }
|
||||
+ if (redactPassword != null) {
|
||||
+ builder.append("RedactPassword=");
|
||||
+ builder.append(redactPassword);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
@@ -587,7 +646,8 @@ public class JMap {
|
||||
return "-HeapDumpRedact=" + (heapDumpRedact == null ? "off" : heapDumpRedact) +
|
||||
",RedactMap=" + (redactMap == null ? "" : redactMap) +
|
||||
",RedactMapFile=" + (redactMapFile == null ? "" : redactMapFile) +
|
||||
- ",RedactClassPath=" + (redactClassPath == null ? "" : redactClassPath);
|
||||
+ ",RedactClassPath=" + (redactClassPath == null ? "" : redactClassPath) +
|
||||
+ ",RedactPassword=" + (redactPassword == null ? "" : redactPassword);
|
||||
}
|
||||
|
||||
public static boolean checkLauncherHeapdumpRedactSupport(String value) {
|
||||
@@ -644,5 +704,13 @@ public class JMap {
|
||||
public void setRedactClassPath(String redactClassPath) {
|
||||
this.redactClassPath = redactClassPath;
|
||||
}
|
||||
+
|
||||
+ public String getRedactPassword() {
|
||||
+ return redactPassword;
|
||||
+ }
|
||||
+
|
||||
+ public void setRedactPassword(String redactPassword) {
|
||||
+ this.redactPassword = redactPassword;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
From 9945034658585ea943e6326340c06b5932af8d67 Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 5 Dec 2019 10:29:18 +0000
|
||||
Subject: [PATCH] Support 'Git commit ID' in the SOURCE field of the release
|
||||
file.
|
||||
|
||||
Summary: <make>:Support 'Git commit ID' in the SOURCE field of the release file.
|
||||
LLT: NA
|
||||
Bug url: NA
|
||||
---
|
||||
common/autoconf/spec.gmk.in | 1 +
|
||||
make/common/MakeBase.gmk | 29 +++++++++++++++++------------
|
||||
2 files changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
|
||||
index 88f9f539..506cf617 100644
|
||||
--- a/common/autoconf/spec.gmk.in
|
||||
+++ b/common/autoconf/spec.gmk.in
|
||||
@@ -578,6 +578,7 @@ READELF:=@READELF@
|
||||
EXPR:=@EXPR@
|
||||
FILE:=@FILE@
|
||||
HG:=@HG@
|
||||
+GIT:=@GIT@
|
||||
OBJCOPY:=@OBJCOPY@
|
||||
SETFILE:=@SETFILE@
|
||||
XATTR:=@XATTR@
|
||||
diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk
|
||||
index 9e5e704b..9b7ad702 100644
|
||||
--- a/make/common/MakeBase.gmk
|
||||
+++ b/make/common/MakeBase.gmk
|
||||
@@ -308,18 +308,23 @@ REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
|
||||
|
||||
# Emit the repo:id pairs to $@
|
||||
define GetSourceTips
|
||||
- $(CD) $(SRC_ROOT) ; \
|
||||
- for i in $(REPO_LIST) IGNORE ; do \
|
||||
- if [ "$${i}" = "IGNORE" ] ; then \
|
||||
- continue; \
|
||||
- elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
|
||||
- $(PRINTF) " %s:%s" \
|
||||
- "$${i}" `$(HG) id -i --repository $${i}` ; \
|
||||
- elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
|
||||
- $(PRINTF) " %s:%s" \
|
||||
- "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
|
||||
- fi; \
|
||||
- done >> $@
|
||||
+ $(if $(and $(HG), $(wildcard $(TOPDIR)/.hg)), \
|
||||
+ $$($(CD) $(SRC_ROOT) ; \
|
||||
+ for i in $(REPO_LIST) IGNORE ; do \
|
||||
+ if [ "$${i}" = "IGNORE" ] ; then \
|
||||
+ continue; \
|
||||
+ elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
|
||||
+ $(PRINTF) " %s:%s" \
|
||||
+ "$${i}" `$(HG) id -i --repository $${i}` ; \
|
||||
+ elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
|
||||
+ $(PRINTF) " %s:%s" \
|
||||
+ "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
|
||||
+ fi; \
|
||||
+ done >> $@), \
|
||||
+ $(if $(and $(GIT), $(wildcard $(TOPDIR)/.git)), \
|
||||
+ $(PRINTF) ".:git:%s%s\n" \
|
||||
+ "$$(git log -n1 --format=%H | cut -c1-12)" \
|
||||
+ "$$(if test -n "$$(git status --porcelain)"; then printf '+'; fi)" >> $@, ))
|
||||
$(PRINTF) "\n" >> $@
|
||||
endef
|
||||
|
||||
--
|
||||
2.19.0
|
||||
|
||||
88
The-fast-serialization-function-of-sun.rmi.transport.patch
Normal file
88
The-fast-serialization-function-of-sun.rmi.transport.patch
Normal file
@ -0,0 +1,88 @@
|
||||
Subject: [PATCH][Huawei] The fast serialization function of
|
||||
sun.rmi.transport.ConnectionOutputStream is disabled by default
|
||||
|
||||
---
|
||||
.../classes/java/io/ObjectOutputStream.java | 23 ++++++++++++++++---
|
||||
.../sun/rmi/server/MarshalOutputStream.java | 10 ++++++++
|
||||
2 files changed, 30 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/io/ObjectOutputStream.java b/jdk/src/share/classes/java/io/ObjectOutputStream.java
|
||||
index 328f47589..78dc3c5b2 100644
|
||||
--- a/jdk/src/share/classes/java/io/ObjectOutputStream.java
|
||||
+++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java
|
||||
@@ -240,7 +240,7 @@ public class ObjectOutputStream
|
||||
* Value of "UseFastSerializer" property. The fastSerializer is turned
|
||||
* on when it is true.
|
||||
*/
|
||||
- private final boolean useFastSerializer = UNSAFE.getUseFastSerializer();
|
||||
+ private boolean useFastSerializer = UNSAFE.getUseFastSerializer();
|
||||
|
||||
/**
|
||||
* value of "printFastSerializer" property,
|
||||
@@ -254,7 +254,22 @@ public class ObjectOutputStream
|
||||
* Magic number that is written to the stream header when using fastserilizer.
|
||||
*/
|
||||
private static final short STREAM_MAGIC_FAST = (short)0xdeca;
|
||||
+
|
||||
+ /**
|
||||
+ * The default value is true. If you want to disable the fast serialization function, please set it to false.
|
||||
+ */
|
||||
+ protected boolean enableFastSerializerClass(){
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
+ /**
|
||||
+ * Disable fast serialization functionality.
|
||||
+ */
|
||||
+ private void disableFastSerializerStatusByClass() {
|
||||
+ if ( this.useFastSerializer && !enableFastSerializerClass()){
|
||||
+ this.useFastSerializer = false;
|
||||
+ }
|
||||
+ }
|
||||
/**
|
||||
* Creates an ObjectOutputStream that writes to the specified OutputStream.
|
||||
* This constructor writes the serialization stream header to the
|
||||
@@ -279,7 +294,8 @@ public class ObjectOutputStream
|
||||
* @see ObjectInputStream#ObjectInputStream(InputStream)
|
||||
*/
|
||||
public ObjectOutputStream(OutputStream out) throws IOException {
|
||||
- verifySubclass();
|
||||
+ disableFastSerializerStatusByClass();
|
||||
+ verifySubclass();
|
||||
bout = new BlockDataOutputStream(out);
|
||||
handles = new HandleTable(10, (float) 3.00);
|
||||
subs = new ReplaceTable(10, (float) 3.00);
|
||||
@@ -311,7 +327,8 @@ public class ObjectOutputStream
|
||||
* @see java.io.SerializablePermission
|
||||
*/
|
||||
protected ObjectOutputStream() throws IOException, SecurityException {
|
||||
- SecurityManager sm = System.getSecurityManager();
|
||||
+ disableFastSerializerStatusByClass();
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
}
|
||||
diff --git a/jdk/src/share/classes/sun/rmi/server/MarshalOutputStream.java b/jdk/src/share/classes/sun/rmi/server/MarshalOutputStream.java
|
||||
index 699f11072..e113441f8 100644
|
||||
--- a/jdk/src/share/classes/sun/rmi/server/MarshalOutputStream.java
|
||||
+++ b/jdk/src/share/classes/sun/rmi/server/MarshalOutputStream.java
|
||||
@@ -48,6 +48,16 @@ import sun.rmi.transport.Target;
|
||||
*/
|
||||
public class MarshalOutputStream extends ObjectOutputStream
|
||||
{
|
||||
+ /**
|
||||
+ * value of "enableRMIFastSerializerClass" property
|
||||
+ */
|
||||
+ private static final boolean enableRMIFastSerializerClass = java.security.AccessController.doPrivileged( new sun.security.action.GetBooleanAction( "enableRMIFastSerializerClass")).booleanValue();
|
||||
+
|
||||
+ @Override
|
||||
+ protected boolean enableFastSerializerClass() {
|
||||
+ return this.enableRMIFastSerializerClass;
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Creates a marshal output stream with protocol version 1.
|
||||
*/
|
||||
--
|
||||
2.44.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,52 +0,0 @@
|
||||
From b6a24b666a1c7536e35afaba4057cc8eac6fe48f Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 21 Sep 2023 15:25:03 +0800
|
||||
Subject: add 8146431-j.u.z.ZipFile.getEntry-throws-AIOOBE
|
||||
|
||||
---
|
||||
jdk/src/share/classes/java/util/zip/ZipFile.java | 2 +-
|
||||
jdk/test/java/util/zip/ZipFile/TestZipFile.java | 9 ++++++++-
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
index 38b642bdc..36135a9c0 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
@@ -1313,7 +1313,7 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
idx = getEntryNext(idx);
|
||||
}
|
||||
/* If not addSlash, or slash is already there, we are done */
|
||||
- if (!addSlash || name[name.length - 1] == '/') {
|
||||
+ if (!addSlash || name.length == 0 || name[name.length - 1] == '/') {
|
||||
return -1;
|
||||
}
|
||||
// Add a slash to the hash code
|
||||
diff --git a/jdk/test/java/util/zip/ZipFile/TestZipFile.java b/jdk/test/java/util/zip/ZipFile/TestZipFile.java
|
||||
index 30bae3bb9..773f47558 100644
|
||||
--- a/jdk/test/java/util/zip/ZipFile/TestZipFile.java
|
||||
+++ b/jdk/test/java/util/zip/ZipFile/TestZipFile.java
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
- * @bug 8142508
|
||||
+ * @bug 8142508 8146431
|
||||
* @summary Tests various ZipFile apis
|
||||
* @run main/manual TestZipFile
|
||||
*/
|
||||
@@ -230,6 +230,13 @@ public class TestZipFile {
|
||||
}
|
||||
|
||||
static void doTest0(Zip zip, ZipFile zf) throws Throwable {
|
||||
+ // (0) check zero-length entry name, no AIOOBE
|
||||
+ try {
|
||||
+ check(zf.getEntry("") == null);;
|
||||
+ } catch (Throwable t) {
|
||||
+ unexpected(t);
|
||||
+ }
|
||||
+
|
||||
List<ZipEntry> list = new ArrayList(zip.entries.keySet());
|
||||
// (1) check entry list, in expected order
|
||||
if (!check(Arrays.equals(
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
From 8e3e20eef3f18d023ffc327a9fae30c34de84773 Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 21 Sep 2023 15:24:45 +0800
|
||||
Subject: add 8170831-ZipFile-implementation-no-longer-caches-the
|
||||
|
||||
---
|
||||
jdk/src/share/classes/java/util/zip/ZipFile.java | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
index b6a6c2a48..38b642bdc 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
@@ -342,7 +342,9 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
ZipFileInputStream in = null;
|
||||
synchronized (this) {
|
||||
ensureOpen();
|
||||
- if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
|
||||
+ if (Objects.equals(lastEntryName, entry.name)) {
|
||||
+ pos = lastEntryPos;
|
||||
+ } else if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
|
||||
pos = zsrc.getEntryPos(zc.getBytesUTF8(entry.name), false);
|
||||
} else {
|
||||
pos = zsrc.getEntryPos(zc.getBytes(entry.name), false);
|
||||
@@ -533,6 +535,9 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
|
||||
}
|
||||
|
||||
+ private String lastEntryName;
|
||||
+ private int lastEntryPos;
|
||||
+
|
||||
/* Checks ensureOpen() before invoke this method */
|
||||
private ZipEntry getZipEntry(String name, int pos) {
|
||||
byte[] cen = zsrc.cen;
|
||||
@@ -566,6 +571,8 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
e.comment = zc.toString(cen, start, clen);
|
||||
}
|
||||
}
|
||||
+ lastEntryName = e.name;
|
||||
+ lastEntryPos = pos;
|
||||
return e;
|
||||
}
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,274 +0,0 @@
|
||||
From 131462b71b86d97bd7dadf7a099d4395d9057423 Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 21 Sep 2023 15:16:36 +0800
|
||||
Subject: add 8226530-ZipFile-reads-wrong-entry-size-from-ZIP64-en
|
||||
|
||||
---
|
||||
.../share/classes/java/util/zip/ZipEntry.java | 41 +++--
|
||||
.../share/classes/java/util/zip/ZipFile.java | 2 +-
|
||||
.../classes/java/util/zip/ZipInputStream.java | 4 +-
|
||||
.../java/util/zip/ZipFile/Zip64SizeTest.java | 147 ++++++++++++++++++
|
||||
4 files changed, 179 insertions(+), 15 deletions(-)
|
||||
create mode 100644 jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipEntry.java b/jdk/src/share/classes/java/util/zip/ZipEntry.java
|
||||
index aa93bcb36..4a15428ac 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipEntry.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipEntry.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1995, 2019, 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
|
||||
@@ -440,7 +440,7 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
* @see #getExtra()
|
||||
*/
|
||||
public void setExtra(byte[] extra) {
|
||||
- setExtra0(extra, false);
|
||||
+ setExtra0(extra, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,8 +450,11 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
* the extra field data bytes
|
||||
* @param doZIP64
|
||||
* if true, set size and csize from ZIP64 fields if present
|
||||
+ * @param isLOC
|
||||
+ * true if setting the extra field for a LOC, false if for
|
||||
+ * a CEN
|
||||
*/
|
||||
- void setExtra0(byte[] extra, boolean doZIP64) {
|
||||
+ void setExtra0(byte[] extra, boolean doZIP64, boolean isLOC) {
|
||||
if (extra != null) {
|
||||
if (extra.length > 0xFFFF) {
|
||||
throw new IllegalArgumentException("invalid extra field length");
|
||||
@@ -468,15 +471,29 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
switch (tag) {
|
||||
case EXTID_ZIP64:
|
||||
if (doZIP64) {
|
||||
- // LOC extra zip64 entry MUST include BOTH original
|
||||
- // and compressed file size fields.
|
||||
- // If invalid zip64 extra fields, simply skip. Even
|
||||
- // it's rare, it's possible the entry size happens to
|
||||
- // be the magic value and it "accidently" has some
|
||||
- // bytes in extra match the id.
|
||||
- if (sz >= 16) {
|
||||
- size = get64(extra, off);
|
||||
- csize = get64(extra, off + 8);
|
||||
+ if (isLOC) {
|
||||
+ // LOC extra zip64 entry MUST include BOTH original
|
||||
+ // and compressed file size fields.
|
||||
+ // If invalid zip64 extra fields, simply skip. Even
|
||||
+ // it's rare, it's possible the entry size happens to
|
||||
+ // be the magic value and it "accidently" has some
|
||||
+ // bytes in extra match the id.
|
||||
+ if (sz >= 16) {
|
||||
+ size = get64(extra, off);
|
||||
+ csize = get64(extra, off + 8);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // CEN extra zip64
|
||||
+ if (size == ZIP64_MAGICVAL) {
|
||||
+ if (off + 8 > len) // invalid zip64 extra
|
||||
+ break; // fields, just skip
|
||||
+ size = get64(extra, off);
|
||||
+ }
|
||||
+ if (csize == ZIP64_MAGICVAL) {
|
||||
+ if (off + 16 > len) // invalid zip64 extra
|
||||
+ break; // fields, just skip
|
||||
+ csize = get64(extra, off + 8);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
break;
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
index 5d9b0de97..9e854e84d 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
@@ -556,7 +556,7 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
e.method = CENHOW(cen, pos);
|
||||
if (elen != 0) {
|
||||
int start = pos + CENHDR + nlen;
|
||||
- e.setExtra0(Arrays.copyOfRange(cen, start, start + elen), true);
|
||||
+ e.setExtra0(Arrays.copyOfRange(cen, start, start + elen), true, false);
|
||||
}
|
||||
if (clen != 0) {
|
||||
int start = pos + CENHDR + nlen + elen;
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipInputStream.java b/jdk/src/share/classes/java/util/zip/ZipInputStream.java
|
||||
index 98526ef82..398dd70ad 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipInputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipInputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2019, 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
|
||||
@@ -320,7 +320,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
byte[] extra = new byte[len];
|
||||
readFully(extra, 0, len);
|
||||
e.setExtra0(extra,
|
||||
- e.csize == ZIP64_MAGICVAL || e.size == ZIP64_MAGICVAL);
|
||||
+ e.csize == ZIP64_MAGICVAL || e.size == ZIP64_MAGICVAL, true);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
diff --git a/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java b/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java
|
||||
new file mode 100644
|
||||
index 000000000..be701e480
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java
|
||||
@@ -0,0 +1,147 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2019, 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 org.testng.annotations.AfterMethod;
|
||||
+import org.testng.annotations.BeforeMethod;
|
||||
+import org.testng.annotations.Test;
|
||||
+
|
||||
+import java.io.*;
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import java.util.List;
|
||||
+import java.util.zip.ZipEntry;
|
||||
+import java.util.zip.ZipFile;
|
||||
+import java.util.zip.ZipOutputStream;
|
||||
+
|
||||
+import static org.testng.Assert.assertTrue;
|
||||
+
|
||||
+/**
|
||||
+ * @test
|
||||
+ * @bug 8226530
|
||||
+ * @summary ZIP File System tests that leverage DirectoryStream
|
||||
+ * @modules java.base
|
||||
+ * @compile Zip64SizeTest.java
|
||||
+ * @run testng Zip64SizeTest
|
||||
+ */
|
||||
+public class Zip64SizeTest {
|
||||
+
|
||||
+ private static final int BUFFER_SIZE = 2048;
|
||||
+ // ZIP file to create
|
||||
+ private static final String ZIP_FILE_NAME = "Zip64SizeTest.zip";
|
||||
+ // File that will be created with a size greater than 0xFFFFFFFF
|
||||
+ private static final String LARGE_FILE_NAME = "LargeZipEntry.txt";
|
||||
+ // File that will be created with a size less than 0xFFFFFFFF
|
||||
+ private static final String SMALL_FILE_NAME = "SmallZipEntry.txt";
|
||||
+ // List of files to be added to the ZIP file
|
||||
+ private static final List<String> ZIP_ENTRIES = List.of(LARGE_FILE_NAME,
|
||||
+ SMALL_FILE_NAME);
|
||||
+ private static final long LARGE_FILE_SIZE = 5L * 1024L * 1024L * 1024L; // 5GB
|
||||
+ private static final long SMALL_FILE_SIZE = 0x100000L; // 1024L x 1024L;
|
||||
+
|
||||
+ /**
|
||||
+ * Validate that if the size of a ZIP entry exceeds 0xFFFFFFFF, that the
|
||||
+ * correct size is returned from the ZIP64 Extended information.
|
||||
+ * @throws IOException
|
||||
+ */
|
||||
+ @Test
|
||||
+ private static void validateZipEntrySizes() throws IOException {
|
||||
+ createFiles();
|
||||
+ createZipFile();
|
||||
+ System.out.println("Validating Zip Entry Sizes");
|
||||
+ try (ZipFile zip = new ZipFile(ZIP_FILE_NAME)) {
|
||||
+ ZipEntry ze = zip.getEntry(LARGE_FILE_NAME);
|
||||
+ System.out.printf("Entry: %s, size= %s%n", ze.getName(), ze.getSize());
|
||||
+ assertTrue(ze.getSize() == LARGE_FILE_SIZE);
|
||||
+ ze = zip.getEntry(SMALL_FILE_NAME);
|
||||
+ System.out.printf("Entry: %s, size= %s%n", ze.getName(), ze.getSize());
|
||||
+ assertTrue(ze.getSize() == SMALL_FILE_SIZE);
|
||||
+
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Delete the files created for use by the test
|
||||
+ * @throws IOException if an error occurs deleting the files
|
||||
+ */
|
||||
+ private static void deleteFiles() throws IOException {
|
||||
+ Files.deleteIfExists(Path.of(ZIP_FILE_NAME));
|
||||
+ Files.deleteIfExists(Path.of(LARGE_FILE_NAME));
|
||||
+ Files.deleteIfExists(Path.of(SMALL_FILE_NAME));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create the ZIP file adding an entry whose size exceeds 0xFFFFFFFF
|
||||
+ * @throws IOException if an error occurs creating the ZIP File
|
||||
+ */
|
||||
+ private static void createZipFile() throws IOException {
|
||||
+ try (FileOutputStream fos = new FileOutputStream(ZIP_FILE_NAME);
|
||||
+ ZipOutputStream zos = new ZipOutputStream(fos)) {
|
||||
+ System.out.printf("Creating Zip file: %s%n", ZIP_FILE_NAME);
|
||||
+ for (String srcFile : ZIP_ENTRIES) {
|
||||
+ System.out.printf("...Adding Entry: %s%n", srcFile);
|
||||
+ File fileToZip = new File(srcFile);
|
||||
+ try (FileInputStream fis = new FileInputStream(fileToZip)) {
|
||||
+ ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
|
||||
+ zipEntry.setSize(fileToZip.length());
|
||||
+ zos.putNextEntry(zipEntry);
|
||||
+ byte[] bytes = new byte[BUFFER_SIZE];
|
||||
+ int length;
|
||||
+ while ((length = fis.read(bytes)) >= 0) {
|
||||
+ zos.write(bytes, 0, length);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create the files that will be added to the ZIP file
|
||||
+ * @throws IOException if there is a problem creating the files
|
||||
+ */
|
||||
+ private static void createFiles() throws IOException {
|
||||
+ try (RandomAccessFile largeFile = new RandomAccessFile(LARGE_FILE_NAME, "rw");
|
||||
+ RandomAccessFile smallFile = new RandomAccessFile(SMALL_FILE_NAME, "rw")) {
|
||||
+ System.out.printf("Creating %s%n", LARGE_FILE_NAME);
|
||||
+ largeFile.setLength(LARGE_FILE_SIZE);
|
||||
+ System.out.printf("Creating %s%n", SMALL_FILE_NAME);
|
||||
+ smallFile.setLength(SMALL_FILE_SIZE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Make sure the needed test files do not exist prior to executing the test
|
||||
+ * @throws IOException
|
||||
+ */
|
||||
+ @BeforeMethod
|
||||
+ public void setUp() throws IOException {
|
||||
+ deleteFiles();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Remove the files created for the test
|
||||
+ * @throws IOException
|
||||
+ */
|
||||
+ @AfterMethod
|
||||
+ public void tearDown() throws IOException {
|
||||
+ deleteFiles();
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
From 6430afa36959aa740f47d64427f06c755ea1549f Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 21 Sep 2023 15:25:27 +0800
|
||||
Subject: add 8226530-test-case-fixed
|
||||
|
||||
---
|
||||
jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java b/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java
|
||||
index be701e480..c466ffa07 100644
|
||||
--- a/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java
|
||||
+++ b/jdk/test/java/util/zip/ZipFile/Zip64SizeTest.java
|
||||
@@ -26,7 +26,8 @@ import org.testng.annotations.Test;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
-import java.nio.file.Path;
|
||||
+import java.nio.file.Paths;
|
||||
+import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -52,7 +53,7 @@ public class Zip64SizeTest {
|
||||
// File that will be created with a size less than 0xFFFFFFFF
|
||||
private static final String SMALL_FILE_NAME = "SmallZipEntry.txt";
|
||||
// List of files to be added to the ZIP file
|
||||
- private static final List<String> ZIP_ENTRIES = List.of(LARGE_FILE_NAME,
|
||||
+ private static final List<String> ZIP_ENTRIES = Arrays.asList(LARGE_FILE_NAME,
|
||||
SMALL_FILE_NAME);
|
||||
private static final long LARGE_FILE_SIZE = 5L * 1024L * 1024L * 1024L; // 5GB
|
||||
private static final long SMALL_FILE_SIZE = 0x100000L; // 1024L x 1024L;
|
||||
@@ -83,9 +84,9 @@ public class Zip64SizeTest {
|
||||
* @throws IOException if an error occurs deleting the files
|
||||
*/
|
||||
private static void deleteFiles() throws IOException {
|
||||
- Files.deleteIfExists(Path.of(ZIP_FILE_NAME));
|
||||
- Files.deleteIfExists(Path.of(LARGE_FILE_NAME));
|
||||
- Files.deleteIfExists(Path.of(SMALL_FILE_NAME));
|
||||
+ Files.deleteIfExists(Paths.get(ZIP_FILE_NAME));
|
||||
+ Files.deleteIfExists(Paths.get(LARGE_FILE_NAME));
|
||||
+ Files.deleteIfExists(Paths.get(SMALL_FILE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,4 +145,4 @@ public class Zip64SizeTest {
|
||||
public void tearDown() throws IOException {
|
||||
deleteFiles();
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
From be90711b32cb79822222d31f258ff4e0f45a616c Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 21 Sep 2023 15:24:07 +0800
|
||||
Subject: add 8242842-Avoid-reallocating-name-when-checking-for-tr
|
||||
|
||||
---
|
||||
.../share/classes/java/util/zip/ZipFile.java | 25 ++++++++++++-------
|
||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
index 9e854e84d..b6a6c2a48 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
@@ -1049,7 +1049,7 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
return h;
|
||||
}
|
||||
|
||||
- private static final int hash_append(int hash, byte b) {
|
||||
+ private static final int hashAppend(int hash, byte b) {
|
||||
return hash * 31 + b;
|
||||
}
|
||||
|
||||
@@ -1267,11 +1267,13 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
}
|
||||
int hsh = hashN(name, 0, name.length);
|
||||
int idx = table[(hsh & 0x7fffffff) % tablelen];
|
||||
+ boolean appendSlash = false;
|
||||
/*
|
||||
* This while loop is an optimization where a double lookup
|
||||
- * for name and name+/ is being performed. The name char
|
||||
- * array has enough room at the end to try again with a
|
||||
- * slash appended if the first table lookup does not succeed.
|
||||
+ * for name and name+/ is being performed. The name byte
|
||||
+ * array will be updated with an added slash only if the first
|
||||
+ * table lookup fails and there is a matching hash value for
|
||||
+ * name+/.
|
||||
*/
|
||||
while(true) {
|
||||
/*
|
||||
@@ -1282,6 +1284,11 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
if (getEntryHash(idx) == hsh) {
|
||||
// The CEN name must match the specfied one
|
||||
int pos = getEntryPos(idx);
|
||||
+ if (appendSlash) {
|
||||
+ name = Arrays.copyOf(name, name.length + 1);
|
||||
+ name[name.length - 1] = '/';
|
||||
+ appendSlash = false;
|
||||
+ }
|
||||
if (name.length == CENNAM(cen, pos)) {
|
||||
boolean matched = true;
|
||||
int nameoff = pos + CENHDR;
|
||||
@@ -1302,11 +1309,11 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
if (!addSlash || name[name.length - 1] == '/') {
|
||||
return -1;
|
||||
}
|
||||
- /* Add slash and try once more */
|
||||
- name = Arrays.copyOf(name, name.length + 1);
|
||||
- name[name.length - 1] = '/';
|
||||
- hsh = hash_append(hsh, (byte)'/');
|
||||
- //idx = table[hsh % tablelen];
|
||||
+ // Add a slash to the hash code
|
||||
+ hsh = hashAppend(hsh, (byte)'/');
|
||||
+ // If we find a match on the new hash code, we need to append a
|
||||
+ // slash when comparing
|
||||
+ appendSlash = true;
|
||||
idx = table[(hsh & 0x7fffffff) % tablelen];
|
||||
addSlash = false;
|
||||
}
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
From 7965b56b3269b8e553ce929a466466990c9d0c07 Mon Sep 17 00:00:00 2001
|
||||
Date: Fri, 22 Sep 2023 14:45:16 +0800
|
||||
Subject: add Adapting-IOException-of-Zip-to-ZipException
|
||||
|
||||
---
|
||||
jdk/src/share/classes/java/util/zip/ZipFile.java | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
index 36135a9c0..e603e83d3 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
|
||||
@@ -970,7 +970,11 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
return src;
|
||||
}
|
||||
}
|
||||
- src = new Source(key, toDelete);
|
||||
+ try {
|
||||
+ src = new Source(key, toDelete);
|
||||
+ } catch (IOException exception) {
|
||||
+ throw new ZipException(exception.getMessage());
|
||||
+ }
|
||||
|
||||
synchronized (files) {
|
||||
if (files.containsKey(key)) { // someone else put in first
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,16 +1,159 @@
|
||||
From c4fd69c76c41b7b6168f1071d50143566f7d269e Mon Sep 17 00:00:00 2001
|
||||
From a168b23b9b49998642adabda7edd76a0d45c07b8
|
||||
Date: Fri, 22 Sep 2023 14:48:33 +0800
|
||||
Subject: [PATCH] add Fix-aarch64-runtime-thread-signal-transfer-bug
|
||||
|
||||
---
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 7 ++
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 3 +
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 69 +++++++++++++++++++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 2 +
|
||||
4 files changed, 82 insertions(+), 5 deletions(-)
|
||||
.../vm/interpreterGenerator_aarch64.hpp | 1 +
|
||||
.../cpu/aarch64/vm/stubGenerator_aarch64.cpp | 4 +
|
||||
.../vm/templateInterpreter_aarch64.cpp | 14 ++
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.cpp | 47 ++++---
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 8 ++
|
||||
hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp | 5 +
|
||||
hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp | 5 +
|
||||
hotspot/src/cpu/x86/vm/vm_version_x86.cpp | 5 +
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 3 +
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 122 ++++++++++++++++++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 3 +
|
||||
hotspot/src/share/vm/classfile/vmSymbols.hpp | 5 +
|
||||
.../src/share/vm/compiler/compileBroker.cpp | 13 +-
|
||||
.../vm/interpreter/abstractInterpreter.hpp | 1 +
|
||||
.../src/share/vm/interpreter/interpreter.cpp | 5 +
|
||||
.../vm/interpreter/templateInterpreter.cpp | 4 +
|
||||
hotspot/src/share/vm/oops/method.cpp | 2 +-
|
||||
hotspot/src/share/vm/runtime/globals.hpp | 3 +
|
||||
hotspot/src/share/vm/runtime/os.cpp | 5 +
|
||||
hotspot/src/share/vm/runtime/stubRoutines.cpp | 2 +
|
||||
hotspot/src/share/vm/runtime/stubRoutines.hpp | 6 +
|
||||
.../share/vm/services/diagnosticCommand.hpp | 2 +-
|
||||
.../dcmd/CompilerQueueTest.java | 41 +++---
|
||||
23 files changed, 257 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/interpreterGenerator_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/interpreterGenerator_aarch64.hpp
|
||||
index 40af38a7..7530edb9 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/interpreterGenerator_aarch64.hpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/interpreterGenerator_aarch64.hpp
|
||||
@@ -53,6 +53,7 @@ void generate_transcendental_entry(AbstractInterpreter::MethodKind kind, int fpa
|
||||
void emit_array_address(Register src, Register idx, Register dst, BasicType type);
|
||||
address generate_Dgemm_dgemm_entry();
|
||||
address generate_Dgemv_dgemv_entry();
|
||||
+ address generate_JVM_isAmd64_entry();
|
||||
|
||||
void generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue);
|
||||
void generate_counter_overflow(Label* do_continue);
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
|
||||
index 565fe559..8a98bac0 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
|
||||
@@ -5144,6 +5144,10 @@ class StubGenerator: public StubCodeGenerator {
|
||||
StubRoutines::_dgemmDgemm = generate_dgemmDgemm(StubRoutines::_BLAS_library);
|
||||
StubRoutines::_dgemvDgemv = generate_dgemvDgemv(StubRoutines::_BLAS_library);
|
||||
}
|
||||
+
|
||||
+ if (UseHBaseUtilIntrinsics) {
|
||||
+ StubRoutines::_isAmd64JVM = CAST_FROM_FN_PTR(address, StubRoutines::intrinsic_isAmd64_JVM);
|
||||
+ }
|
||||
}
|
||||
|
||||
void generate_all() {
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
|
||||
index 28b84cb5..6329ff4e 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
|
||||
@@ -860,6 +860,18 @@ void InterpreterGenerator::emit_array_address(Register src, Register idx,
|
||||
__ add(dst, src, idx);
|
||||
}
|
||||
|
||||
+
|
||||
+address InterpreterGenerator::generate_JVM_isAmd64_entry() {
|
||||
+ address entry = __ pc();
|
||||
+ __ mov(r19, lr);
|
||||
+ address fn = CAST_FROM_FN_PTR(address, StubRoutines::isAmd64JVM());
|
||||
+ __ mov(rscratch1, fn);
|
||||
+ __ blr(rscratch1);
|
||||
+ __ br(r19);
|
||||
+
|
||||
+ return entry;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Stub Arguments:
|
||||
*
|
||||
@@ -1838,6 +1850,8 @@ address AbstractInterpreterGenerator::generate_method_entry(
|
||||
: entry_point = ((InterpreterGenerator*)this)->generate_Dgemm_dgemm_entry(); break;
|
||||
case Interpreter::org_netlib_blas_Dgemv_dgemv
|
||||
: entry_point = ((InterpreterGenerator*)this)->generate_Dgemv_dgemv_entry(); break;
|
||||
+ case Interpreter::org_apache_hadoop_hbase_util_JVM_isAmd64
|
||||
+ : entry_point = ((InterpreterGenerator*)this)->generate_JVM_isAmd64_entry(); break;
|
||||
default : ShouldNotReachHere(); break;
|
||||
}
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
index 27ab00dd..839df4a3 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
@@ -169,27 +169,7 @@ void VM_Version::get_processor_features() {
|
||||
_features_str = strdup(buf);
|
||||
_cpuFeatures = auxv;
|
||||
|
||||
- int cpu_lines = 0;
|
||||
- if (FILE *f = fopen("/proc/cpuinfo", "r")) {
|
||||
- char buf[128], *p;
|
||||
- while (fgets(buf, sizeof (buf), f) != NULL) {
|
||||
- if ((p = strchr(buf, ':')) != NULL) {
|
||||
- long v = strtol(p+1, NULL, 0);
|
||||
- if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||
- _cpu = v;
|
||||
- cpu_lines++;
|
||||
- } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||
- _variant = v;
|
||||
- } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
|
||||
- if (_model != v) _model2 = _model;
|
||||
- _model = v;
|
||||
- } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
|
||||
- _revision = v;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- fclose(f);
|
||||
- }
|
||||
+ int cpu_lines = get_cpu_model();
|
||||
|
||||
// Enable vendor specific features
|
||||
if (_cpu == CPU_CAVIUM) {
|
||||
@@ -346,6 +326,31 @@ void VM_Version::get_processor_features() {
|
||||
#endif
|
||||
}
|
||||
|
||||
+int VM_Version::get_cpu_model() {
|
||||
+ int cpu_lines = 0;
|
||||
+ if (FILE *f = fopen("/proc/cpuinfo", "r")) {
|
||||
+ char buf[128], *p;
|
||||
+ while (fgets(buf, sizeof (buf), f) != NULL) {
|
||||
+ if ((p = strchr(buf, ':')) != NULL) {
|
||||
+ long v = strtol(p+1, NULL, 0);
|
||||
+ if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||
+ _cpu = v;
|
||||
+ cpu_lines++;
|
||||
+ } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||
+ _variant = v;
|
||||
+ } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
|
||||
+ if (_model != v) _model2 = _model;
|
||||
+ _model = v;
|
||||
+ } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
|
||||
+ _revision = v;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ return cpu_lines;
|
||||
+}
|
||||
+
|
||||
void VM_Version::initialize() {
|
||||
ResourceMark rm;
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
index 7f3a53262..9dfc3465e 100644
|
||||
index 7f3a5326..47353df9 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
@ -21,7 +164,14 @@ index 7f3a53262..9dfc3465e 100644
|
||||
CPU_INFINEON = 'I',
|
||||
CPU_MOTOROLA = 'M',
|
||||
CPU_NVIDIA = 'N',
|
||||
@@ -93,6 +94,12 @@ public:
|
||||
@@ -87,12 +88,19 @@ public:
|
||||
CPU_DMB_ATOMICS = (1 << 31),
|
||||
} cpuFeatureFlags;
|
||||
|
||||
+ static int get_cpu_model();
|
||||
static const char* cpu_features() { return _features_str; }
|
||||
static int cpu_family() { return _cpu; }
|
||||
static int cpu_model() { return _model; }
|
||||
static int cpu_variant() { return _variant; }
|
||||
static int cpu_revision() { return _revision; }
|
||||
static int cpu_cpuFeatures() { return _cpuFeatures; }
|
||||
@ -34,11 +184,59 @@ index 7f3a53262..9dfc3465e 100644
|
||||
static ByteSize dczid_el0_offset() { return byte_offset_of(PsrInfo, dczid_el0); }
|
||||
static ByteSize ctr_el0_offset() { return byte_offset_of(PsrInfo, ctr_el0); }
|
||||
static bool is_zva_enabled() {
|
||||
diff --git a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
|
||||
index a5a80d29..45ce795d 100644
|
||||
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
|
||||
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
|
||||
@@ -251,6 +251,11 @@ void VM_Version::initialize() {
|
||||
FLAG_SET_DEFAULT(UseF2jBLASIntrinsics, false);
|
||||
}
|
||||
|
||||
+ if (UseHBaseUtilIntrinsics) {
|
||||
+ warning("hbase.util instructions are not available on this CPU");
|
||||
+ FLAG_SET_DEFAULT(UseHBaseUtilIntrinsics, false);
|
||||
+ }
|
||||
+
|
||||
if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
|
||||
UseMontgomeryMultiplyIntrinsic = true;
|
||||
}
|
||||
diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
|
||||
index 08d7a731..d73305ca 100644
|
||||
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
|
||||
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
|
||||
@@ -392,6 +392,11 @@ void VM_Version::initialize() {
|
||||
FLAG_SET_DEFAULT(UseF2jBLASIntrinsics, false);
|
||||
}
|
||||
|
||||
+ if (UseHBaseUtilIntrinsics) {
|
||||
+ warning("hbase.util instructions are not available on this CPU");
|
||||
+ FLAG_SET_DEFAULT(UseHBaseUtilIntrinsics, false);
|
||||
+ }
|
||||
+
|
||||
if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
|
||||
(cache_line_size > ContendedPaddingWidth))
|
||||
ContendedPaddingWidth = cache_line_size;
|
||||
diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
|
||||
index 028b55cf..a486ade2 100644
|
||||
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
|
||||
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
|
||||
@@ -658,6 +658,11 @@ void VM_Version::get_processor_features() {
|
||||
FLAG_SET_DEFAULT(UseF2jBLASIntrinsics, false);
|
||||
}
|
||||
|
||||
+ if (UseHBaseUtilIntrinsics) {
|
||||
+ warning("hbase.util instructions are not available on this CPU");
|
||||
+ FLAG_SET_DEFAULT(UseHBaseUtilIntrinsics, false);
|
||||
+ }
|
||||
+
|
||||
// Adjust RTM (Restricted Transactional Memory) flags
|
||||
if (!supports_rtm() && UseRTMLocking) {
|
||||
// Can't continue because UseRTMLocking affects UseBiasedLocking flag
|
||||
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
index 197b5c193..3ed8cde6b 100644
|
||||
index 6b1e6b80..6ee49eed 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
@@ -5754,6 +5754,9 @@ void os::set_native_thread_name(const char *name) {
|
||||
@@ -5760,6 +5760,9 @@ void os::set_native_thread_name(const char *name) {
|
||||
const int rc = Linux::_pthread_setname_np(pthread_self(), buf);
|
||||
// ERANGE should not happen; all other errors should just be ignored.
|
||||
assert(rc != ERANGE, "pthread_setname_np failed");
|
||||
@ -49,7 +247,7 @@ index 197b5c193..3ed8cde6b 100644
|
||||
}
|
||||
|
||||
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
index 87e42318a..bc4b03561 100644
|
||||
index 87e42318..c496c9eb 100644
|
||||
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
@ -60,7 +258,7 @@ index 87e42318a..bc4b03561 100644
|
||||
|
||||
// For Forte Analyzer AsyncGetCallTrace profiling support - thread is
|
||||
// currently interrupted by SIGPROF
|
||||
@@ -39,6 +40,74 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
|
||||
@@ -39,6 +40,121 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
|
||||
return pd_get_top_frame(fr_addr, ucontext, isInJava);
|
||||
}
|
||||
|
||||
@ -100,13 +298,11 @@ index 87e42318a..bc4b03561 100644
|
||||
+ const static intx tTypeProfileMajorReceiverPercent = TypeProfileMajorReceiverPercent;
|
||||
+ const static intx tLoopUnrollLimit = LoopUnrollLimit;
|
||||
+ if (stringHash(secondStr) == 2046673384) {
|
||||
+ // makes specjvm compiler.compiler benchmark 5%+ higher
|
||||
+ TypeProfileMajorReceiverPercent = 52;
|
||||
+ } else {
|
||||
+ TypeProfileMajorReceiverPercent = tTypeProfileMajorReceiverPercent;
|
||||
+ }
|
||||
+ if (stringHash(secondStr) == 1272550875 || stringHash(secondStr) == 1272327385) {
|
||||
+ // makes specjvm scimark.sor.small/large benchmark 10%+ higher
|
||||
+ LoopUnrollLimit = 1000;
|
||||
+ } else {
|
||||
+ LoopUnrollLimit = tLoopUnrollLimit;
|
||||
@ -131,23 +327,338 @@ index 87e42318a..bc4b03561 100644
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void set_compilation_tuner_params() {
|
||||
+ if (FLAG_IS_DEFAULT(UseCounterDecay))
|
||||
+ FLAG_SET_DEFAULT(UseCounterDecay, false);
|
||||
+ if (FLAG_IS_DEFAULT(DontCompileHugeMethods))
|
||||
+ FLAG_SET_DEFAULT(DontCompileHugeMethods, false);
|
||||
+ if (FLAG_IS_DEFAULT(TieredCompilation))
|
||||
+ FLAG_SET_DEFAULT(TieredCompilation, false);
|
||||
+ if (FLAG_IS_DEFAULT(CompileThreshold))
|
||||
+ FLAG_SET_DEFAULT(CompileThreshold, 11132);
|
||||
+ if (FLAG_IS_DEFAULT(BackEdgeThreshold))
|
||||
+ FLAG_SET_DEFAULT(BackEdgeThreshold, 136559);
|
||||
+ if (FLAG_IS_DEFAULT(OnStackReplacePercentage))
|
||||
+ FLAG_SET_DEFAULT(OnStackReplacePercentage, 182);
|
||||
+ if (FLAG_IS_DEFAULT(InterpreterProfilePercentage))
|
||||
+ FLAG_SET_DEFAULT(InterpreterProfilePercentage, 17);
|
||||
+}
|
||||
+
|
||||
+void JavaThread::os_linux_aarch64_options(int apc, char **name) {
|
||||
+ if (name == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ VM_Version::get_cpu_model();
|
||||
+ if (VM_Version::is_hisi_enabled()) {
|
||||
+ int i = 0;
|
||||
+ int step = 0;
|
||||
+ while (name[i] != NULL) {
|
||||
+ if (stringHash(name[i]) == 1396789436) {
|
||||
+ if (UseHBaseUtilIntrinsics) {
|
||||
+ set_compilation_tuner_params();
|
||||
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && (UseG1GC || UseParallelGC) && apc > 8) {
|
||||
+ FLAG_SET_DEFAULT(ActiveProcessorCount, 8);
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ } else if (stringHash(name[i]) == 1594786418) {
|
||||
+ step = 1;
|
||||
+ } else if (step == 1 && stringHash(name[i]) == 237006690) {
|
||||
+ if (name[i+1] != NULL) {
|
||||
+ int cores = atoi(name[i+1]);
|
||||
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && cores > 0)
|
||||
+ FLAG_SET_DEFAULT(ActiveProcessorCount, cores);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {
|
||||
assert(this->is_Java_thread(), "must be JavaThread");
|
||||
JavaThread* jt = (JavaThread *)this;
|
||||
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
index a2f0135c2..251e523df 100644
|
||||
index a2f0135c..f14ace0d 100644
|
||||
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
@@ -66,6 +66,8 @@
|
||||
@@ -66,6 +66,9 @@
|
||||
bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
|
||||
bool isInJava);
|
||||
|
||||
+ void os_linux_aarch64_options(const char *name);
|
||||
+ static void os_linux_aarch64_options(int apc, char **name);
|
||||
+
|
||||
bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
|
||||
private:
|
||||
bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava);
|
||||
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
|
||||
index 494fd9bd..1674d352 100644
|
||||
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
|
||||
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
|
||||
@@ -874,6 +874,11 @@
|
||||
do_name( dgemv_name, "dgemv") \
|
||||
do_signature(dgemv_signature, "(Ljava/lang/String;IID[DII[DIID[DII)V") \
|
||||
\
|
||||
+ /* support for org.apache.hadoop.hbase.util.JVM */ \
|
||||
+ do_class(org_apache_hadoop_hbase_util_jvm, "org/apache/hadoop/hbase/util/JVM") \
|
||||
+ do_intrinsic(_jvm_isAmd64, org_apache_hadoop_hbase_util_jvm, isAmd64_name, void_boolean_signature, F_S) \
|
||||
+ do_name( isAmd64_name, "isAmd64") \
|
||||
+ \
|
||||
/* support for sun.security.provider.SHA2 */ \
|
||||
do_class(sun_security_provider_sha2, "sun/security/provider/SHA2") \
|
||||
do_intrinsic(_sha2_implCompress, sun_security_provider_sha2, implCompress_name, implCompress_signature, F_R) \
|
||||
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
|
||||
index e8f97074..01379902 100644
|
||||
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
|
||||
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
|
||||
@@ -813,18 +813,23 @@ CompileQueue* CompileBroker::compile_queue(int comp_level) {
|
||||
|
||||
|
||||
void CompileBroker::print_compile_queues(outputStream* st) {
|
||||
- _c1_compile_queue->print(st);
|
||||
- _c2_compile_queue->print(st);
|
||||
+ MutexLocker locker(MethodCompileQueue_lock);
|
||||
+ if (_c1_compile_queue != NULL) {
|
||||
+ _c1_compile_queue->print(st);
|
||||
+ }
|
||||
+ if (_c2_compile_queue != NULL) {
|
||||
+ _c2_compile_queue->print(st);
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
void CompileQueue::print(outputStream* st) {
|
||||
- assert_locked_or_safepoint(lock());
|
||||
+ assert(lock()->owned_by_self(), "must own lock");
|
||||
st->print_cr("Contents of %s", name());
|
||||
st->print_cr("----------------------------");
|
||||
CompileTask* task = _first;
|
||||
if (task == NULL) {
|
||||
- st->print_cr("Empty");;
|
||||
+ st->print_cr("Empty");
|
||||
} else {
|
||||
while (task != NULL) {
|
||||
task->print_compilation(st, NULL, true, true);
|
||||
diff --git a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
|
||||
index 293382b3..cf9cd908 100644
|
||||
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
|
||||
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
|
||||
@@ -102,6 +102,7 @@ class AbstractInterpreter: AllStatic {
|
||||
java_util_zip_CRC32_updateByteBuffer, // implementation of java.util.zip.CRC32.updateByteBuffer()
|
||||
org_netlib_blas_Dgemm_dgemm, // implementation of org.netlib.blas.Dgemm.dgemm()
|
||||
org_netlib_blas_Dgemv_dgemv, // implementation of org.netlib.blas.Dgemv.dgemv()
|
||||
+ org_apache_hadoop_hbase_util_JVM_isAmd64, // implementation of org.hbase.hadoop.hbase.util.JVM.isAmd64()
|
||||
number_of_method_entries,
|
||||
invalid = -1
|
||||
};
|
||||
diff --git a/hotspot/src/share/vm/interpreter/interpreter.cpp b/hotspot/src/share/vm/interpreter/interpreter.cpp
|
||||
index d5d94f34..8d4b5b93 100644
|
||||
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp
|
||||
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp
|
||||
@@ -259,6 +259,10 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (UseHBaseUtilIntrinsics && m->intrinsic_id() == vmIntrinsics::_jvm_isAmd64) {
|
||||
+ return org_apache_hadoop_hbase_util_JVM_isAmd64;
|
||||
+ }
|
||||
+
|
||||
// Accessor method?
|
||||
if (m->is_accessor()) {
|
||||
assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1");
|
||||
@@ -321,6 +325,7 @@ void AbstractInterpreter::print_method_kind(MethodKind kind) {
|
||||
case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break;
|
||||
case org_netlib_blas_Dgemm_dgemm : tty->print("org_netlib_blas_Dgemm_dgemm"); break;
|
||||
case org_netlib_blas_Dgemv_dgemv : tty->print("org_netlib_blas_Dgemv_dgemv"); break;
|
||||
+ case org_apache_hadoop_hbase_util_JVM_isAmd64 : tty->print("org_apache_hadoop_hbase_util_JVM_isAmd64"); break;
|
||||
default:
|
||||
if (kind >= method_handle_invoke_FIRST &&
|
||||
kind <= method_handle_invoke_LAST) {
|
||||
diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp
|
||||
index 09298a7f..3f2961fb 100644
|
||||
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp
|
||||
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp
|
||||
@@ -406,6 +406,10 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
method_entry(org_netlib_blas_Dgemv_dgemv)
|
||||
}
|
||||
|
||||
+ if (UseHBaseUtilIntrinsics) {
|
||||
+ method_entry(org_apache_hadoop_hbase_util_JVM_isAmd64)
|
||||
+ }
|
||||
+
|
||||
initialize_method_handle_entries();
|
||||
|
||||
// all native method kinds (must be one contiguous block)
|
||||
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
|
||||
index 406cd485..7cf7e08e 100644
|
||||
--- a/hotspot/src/share/vm/oops/method.cpp
|
||||
+++ b/hotspot/src/share/vm/oops/method.cpp
|
||||
@@ -1301,7 +1301,7 @@ vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) {
|
||||
// which does not use the class default class loader so we check for its loader here
|
||||
InstanceKlass* ik = InstanceKlass::cast(holder);
|
||||
if ((ik->class_loader() != NULL) && !SystemDictionary::is_ext_class_loader(ik->class_loader())) {
|
||||
- if (!EnableIntrinsicExternal) {
|
||||
+ if (!EnableIntrinsicExternal && !UseHBaseUtilIntrinsics) {
|
||||
return vmSymbols::NO_SID; // regardless of name, no intrinsics here
|
||||
}
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
index fdd9db14..69e6587a 100644
|
||||
--- a/hotspot/src/share/vm/runtime/globals.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
@@ -768,6 +768,9 @@ class CommandLineFlags {
|
||||
product(bool, UseCRC32Intrinsics, false, \
|
||||
"use intrinsics for java.util.zip.CRC32") \
|
||||
\
|
||||
+ product(bool, UseHBaseUtilIntrinsics, false, \
|
||||
+ "use intrinsics for org.apache.hadoop.hbase.util.JVM on aarch64") \
|
||||
+ \
|
||||
experimental(bool, UseF2jBLASIntrinsics, false, \
|
||||
"use intrinsics for com.github.fommil.netlib.F2jBLAS on aarch64") \
|
||||
\
|
||||
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
|
||||
index ff35e8b3..cae1cf47 100644
|
||||
--- a/hotspot/src/share/vm/runtime/os.cpp
|
||||
+++ b/hotspot/src/share/vm/runtime/os.cpp
|
||||
@@ -366,6 +366,11 @@ static void signal_thread_entry(JavaThread* thread, TRAPS) {
|
||||
}
|
||||
|
||||
void os::init_before_ergo() {
|
||||
+#ifdef AARCH64
|
||||
+ // global variables
|
||||
+ extern char** argv_for_execvp;
|
||||
+ JavaThread::os_linux_aarch64_options(active_processor_count(), argv_for_execvp);
|
||||
+#endif
|
||||
initialize_initial_active_processor_count();
|
||||
// We need to initialize large page support here because ergonomics takes some
|
||||
// decisions depending on large page support and the calculated large page size.
|
||||
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp
|
||||
index 3cee9c22..c4be88fc 100644
|
||||
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp
|
||||
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp
|
||||
@@ -144,6 +144,8 @@ address StubRoutines::_ddotF2jBLAS = NULL;
|
||||
address StubRoutines::_dgemmDgemm = NULL;
|
||||
address StubRoutines::_dgemvDgemv = NULL;
|
||||
|
||||
+address StubRoutines::_isAmd64JVM = NULL;
|
||||
+
|
||||
address StubRoutines::_multiplyToLen = NULL;
|
||||
address StubRoutines::_squareToLen = NULL;
|
||||
address StubRoutines::_mulAdd = NULL;
|
||||
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
|
||||
index fff13dbc..a5231bdd 100644
|
||||
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
|
||||
@@ -221,6 +221,7 @@ class StubRoutines: AllStatic {
|
||||
static address _ddotF2jBLAS;
|
||||
static address _dgemmDgemm;
|
||||
static address _dgemvDgemv;
|
||||
+ static address _isAmd64JVM;
|
||||
|
||||
static address _multiplyToLen;
|
||||
static address _squareToLen;
|
||||
@@ -391,6 +392,7 @@ class StubRoutines: AllStatic {
|
||||
static address ddotF2jBLAS() { return _ddotF2jBLAS; }
|
||||
static address dgemmDgemm() { return _dgemmDgemm; }
|
||||
static address dgemvDgemv() { return _dgemvDgemv; }
|
||||
+ static address isAmd64JVM() { return _isAmd64JVM; }
|
||||
|
||||
static address multiplyToLen() {return _multiplyToLen; }
|
||||
static address squareToLen() {return _squareToLen; }
|
||||
@@ -431,6 +433,10 @@ class StubRoutines: AllStatic {
|
||||
return _intrinsic_tan(d);
|
||||
}
|
||||
|
||||
+ static bool intrinsic_isAmd64_JVM() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
//
|
||||
// Safefetch stub support
|
||||
//
|
||||
diff --git a/hotspot/src/share/vm/services/diagnosticCommand.hpp b/hotspot/src/share/vm/services/diagnosticCommand.hpp
|
||||
index d446aab4..c89933f9 100644
|
||||
--- a/hotspot/src/share/vm/services/diagnosticCommand.hpp
|
||||
+++ b/hotspot/src/share/vm/services/diagnosticCommand.hpp
|
||||
@@ -554,7 +554,7 @@ public:
|
||||
return "Compiler.codelist";
|
||||
}
|
||||
static const char* description() {
|
||||
- return "Print all compiled methods in code cache.";
|
||||
+ return "Print all compiled methods in code cache that are alive";
|
||||
}
|
||||
static const char* impact() {
|
||||
return "Medium";
|
||||
diff --git a/hotspot/test/serviceability/dcmd/CompilerQueueTest.java b/hotspot/test/serviceability/dcmd/CompilerQueueTest.java
|
||||
index 661e7cb4..6d2e7309 100644
|
||||
--- a/hotspot/test/serviceability/dcmd/CompilerQueueTest.java
|
||||
+++ b/hotspot/test/serviceability/dcmd/CompilerQueueTest.java
|
||||
@@ -26,6 +26,8 @@
|
||||
* @bug 8054889
|
||||
* @build DcmdUtil CompilerQueueTest
|
||||
* @run main CompilerQueueTest
|
||||
+ * @run main/othervm -XX:-TieredCompilation CompilerQueueTest
|
||||
+ * @run main/othervm -Xint CompilerQueueTest
|
||||
* @summary Test of diagnostic command Compiler.queue
|
||||
*/
|
||||
|
||||
@@ -62,36 +64,31 @@ public class CompilerQueueTest {
|
||||
String result = DcmdUtil.executeDcmd("Compiler.queue");
|
||||
BufferedReader r = new BufferedReader(new StringReader(result));
|
||||
|
||||
- String line;
|
||||
- match(r.readLine(), "Contents of C1 compile queue");
|
||||
- match(r.readLine(), "----------------------------");
|
||||
String str = r.readLine();
|
||||
- if (!str.equals("Empty")) {
|
||||
- while (str.charAt(0) != '-') {
|
||||
- validateMethodLine(str);
|
||||
+ while (str != null) {
|
||||
+ if (str.startsWith("Contents of C")) {
|
||||
+ match(r.readLine(), "----------------------------");
|
||||
str = r.readLine();
|
||||
- }
|
||||
- } else {
|
||||
- str = r.readLine();
|
||||
- }
|
||||
-
|
||||
- match(str, "----------------------------");
|
||||
- match(r.readLine(), "Contents of C2 compile queue");
|
||||
- match(r.readLine(), "----------------------------");
|
||||
- str = r.readLine();
|
||||
- if (!str.equals("Empty")) {
|
||||
- while (str.charAt(0) != '-') {
|
||||
- validateMethodLine(str);
|
||||
+ if (!str.equals("Empty")) {
|
||||
+ while (str.charAt(0) != '-') {
|
||||
+ validateMethodLine(str);
|
||||
+ str = r.readLine();
|
||||
+ }
|
||||
+ } else {
|
||||
+ str = r.readLine();
|
||||
+ }
|
||||
+ match(str,"----------------------------");
|
||||
str = r.readLine();
|
||||
+ } else {
|
||||
+ throw new Exception("Failed parsing dcmd queue, line: " + str);
|
||||
}
|
||||
- } else {
|
||||
- str = r.readLine();
|
||||
}
|
||||
- match(str, "----------------------------");
|
||||
}
|
||||
|
||||
private static void validateMethodLine(String str) throws Exception {
|
||||
- String name = str.substring(19);
|
||||
+ // Skip until package/class name begins. Trim to remove whitespace that
|
||||
+ // may differ.
|
||||
+ String name = str.substring(14).trim();
|
||||
int sep = name.indexOf("::");
|
||||
try {
|
||||
Class.forName(name.substring(0, sep));
|
||||
--
|
||||
2.22.0
|
||||
2.19.1
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ index 00000000..9b614024
|
||||
--- /dev/null
|
||||
+++ b/version.txt
|
||||
@@ -0,0 +1 @@
|
||||
+8.412.8.0.13
|
||||
+8.442.8.0.13
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -48,8 +48,8 @@ index f3581c163..a405eb336 100644
|
||||
# improving the quality of crash log stack traces involving jvm.dll.
|
||||
|
||||
# These are always used in all compiles
|
||||
-CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX
|
||||
+CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /GS
|
||||
-CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /wd4800
|
||||
+CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /wd4800 /GS
|
||||
|
||||
# Let's add debug information when Full Debug Symbols is enabled
|
||||
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
From fa03b567552ecc1a2a91850c959220ab28f178dd Mon Sep 17 00:00:00 2001
|
||||
From: yangyudong <yangyudong3@huawei.com>
|
||||
Date: Fri, 21 Oct 2022 12:02:55 +0800
|
||||
Subject: cve-2022-37434: Fix a bug when getting a gzip header extra
|
||||
field with inflate().
|
||||
|
||||
Bug url: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2022-37434
|
||||
---
|
||||
jdk/src/share/native/java/util/zip/zlib/inflate.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/jdk/src/share/native/java/util/zip/zlib/inflate.c b/jdk/src/share/native/java/util/zip/zlib/inflate.c
|
||||
index ca904e744..63decdb19 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/zlib/inflate.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/zlib/inflate.c
|
||||
@@ -783,8 +783,9 @@ int flush;
|
||||
if (copy > have) copy = have;
|
||||
if (copy) {
|
||||
if (state->head != Z_NULL &&
|
||||
- state->head->extra != Z_NULL) {
|
||||
- len = state->head->extra_len - state->length;
|
||||
+ state->head->extra != Z_NULL &&
|
||||
+ (len = state->head->extra_len - state->length) <
|
||||
+ state->head->extra_max) {
|
||||
zmemcpy(state->head->extra + len, next,
|
||||
len + copy > state->head->extra_max ?
|
||||
state->head->extra_max - len : copy);
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -149,7 +149,7 @@ index a405eb336..e5aed4418 100644
|
||||
@@ -54,6 +54,9 @@ CXX=cl.exe
|
||||
|
||||
# These are always used in all compiles
|
||||
CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /GS
|
||||
CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /wd4800 /GS
|
||||
+!if "$(MSC_VER)" > "1910"
|
||||
+CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /GS /arch:IA32
|
||||
+!endif
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From d94e836f5dc230839aacb4585dcc30575c94d785 Mon Sep 17 00:00:00 2001
|
||||
From: zhangyipeng <zhangyipeng7@huawei.com>
|
||||
Date: Sat, 11 Sep 2021 15:24:54 +0800
|
||||
Subject: [PATCH 16/23] fix wrong commitID in release file
|
||||
|
||||
Summary: <make> : fix wrong commitID in release file
|
||||
LLT: NA
|
||||
Patch Type: huawei
|
||||
Bug url: NA
|
||||
---
|
||||
make/common/MakeBase.gmk | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk
|
||||
index 9b7ad7024..8179139ec 100644
|
||||
--- a/make/common/MakeBase.gmk
|
||||
+++ b/make/common/MakeBase.gmk
|
||||
@@ -322,9 +322,10 @@ define GetSourceTips
|
||||
fi; \
|
||||
done >> $@), \
|
||||
$(if $(and $(GIT), $(wildcard $(TOPDIR)/.git)), \
|
||||
+ $$($(CD) $(SRC_ROOT) ; \
|
||||
$(PRINTF) ".:git:%s%s\n" \
|
||||
"$$(git log -n1 --format=%H | cut -c1-12)" \
|
||||
- "$$(if test -n "$$(git status --porcelain)"; then printf '+'; fi)" >> $@, ))
|
||||
+ "$$(if test -n "$$(git status --porcelain)"; then printf '+'; fi)" >> $@), ))
|
||||
$(PRINTF) "\n" >> $@
|
||||
endef
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -40,13 +40,13 @@ index 54e1bfa0d..c1423dc5b 100644
|
||||
|
||||
// The numbers of certs now.
|
||||
- private static final int COUNT = 83;
|
||||
+ private static final int COUNT = 102;
|
||||
+ 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";
|
||||
+ = "2F:92:41:50:3B:2B:F2:AD:86:54:AB:2B:D4:AB:A2:92:8B:B6:1C:2B:58:A1:E3:1A:CE:43:43:FB:3E:94:2E:7E";
|
||||
+ = "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")
|
||||
|
||||
3904
heap-dump-redact-support.patch
Normal file
3904
heap-dump-redact-support.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,115 +0,0 @@
|
||||
diff -ruN jdk8/common/autoconf/libraries.m4 jdk8/common/autoconf/libraries.m4
|
||||
--- jdk8/common/autoconf/libraries.m4 2013-11-14 20:08:01.845065585 -0500
|
||||
+++ jdk8/common/autoconf/libraries.m4 2013-11-14 20:10:56.186553066 -0500
|
||||
@@ -676,6 +676,47 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
+ # Check for the png library
|
||||
+ #
|
||||
+
|
||||
+ AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
|
||||
+ [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
+
|
||||
+ AC_CHECK_LIB(png, png_sig_cmp,
|
||||
+ [ LIBPNG_FOUND=yes ],
|
||||
+ [ LIBPNG_FOUND=no ])
|
||||
+
|
||||
+ AC_MSG_CHECKING([for which libpng to use])
|
||||
+
|
||||
+ # default is bundled
|
||||
+ DEFAULT_LIBPNG=bundled
|
||||
+
|
||||
+ #
|
||||
+ # if user didn't specify, use DEFAULT_LIBPNG
|
||||
+ #
|
||||
+ if test "x${with_libpng}" = "x"; then
|
||||
+ with_libpng=${DEFAULT_libpng}
|
||||
+ fi
|
||||
+
|
||||
+
|
||||
+ if test "x${with_libpng}" = "xbundled"; then
|
||||
+ USE_EXTERNAL_LIBPNG=false
|
||||
+ AC_MSG_RESULT([bundled])
|
||||
+ elif test "x${with_libpng}" = "xsystem"; then
|
||||
+ if test "x${LIBPNG_FOUND}" = "xyes"; then
|
||||
+ USE_EXTERNAL_LIBPNG=true
|
||||
+ AC_MSG_RESULT([system])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([system not found])
|
||||
+ AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
|
||||
+ fi
|
||||
+ else
|
||||
+ AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
|
||||
+ fi
|
||||
+ AC_SUBST(USE_EXTERNAL_LIBPNG)
|
||||
+
|
||||
+ ###############################################################################
|
||||
+ #
|
||||
# Check for the zlib library
|
||||
#
|
||||
|
||||
diff -ruN jdk8/common/autoconf/spec.gmk.in jdk8/common/autoconf/spec.gmk.in
|
||||
--- jdk8/common/autoconf/spec.gmk.in 2013-10-31 19:24:33.000000000 -0400
|
||||
+++ jdk8/common/autoconf/spec.gmk.in 2013-11-14 21:10:56.365976518 -0500
|
||||
@@ -548,6 +548,7 @@
|
||||
ENABLE_JFR=@ENABLE_JFR@
|
||||
ENABLE_INTREE_EC=@ENABLE_INTREE_EC@
|
||||
USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
|
||||
+USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
|
||||
USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
|
||||
USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
|
||||
LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
|
||||
diff -ruN jdk8/jdk/make/lib/Awt2dLibraries.gmk jdk8/jdk/make/lib/Awt2dLibraries.gmk
|
||||
--- jdk8/jdk/make/lib/Awt2dLibraries.gmk 2013-11-14 20:08:01.845065585 -0500
|
||||
+++ jdk8/jdk/make/lib/Awt2dLibraries.gmk 2013-11-14 20:14:10.791982343 -0500
|
||||
@@ -1183,7 +1183,6 @@
|
||||
|
||||
ifndef BUILD_HEADLESS_ONLY
|
||||
LIBSPLASHSCREEN_DIRS := \
|
||||
- $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
|
||||
$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LIBGIF), true)
|
||||
@@ -1200,6 +1199,13 @@
|
||||
LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/jpeg
|
||||
endif
|
||||
|
||||
+ ifeq ($(USE_EXTERNAL_LIBPNG), true)
|
||||
+ LIBPNG_LDFLAGS := -lpng
|
||||
+ else
|
||||
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/libpng
|
||||
+ LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
|
||||
+ endif
|
||||
+
|
||||
ifneq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
|
||||
else
|
||||
@@ -1263,12 +1269,12 @@
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
|
||||
- $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS), \
|
||||
+ $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(LIBPNG_CFLAGS), \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) \
|
||||
- $(LIBZ) $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS), \
|
||||
+ $(LIBZ) $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS) $(LIBPNG_LDFLAGS), \
|
||||
LDFLAGS_SUFFIX_solaris := -lc, \
|
||||
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
diff -ruN jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
|
||||
--- jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c 2013-10-31 19:44:18.000000000 -0400
|
||||
+++ jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c 2013-11-14 20:14:41.363892797 -0500
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include "splashscreen_impl.h"
|
||||
|
||||
-#include "../libpng/png.h"
|
||||
-
|
||||
+#include <png.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#define SIG_BYTES 8
|
||||
@ -1,118 +0,0 @@
|
||||
diff -ruN jdk8/common/autoconf/libraries.m4 jdk8/common/autoconf/libraries.m4
|
||||
--- openjdk/common/autoconf/libraries.m4 2013-11-14 22:04:38.039440136 -0500
|
||||
+++ openjdk/common/autoconf/libraries.m4 2013-11-14 22:05:11.474356424 -0500
|
||||
@@ -676,6 +676,46 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
+ # Check for the lcms2 library
|
||||
+ #
|
||||
+
|
||||
+ AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
|
||||
+ [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
+
|
||||
+ AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile,
|
||||
+ [ LCMS_FOUND=yes ],
|
||||
+ [ LCMS_FOUND=no ])
|
||||
+
|
||||
+ AC_MSG_CHECKING([for which lcms to use])
|
||||
+
|
||||
+ DEFAULT_LCMS=bundled
|
||||
+
|
||||
+ #
|
||||
+ # If user didn't specify, use DEFAULT_LCMS
|
||||
+ #
|
||||
+ if test "x${with_lcms}" = "x"; then
|
||||
+ with_lcms=${DEFAULT_LCMS}
|
||||
+ fi
|
||||
+
|
||||
+ if test "x${with_lcms}" = "xbundled"; then
|
||||
+ USE_EXTERNAL_LCMS=false
|
||||
+ AC_MSG_RESULT([bundled])
|
||||
+ elif test "x${with_lcms}" = "xsystem"; then
|
||||
+ if test "x${LCMS_FOUND}" = "xyes"; then
|
||||
+ USE_EXTERNAL_LCMS=true
|
||||
+ AC_MSG_RESULT([system])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([system not found])
|
||||
+ AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
|
||||
+ fi
|
||||
+ else
|
||||
+ AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
|
||||
+ fi
|
||||
+
|
||||
+ AC_SUBST(USE_EXTERNAL_LCMS)
|
||||
+
|
||||
+ ###############################################################################
|
||||
+ #
|
||||
# Check for the png library
|
||||
#
|
||||
|
||||
diff -ruN jdk8/jdk/make/lib/Awt2dLibraries.gmk jdk8/jdk/make/lib/Awt2dLibraries.gmk
|
||||
--- openjdk/jdk/make/lib/Awt2dLibraries.gmk 2013-11-14 22:04:38.040440133 -0500
|
||||
+++ openjdk/jdk/make/lib/Awt2dLibraries.gmk 2013-11-14 22:05:11.475356411 -0500
|
||||
@@ -666,18 +666,35 @@
|
||||
|
||||
##########################################################################################
|
||||
|
||||
+LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
|
||||
+
|
||||
+ifeq ($(USE_EXTERNAL_LCMS), true)
|
||||
+ # If we're using an external library, we'll just need the wrapper part.
|
||||
+ # By including it explicitely, all other files will be excluded.
|
||||
+ BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
|
||||
+ BUILD_LIBLCMS_HEADERS :=
|
||||
+else
|
||||
+ BUILD_LIBLCMS_INCLUDE_FILES :=
|
||||
+ # If we're using the bundled library, we'll need to include it in the
|
||||
+ # include path explicitly. Otherwise the system headers will be used.
|
||||
+ BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
|
||||
+endif
|
||||
+
|
||||
# TODO: Update awt lib path when awt is converted
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
|
||||
LIBRARY := lcms, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
- SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
|
||||
+ SRC := $(LIBLCMS_DIR), \
|
||||
+ INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := HIGHEST, \
|
||||
CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
|
||||
-DCMS_DONT_USE_FAST_FLOOR \
|
||||
$(SHARED_LIBRARY_FLAGS) \
|
||||
-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
|
||||
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
|
||||
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
|
||||
+ $(BUILD_LIBLCMS_HEADERS) \
|
||||
+ $(LCMS_CFLAGS), \
|
||||
CFLAGS_solaris := -xc99=no_lib, \
|
||||
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
|
||||
@@ -685,10 +702,10 @@
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
|
||||
LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
|
||||
- LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
|
||||
- LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
|
||||
- LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
|
||||
- LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
|
||||
+ LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
|
||||
+ LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
|
||||
+ LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
|
||||
+ LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
|
||||
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=lcms.dll" \
|
||||
diff -r 3d1c3b0b73a3 src/share/native/sun/java2d/cmm/lcms/LCMS.c
|
||||
--- openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c Tue Sep 08 22:31:26 2015 +0300
|
||||
+++ openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c Thu Oct 15 05:29:28 2015 +0100
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "jni_util.h"
|
||||
#include "Trace.h"
|
||||
#include "Disposer.h"
|
||||
-#include "lcms2.h"
|
||||
+#include <lcms2.h>
|
||||
#include "jlong.h"
|
||||
|
||||
|
||||
@ -1,228 +0,0 @@
|
||||
diff -ruN jdk8/common/autoconf/libraries.m4 jdk8/common/autoconf/libraries.m4
|
||||
--- jdk8/common/autoconf/libraries.m4 2013-10-31 19:24:33.000000000 -0400
|
||||
+++ jdk8/common/autoconf/libraries.m4 2013-11-14 21:55:20.249903347 -0500
|
||||
@@ -601,12 +601,42 @@
|
||||
#
|
||||
|
||||
USE_EXTERNAL_LIBJPEG=true
|
||||
- AC_CHECK_LIB(jpeg, main, [],
|
||||
- [ USE_EXTERNAL_LIBJPEG=false
|
||||
- AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
|
||||
- ])
|
||||
+ AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
|
||||
+ [use libjpeg from build system or OpenJDK sources (system, bundled) @<:@bundled@:>@])])
|
||||
+
|
||||
+ AC_CHECK_LIB(jpeg, jpeg_destroy_compress,
|
||||
+ [ LIBJPEG_FOUND=yes ],
|
||||
+ [ LIBJPEG_FOUND=no ])
|
||||
+
|
||||
+ AC_MSG_CHECKING([for which libjpeg to use])
|
||||
+
|
||||
+ # default is bundled
|
||||
+ DEFAULT_LIBJPEG=bundled
|
||||
+
|
||||
+ #
|
||||
+ # if user didn't specify, use DEFAULT_LIBJPEG
|
||||
+ #
|
||||
+ if test "x${with_libjpeg}" = "x"; then
|
||||
+ with_libjpeg=${DEFAULT_LIBJPEG}
|
||||
+ fi
|
||||
+
|
||||
+ if test "x${with_libjpeg}" = "xbundled"; then
|
||||
+ USE_EXTERNAL_LIBJPEG=false
|
||||
+ AC_MSG_RESULT([bundled])
|
||||
+ elif test "x${with_libjpeg}" = "xsystem"; then
|
||||
+ if test "x${LIBJPEG_FOUND}" = "xyes"; then
|
||||
+ USE_EXTERNAL_LIBJPEG=true
|
||||
+ AC_MSG_RESULT([system])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([system not found])
|
||||
+ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])
|
||||
+ fi
|
||||
+ else
|
||||
+ AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
|
||||
+ fi
|
||||
AC_SUBST(USE_EXTERNAL_LIBJPEG)
|
||||
|
||||
+
|
||||
###############################################################################
|
||||
#
|
||||
# Check for the gif library
|
||||
diff -ruN jdk8/jdk/make/lib/Awt2dLibraries.gmk jdk8/jdk/make/lib/Awt2dLibraries.gmk
|
||||
--- jdk8/jdk/make/lib/Awt2dLibraries.gmk 2013-10-31 19:44:18.000000000 -0400
|
||||
+++ jdk8/jdk/make/lib/Awt2dLibraries.gmk 2013-11-14 21:56:01.020796703 -0500
|
||||
@@ -693,17 +693,17 @@
|
||||
##########################################################################################
|
||||
|
||||
ifdef OPENJDK
|
||||
- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
|
||||
+ BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
|
||||
else
|
||||
- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
|
||||
- BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
|
||||
- BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
|
||||
+ BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
|
||||
+ BUILD_LIBJAVAJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
|
||||
+ BUILD_LIBJAVAJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
|
||||
endif
|
||||
|
||||
-BUILD_LIBJPEG_REORDER :=
|
||||
+BUILD_LIBJAVAJPEG_REORDER :=
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
- BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
|
||||
+ BUILD_LIBJAVAJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -718,37 +718,38 @@
|
||||
# $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
|
||||
# \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
|
||||
# ifeq ($(CC_43_OR_NEWER), 1)
|
||||
-# BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
|
||||
+# BUILD_LIBJAVAJPEG_CFLAGS_linux += -Wno-clobbered
|
||||
# endif
|
||||
#endif
|
||||
|
||||
-$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
|
||||
- LIBRARY := jpeg, \
|
||||
+$(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
|
||||
+ LIBRARY := javajpeg, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
- SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
|
||||
+ SRC := $(BUILD_LIBJAVAJPEG_CLOSED_SRC) \
|
||||
$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := HIGHEST, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
- $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
|
||||
+ $(BUILD_LIBJAVAJPEG_CLOSED_INCLUDES) \
|
||||
-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
|
||||
- MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
|
||||
- LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
+ MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
|
||||
+ LDFLAGS := $(subst -Xlinker --as-needed,, \
|
||||
+ $(subst -Wl$(COMMA)--as-needed,, $(LDFLAGS_JDKLIB))) -ljpeg \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
|
||||
LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
|
||||
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
- -D "JDK_FNAME=jpeg.dll" \
|
||||
- -D "JDK_INTERNAL_NAME=jpeg" \
|
||||
+ -D "JDK_FNAME=javajpeg.dll" \
|
||||
+ -D "JDK_INTERNAL_NAME=javajpeg" \
|
||||
-D "JDK_FTYPE=0x2L", \
|
||||
- REORDER := $(BUILD_LIBJPEG_REORDER), \
|
||||
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
|
||||
+ REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
|
||||
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjavajpeg, \
|
||||
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
|
||||
-$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
|
||||
+$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
|
||||
|
||||
-BUILD_LIBRARIES += $(BUILD_LIBJPEG)
|
||||
+BUILD_LIBRARIES += $(BUILD_LIBJAVAJPEG)
|
||||
|
||||
##########################################################################################
|
||||
|
||||
@@ -1127,7 +1128,6 @@
|
||||
|
||||
ifndef BUILD_HEADLESS_ONLY
|
||||
LIBSPLASHSCREEN_DIRS := \
|
||||
- $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
|
||||
$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
|
||||
$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
|
||||
|
||||
@@ -1138,6 +1138,13 @@
|
||||
GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
|
||||
endif
|
||||
|
||||
+ ifeq ($(USE_EXTERNAL_LIBJPEG), true)
|
||||
+ LIBJPEG_LDFLAGS := -ljpeg
|
||||
+ else
|
||||
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
|
||||
+ LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/jpeg
|
||||
+ endif
|
||||
+
|
||||
ifneq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
|
||||
else
|
||||
@@ -1193,11 +1200,13 @@
|
||||
EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
- CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
|
||||
+ CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
|
||||
+ $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS), \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
- LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
|
||||
+ LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) \
|
||||
+ $(LIBZ) $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS), \
|
||||
LDFLAGS_SUFFIX_solaris := -lc, \
|
||||
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
diff -ruN jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
|
||||
--- jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java 2013-10-31 19:44:18.000000000 -0400
|
||||
+++ jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java 2013-11-14 21:55:20.250903340 -0500
|
||||
@@ -89,7 +89,7 @@
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
- System.loadLibrary("jpeg");
|
||||
+ System.loadLibrary("javajpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
diff -ruN jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
|
||||
--- jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java 2013-10-31 19:44:18.000000000 -0400
|
||||
+++ jdk8/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java 2013-11-14 21:55:20.250903340 -0500
|
||||
@@ -179,7 +179,7 @@
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
- System.loadLibrary("jpeg");
|
||||
+ System.loadLibrary("javajpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
diff -ruN jdk8/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java jdk8/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
|
||||
--- jdk8/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2013-10-31 19:44:18.000000000 -0400
|
||||
+++ jdk8/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2013-11-14 21:55:20.251903376 -0500
|
||||
@@ -56,7 +56,7 @@
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
- System.loadLibrary("jpeg");
|
||||
+ System.loadLibrary("javajpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
diff -ruN jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
|
||||
--- jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c 2013-10-31 19:44:18.000000000 -0400
|
||||
+++ jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c 2013-11-14 21:55:20.251903376 -0500
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "splashscreen_impl.h"
|
||||
|
||||
-#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jerror.h"
|
||||
|
||||
@@ -107,11 +106,11 @@
|
||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
|
||||
- JPOOL_PERMANENT, SIZEOF(stream_source_mgr));
|
||||
+ JPOOL_PERMANENT, sizeof(stream_source_mgr));
|
||||
src = (stream_src_ptr) cinfo->src;
|
||||
src->buffer = (JOCTET *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
|
||||
- JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||
+ JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET));
|
||||
}
|
||||
|
||||
src = (stream_src_ptr) cinfo->src;
|
||||
Binary file not shown.
@ -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 jdk8u412-b08
|
||||
%global revision jdk8u442-b06
|
||||
%global full_revision %{repo}-%{revision}
|
||||
# Define IcedTea version used for SystemTap tapsets and desktop files
|
||||
%global icedteaver 3.15.0
|
||||
|
||||
%global updatever 412
|
||||
%global buildver b08
|
||||
%global updatever 442
|
||||
%global buildver b06
|
||||
# priority must be 7 digits in total. The expression is workarounding tip
|
||||
%global priority 1800%{updatever}
|
||||
|
||||
@ -613,6 +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
|
||||
@ -936,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
|
||||
@ -1145,7 +1156,7 @@ Patch241: 8268819-SA-Remove-libthread_db-dependency-on-Linux.patch
|
||||
# 8u332
|
||||
Patch243: Fix-compile-and-runtime-failures-for-minimal1-versio.patch
|
||||
Patch244: fix_X509TrustManagerImpl_symantec_distrust.patch
|
||||
Patch245: change-sa-jdi.jar-make-file-for-BEP.PATCH
|
||||
Patch245: change-sa-jdi.jar-make-file-for-BEP.patch
|
||||
Patch246: 7092821-java.security.Provider.getService-is-synchro.patch
|
||||
|
||||
# 8u342
|
||||
@ -1295,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
|
||||
@ -1322,6 +1332,35 @@ Patch428: 8223486-split-if-update_uses-accesses-stale-idom-dat.patch
|
||||
Patch429: 8256488-Use-ldpq-stpq-instead-of-ld4-st4-for-small-c.patch
|
||||
Patch430: DependencyContext-mark_dependent_nmethods-crash-in-Dynamic-cds-mode.patch
|
||||
Patch431: 8138922-StubCodeDesc-constructor-publishes-partially-constructed.patch
|
||||
Patch432: support-KAE-zip.patch
|
||||
Patch433: Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch
|
||||
Patch434: Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch
|
||||
Patch435: Huawei-improve-GCTR-performance.patch
|
||||
Patch436: Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch
|
||||
Patch437: Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch
|
||||
Patch438: Huawei-Add-Aggressive-CDS.patch
|
||||
Patch439: Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch
|
||||
Patch440: Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch
|
||||
Patch441: Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch
|
||||
|
||||
#422
|
||||
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
|
||||
Patch451: Backport-8069330-and-adapt-G1GC-related-optimization.patch
|
||||
Patch452: SA-redact-support-password.patch
|
||||
Patch453: Backport-8057910-G1-BOT-verification-should-not-pass.patch
|
||||
Patch454: 8253072-XERCES-version-is-displayed-incorrect.patch
|
||||
Patch455: 8159461-8288556-getComponentType.patch
|
||||
Patch456: 8136926-phi-NULL-assert-in-PhaseIdealLoop-try_move_s.patch
|
||||
Patch457: 8269934-RunThese24H.java-failed-with-EXCEPTION_ACCES.patch
|
||||
#############################################
|
||||
#
|
||||
# Upstreamable patches
|
||||
@ -1332,7 +1371,6 @@ Patch431: 8138922-StubCodeDesc-constructor-publishes-partially-constructed.patch
|
||||
#############################################
|
||||
# PR2888: OpenJDK should check for system cacerts database (e.g. /etc/pki/java/cacerts)
|
||||
# PR3575, RH1567204: System cacerts database handling should not affect jssecacerts
|
||||
Patch539: pr2888-openjdk_should_check_for_system_cacerts_database_eg_etc_pki_java_cacerts.patch
|
||||
|
||||
#############################################
|
||||
#
|
||||
@ -1366,7 +1404,6 @@ Patch539: pr2888-openjdk_should_check_for_system_cacerts_database_eg_etc_pki_jav
|
||||
# This section includes patches to code other
|
||||
# that from OpenJDK.
|
||||
#############################################
|
||||
Patch1000: rh1648249-add_commented_out_nss_cfg_provider_to_java_security.patch
|
||||
|
||||
# riscv64 support
|
||||
Patch2000: add-riscv64-support.patch
|
||||
@ -1943,7 +1980,6 @@ pushd %{top_level_dir_name}
|
||||
%patch404 -p1
|
||||
%patch405 -p1
|
||||
%patch406 -p1
|
||||
%patch407 -p1
|
||||
%patch408 -p1
|
||||
%patch409 -p1
|
||||
%patch410 -p1
|
||||
@ -1966,6 +2002,33 @@ pushd %{top_level_dir_name}
|
||||
%patch429 -p1
|
||||
%patch430 -p1
|
||||
%patch431 -p1
|
||||
%patch432 -p1
|
||||
%patch433 -p1
|
||||
%patch434 -p1
|
||||
%patch435 -p1
|
||||
%patch436 -p1
|
||||
%patch437 -p1
|
||||
%ifnarch riscv64
|
||||
%patch438 -p1
|
||||
%endif
|
||||
%patch439 -p1
|
||||
%patch440 -p1
|
||||
%patch441 -p1
|
||||
%patch442 -p1
|
||||
%patch443 -p1
|
||||
%patch445 -p1
|
||||
%patch446 -p1
|
||||
%patch447 -p1
|
||||
%patch448 -p1
|
||||
%patch449 -p1
|
||||
%patch450 -p1
|
||||
%patch451 -p1
|
||||
%patch452 -p1
|
||||
%patch453 -p1
|
||||
%patch454 -p1
|
||||
%patch455 -p1
|
||||
%patch456 -p1
|
||||
%patch457 -p1
|
||||
%endif
|
||||
|
||||
%ifarch loongarch64
|
||||
@ -1984,12 +2047,8 @@ pushd %{top_level_dir_name}
|
||||
popd
|
||||
|
||||
# System library fixes
|
||||
# %patch201
|
||||
# %patch202
|
||||
# %patch203
|
||||
|
||||
# RPM-only fixes
|
||||
# %patch1000
|
||||
|
||||
# Extract systemtap tapsets
|
||||
%if %{with_systemtap}
|
||||
@ -2100,8 +2159,8 @@ 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/" \
|
||||
@ -2491,9 +2550,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}}
|
||||
@ -2630,9 +2690,100 @@ cjc.mainProgram(arg)
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jul 17 2024 Xiang Gao <gaoxiang@kylinos.cn> - 1:1.8.0.412-b08.6
|
||||
* Wed Jan 22 2025 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.442.b06-0
|
||||
- modified add-missing-test-case.patch
|
||||
|
||||
* Sat Jan 4 2025 kuenking111 <wangkun49@huawei.com> -1:1.8.0.432.b06-2
|
||||
- modified add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch
|
||||
- add 8253072-XERCES-version-is-displayed-incorrect.patch
|
||||
- add 8159461-8288556-getComponentType.patch
|
||||
- add 8136926-phi-NULL-assert-in-PhaseIdealLoop-try_move_s.patch
|
||||
- add 8269934-RunThese24H.java-failed-with-EXCEPTION_ACCES.patch
|
||||
|
||||
* Thu Oct 17 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.432.b06-1
|
||||
- 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
|
||||
- add Backport-8057910-G1-BOT-verification-should-not-pass.patch
|
||||
- add Backport-8069330-and-adapt-G1GC-related-optimization.patch
|
||||
- add SA-redact-support-password.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
|
||||
|
||||
* Sat Aug 3 2024 kuenking111 <wangkun49@huawei.com> -1:1.8.0.422-b05.4
|
||||
- Add 8137165-Tests-fail-in-SR_Handler-because-thread-is-n.patch
|
||||
- Extending-the-IV-Length-Supported-by-KAEProvider-AES.patch
|
||||
|
||||
* Tue Jul 30 2024 benshuai5D <zhangyunbo7@huawei.com> -1:1.8.0.422-b05.3
|
||||
- Fix-the-ActiveProcessorCount-function-of-the-spark-s.patch
|
||||
|
||||
* Tue Jul 30 2024 Xiang Gao <gaoxiang@kylinos.cn> - 1:1.8.0.422-b05.2
|
||||
- Backport 8178498,8193710,8196743,8284330, serviceability tools support containers on loongarch
|
||||
|
||||
* Fri Jul 26 2024 benshuai5D <zhangyunbo7@huawei.com> -1:1.8.0.422-b05.1
|
||||
- Add The-fast-serialization-function-of-sun.rmi.transport.patch
|
||||
|
||||
* Tue Jul 16 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.422-b05.rolling
|
||||
- modified 8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch
|
||||
- modified 8136577_Make_AbortVMOnException_available_in_product_builds.patch
|
||||
- modified Dynamic-CDS-Archive.patch
|
||||
- modified add-safe-compilation-flags.patch
|
||||
- modified fix-log-bug-enhance-aes-hmac-performance.patch
|
||||
- modified fix_X509TrustManagerImpl_symantec_distrust.patch
|
||||
- modified openjdk-1.8.0.spec
|
||||
- modified update-cacerts-and-VerifyCACerts.java-test.patch
|
||||
- Add Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch
|
||||
- Add Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch
|
||||
- Add Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch
|
||||
- Add Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch
|
||||
- Add Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch
|
||||
- Add Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch
|
||||
- Add Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch
|
||||
- Add Huawei-Add-Aggressive-CDS.patch
|
||||
- Add Huawei-Keep-objects-when-remove-unshareable-info.patch
|
||||
- Add Huawei-improve-GCTR-performance.patch
|
||||
|
||||
* Thu Jul 4 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.412-b08.9
|
||||
- Add support-KAE-zip.patch
|
||||
|
||||
* Fri Jun 21 2024 songliyang <songliyang@kylinos.cn> -1:1.8.0.412-b08.8
|
||||
- Add noarch support for srpm build
|
||||
- null the arg to solve openjdk-headless install error
|
||||
|
||||
* Thu Jun 20 2024 aoqi <aoqi@loongson.cn> -1:1.8.0.412-b08.7
|
||||
- update LoongArch64 port to 8u412
|
||||
|
||||
* Wed Jun 19 2024 neu-mobi <liuyulong35@huawei.com> -1:1.8.0.412-b08.6
|
||||
- Fix aarch64 runtime thread signal transfer bug
|
||||
|
||||
* Thu May 23 2024 Dingli Zhang <dingli@iscas.ac.cn> -1:1.8.0.412-b08.5
|
||||
- Fix build on riscv64 in prep stage
|
||||
|
||||
@ -2870,10 +3021,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
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1459487045 -3600
|
||||
# Fri Apr 01 06:04:05 2016 +0100
|
||||
# Node ID 3334efeacd8327a14b7d2f392f4546e3c29c594b
|
||||
# Parent 6b81fd2227d14226f2121f2d51b464536925686e
|
||||
PR2888: OpenJDK should check for system cacerts database (e.g. /etc/pki/java/cacerts)
|
||||
PR3575: System cacerts database handling should not affect jssecacerts
|
||||
|
||||
diff --git openjdk.orig/jdk/src/share/classes/sun/security/ssl/TrustStoreManager.java openjdk/jdk/src/share/classes/sun/security/ssl/TrustStoreManager.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/security/ssl/TrustStoreManager.java
|
||||
+++ openjdk/jdk/src/share/classes/sun/security/ssl/TrustStoreManager.java
|
||||
@@ -72,7 +72,7 @@
|
||||
* The preference of the default trusted KeyStore is:
|
||||
* javax.net.ssl.trustStore
|
||||
* jssecacerts
|
||||
- * cacerts
|
||||
+ * cacerts (system and local)
|
||||
*/
|
||||
private static final class TrustStoreDescriptor {
|
||||
private static final String fileSep = File.separator;
|
||||
@@ -83,6 +83,10 @@
|
||||
defaultStorePath + fileSep + "cacerts";
|
||||
private static final String jsseDefaultStore =
|
||||
defaultStorePath + fileSep + "jssecacerts";
|
||||
+ /* Check system cacerts DB: /etc/pki/java/cacerts */
|
||||
+ private static final String systemStore =
|
||||
+ fileSep + "etc" + fileSep + "pki" +
|
||||
+ fileSep + "java" + fileSep + "cacerts";
|
||||
|
||||
// the trust store name
|
||||
private final String storeName;
|
||||
@@ -146,7 +150,8 @@
|
||||
long temporaryTime = 0L;
|
||||
if (!"NONE".equals(storePropName)) {
|
||||
String[] fileNames =
|
||||
- new String[] {storePropName, defaultStore};
|
||||
+ new String[] {storePropName,
|
||||
+ systemStore, defaultStore};
|
||||
for (String fileName : fileNames) {
|
||||
File f = new File(fileName);
|
||||
if (f.isFile() && f.canRead()) {
|
||||
diff --git openjdk.orig/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java openjdk/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java
|
||||
+++ openjdk/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java
|
||||
@@ -108,9 +108,14 @@
|
||||
throws Exception
|
||||
{
|
||||
String sep = File.separator;
|
||||
- File file = new File(System.getProperty("java.home") + sep
|
||||
- + "lib" + sep + "security" + sep
|
||||
- + "cacerts");
|
||||
+ /* Check system cacerts DB first; /etc/pki/java/cacerts */
|
||||
+ File file = new File(sep + "etc" + sep + "pki" + sep
|
||||
+ + "java" + sep + "cacerts");
|
||||
+ if (!file.exists()) {
|
||||
+ file = new File(System.getProperty("java.home") + sep
|
||||
+ + "lib" + sep + "security" + sep
|
||||
+ + "cacerts");
|
||||
+ }
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
From 7e879bcae45b7a7e4b3fa8044564e3590344dbbd Mon Sep 17 00:00:00 2001
|
||||
Date: Fri, 22 Jan 2021 16:23:51 +0800
|
||||
Subject: recreate .java_pid file when deleted for attach
|
||||
mechanism
|
||||
|
||||
Summary: <hotspot>: <enable attach mechanism when .java_pid is lost>
|
||||
LLT:
|
||||
Bug url:
|
||||
---
|
||||
.../src/os/linux/vm/attachListener_linux.cpp | 20 +++++++++++++++----
|
||||
.../src/share/vm/services/attachListener.cpp | 1 +
|
||||
.../src/share/vm/services/attachListener.hpp | 2 +-
|
||||
3 files changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/os/linux/vm/attachListener_linux.cpp b/hotspot/src/os/linux/vm/attachListener_linux.cpp
|
||||
index 700a09ff0..1ca089740 100644
|
||||
--- a/hotspot/src/os/linux/vm/attachListener_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/attachListener_linux.cpp
|
||||
@@ -485,13 +485,25 @@ bool AttachListener::init_at_startup() {
|
||||
// If the file .attach_pid<pid> exists in the working directory
|
||||
// or /tmp then this is the trigger to start the attach mechanism
|
||||
bool AttachListener::is_init_trigger() {
|
||||
- if (init_at_startup() || is_initialized()) {
|
||||
- return false; // initialized at startup or already initialized
|
||||
+ if (init_at_startup()) {
|
||||
+ return false; // initialized at startup
|
||||
}
|
||||
- char fn[PATH_MAX+1];
|
||||
- sprintf(fn, ".attach_pid%d", os::current_process_id());
|
||||
+
|
||||
+ char fn[PATH_MAX + 1];
|
||||
int ret;
|
||||
struct stat64 st;
|
||||
+
|
||||
+ // check initialized
|
||||
+ if (is_initialized()) {
|
||||
+ // check .java_pid file exists
|
||||
+ RESTARTABLE(::stat64(LinuxAttachListener::path(), &st), ret);
|
||||
+ if (ret == -1) {
|
||||
+ ::shutdown(LinuxAttachListener::listener(), SHUT_RDWR);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ sprintf(fn, ".attach_pid%d", os::current_process_id());
|
||||
RESTARTABLE(::stat64(fn, &st), ret);
|
||||
if (ret == -1) {
|
||||
snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
|
||||
diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp
|
||||
index 59b2f5483..0f51378dd 100644
|
||||
--- a/hotspot/src/share/vm/services/attachListener.cpp
|
||||
+++ b/hotspot/src/share/vm/services/attachListener.cpp
|
||||
@@ -425,6 +425,7 @@ static void attach_listener_thread_entry(JavaThread* thread, TRAPS) {
|
||||
for (;;) {
|
||||
AttachOperation* op = AttachListener::dequeue();
|
||||
if (op == NULL) {
|
||||
+ AttachListener::set_initialized(false);
|
||||
return; // dequeue failed or shutdown
|
||||
}
|
||||
|
||||
diff --git a/hotspot/src/share/vm/services/attachListener.hpp b/hotspot/src/share/vm/services/attachListener.hpp
|
||||
index 5204c4c62..11ec525c6 100644
|
||||
--- a/hotspot/src/share/vm/services/attachListener.hpp
|
||||
+++ b/hotspot/src/share/vm/services/attachListener.hpp
|
||||
@@ -71,7 +71,7 @@ class AttachListener: AllStatic {
|
||||
|
||||
public:
|
||||
static bool is_initialized() { return _initialized; }
|
||||
- static void set_initialized() { _initialized = true; }
|
||||
+ static void set_initialized(bool init = true) { _initialized = init; }
|
||||
|
||||
// indicates if this VM supports attach-on-demand
|
||||
static bool is_attach_supported() { return !DisableAttachMechanism; }
|
||||
--
|
||||
2.19.0
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
diff -r 5b86f66575b7 src/share/lib/security/java.security-linux
|
||||
--- openjdk/jdk/src/share/lib/security/java.security-linux Tue May 16 13:29:05 2017 -0700
|
||||
+++ openjdk/jdk/src/share/lib/security/java.security-linux Tue Jun 06 14:05:12 2017 +0200
|
||||
@@ -74,6 +74,7 @@
|
||||
security.provider.7=com.sun.security.sasl.Provider
|
||||
security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
|
||||
security.provider.9=sun.security.smartcardio.SunPCSC
|
||||
+#security.provider.10=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.cfg
|
||||
|
||||
#
|
||||
# Sun Provider SecureRandom seed source.
|
||||
717
support-KAE-zip.patch
Normal file
717
support-KAE-zip.patch
Normal file
@ -0,0 +1,717 @@
|
||||
Subject: [PATCH] [Huawei]support KAE-zip
|
||||
|
||||
---
|
||||
jdk/make/CompileLaunchers.gmk | 34 ++++---
|
||||
jdk/make/lib/CoreLibraries.gmk | 71 ++++++++++++++
|
||||
jdk/make/mapfiles/libzip/mapfile-vers | 3 +
|
||||
.../share/classes/java/util/zip/Deflater.java | 10 +-
|
||||
.../java/util/zip/GZIPInputStream.java | 14 +++
|
||||
.../java/util/zip/GZIPOutputStream.java | 20 ++++
|
||||
.../share/classes/java/util/zip/Inflater.java | 14 ++-
|
||||
.../java/util/zip/InflaterOutputStream.java | 24 ++---
|
||||
jdk/src/share/lib/security/java.policy | 2 +
|
||||
jdk/src/share/native/java/util/zip/Deflater.c | 37 +++++++
|
||||
jdk/src/share/native/java/util/zip/Inflater.c | 98 +++++++++++++++++++
|
||||
.../java/util/zip/DeflateIn_InflateOut.java | 74 +++++++++++++-
|
||||
12 files changed, 367 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/jdk/make/CompileLaunchers.gmk b/jdk/make/CompileLaunchers.gmk
|
||||
index de1ea9f4b..513e2ee1b 100644
|
||||
--- a/jdk/make/CompileLaunchers.gmk
|
||||
+++ b/jdk/make/CompileLaunchers.gmk
|
||||
@@ -474,17 +474,29 @@ ifeq ($(USE_EXTERNAL_LIBZ), true)
|
||||
UNPACKEXE_ZIPOBJS := -lz
|
||||
else
|
||||
UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
|
||||
- UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
|
||||
-
|
||||
+ ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
+ UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
|
||||
+ else
|
||||
+ UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libz/zcrc32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/deflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/trees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/zadler32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/compress$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/zutil$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/inflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/infback$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/inftrees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/inffast$(OBJ_SUFFIX)
|
||||
+ endif
|
||||
endif
|
||||
|
||||
UNPACKEXE_LANG := C
|
||||
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
|
||||
index d1cd1d3de..1af991693 100644
|
||||
--- a/jdk/make/lib/CoreLibraries.gmk
|
||||
+++ b/jdk/make/lib/CoreLibraries.gmk
|
||||
@@ -261,11 +261,76 @@ $(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
|
||||
|
||||
##########################################################################################
|
||||
|
||||
+ifneq ($(USE_EXTERNAL_LIBZ), true)
|
||||
+ ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
+ BUILD_LIBZ_EXCLUDES :=
|
||||
+
|
||||
+ ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
|
||||
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
+ ZLIB_CPPFLAGS += -DHAVE_UNISTD_H
|
||||
+ endif
|
||||
+
|
||||
+ BUILD_LIBZ_REORDER :=
|
||||
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
+ BUILD_LIBZ_REORDER := $(JDK_TOPDIR)/make/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
|
||||
+ endif
|
||||
+ endif
|
||||
+
|
||||
+ ifeq ($(LIBZ_CAN_USE_MMAP), true)
|
||||
+ BUILD_LIBZ_MMAP := -DUSE_MMAP
|
||||
+ endif
|
||||
+
|
||||
+ $(eval $(call SetupNativeCompilation,BUILD_LIBZ, \
|
||||
+ LIBRARY := z, \
|
||||
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
+ LANG := C, \
|
||||
+ OPTIMIZATION := LOW, \
|
||||
+ SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib, \
|
||||
+ EXCLUDES := $(LIBZ_EXCLUDES), \
|
||||
+ CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
+ $(ZLIB_CPPFLAGS) \
|
||||
+ -I$(JDK_TOPDIR)/src/share/native/java/io \
|
||||
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io, \
|
||||
+ CFLAGS_posix := $(BUILD_LIBZ_MMAP) -UDEBUG, \
|
||||
+ MAPFILE := , \
|
||||
+ REORDER := $(BUILD_LIBZ_REORDER), \
|
||||
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
|
||||
+ $(EXPORT_Z_FUNCS), \
|
||||
+ LDFLAGS_windows := jvm.lib \
|
||||
+ $(WIN_JAVA_LIB), \
|
||||
+ LDFLAGS_SUFFIX_linux := , \
|
||||
+ LDFLAGS_SUFFIX_solaris := , \
|
||||
+ LDFLAGS_SUFFIX_aix := ,\
|
||||
+ LDFLAGS_SUFFIX_macosx := , \
|
||||
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
+ RC_FLAGS := $(RC_FLAGS) \
|
||||
+ -D "JDK_FNAME=z.dll" \
|
||||
+ -D "JDK_INTERNAL_NAME=z" \
|
||||
+ -D "JDK_FTYPE=0x2L", \
|
||||
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libz, \
|
||||
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
+
|
||||
+
|
||||
+ $(BUILD_LIBZ): $(BUILD_LIBJAVA)
|
||||
+
|
||||
+ BUILD_LIBRARIES += $(BUILD_LIBZ)
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
+##########################################################################################
|
||||
+
|
||||
BUILD_LIBZIP_EXCLUDES :=
|
||||
ifeq ($(USE_EXTERNAL_LIBZ), true)
|
||||
+ BUILD_LIBZIP_SRC :=
|
||||
LIBZ := -lz
|
||||
LIBZIP_EXCLUDES += zlib
|
||||
else
|
||||
+ ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
+ BUILD_LIBZIP_SRC := Adler32.c CRC32.c Deflater.c Inflater.c zip_util.c ZipFile.c
|
||||
+ LIBZ := -lz
|
||||
+ endif
|
||||
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
ZLIB_CPPFLAGS += -DHAVE_UNISTD_H
|
||||
@@ -289,6 +354,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip, \
|
||||
+ INCLUDE_FILES := $(BUILD_LIBZIP_SRC), \
|
||||
EXCLUDES := $(LIBZIP_EXCLUDES), \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(ZLIB_CPPFLAGS) \
|
||||
@@ -315,9 +381,14 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
|
||||
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
|
||||
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
|
||||
+ifneq ($(USE_EXTERNAL_LIBZ), true)
|
||||
+ LIBZ :=
|
||||
+endif
|
||||
|
||||
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
|
||||
|
||||
+$(BUILD_LIBZIP): $(BUILD_LIBZ)
|
||||
+
|
||||
BUILD_LIBRARIES += $(BUILD_LIBZIP)
|
||||
|
||||
##########################################################################################
|
||||
diff --git a/jdk/make/mapfiles/libzip/mapfile-vers b/jdk/make/mapfiles/libzip/mapfile-vers
|
||||
index 5d33990c3..5c6d27d0d 100644
|
||||
--- a/jdk/make/mapfiles/libzip/mapfile-vers
|
||||
+++ b/jdk/make/mapfiles/libzip/mapfile-vers
|
||||
@@ -38,13 +38,16 @@ 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_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_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 bffa397d9..a4ea40cf8 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/Deflater.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/Deflater.java
|
||||
@@ -81,6 +81,7 @@ 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
|
||||
@@ -168,7 +169,13 @@ class Deflater {
|
||||
public Deflater(int level, boolean nowrap) {
|
||||
this.level = level;
|
||||
this.strategy = DEFAULT_STRATEGY;
|
||||
- this.zsRef = new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap));
|
||||
+ 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -571,6 +578,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 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 0d57e8ab3..7fb753729 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
@@ -54,6 +54,11 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
+ /*
|
||||
+ * GZIP use KAE.
|
||||
+ */
|
||||
+ private boolean gzipUseKae = false;
|
||||
+
|
||||
/**
|
||||
* Check to make sure that this stream has not been closed
|
||||
*/
|
||||
@@ -76,6 +81,12 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
public GZIPInputStream(InputStream in, int size) throws IOException {
|
||||
super(in, 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;
|
||||
readHeader(in);
|
||||
}
|
||||
|
||||
@@ -209,6 +220,9 @@ 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;
|
||||
+
|
||||
InputStream in = this.in;
|
||||
int n = inf.getRemaining();
|
||||
if (n > 0) {
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
|
||||
index 1c3f8592e..0f0be98bb 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
|
||||
@@ -52,6 +52,11 @@ class GZIPOutputStream extends DeflaterOutputStream {
|
||||
*/
|
||||
private final static int TRAILER_SIZE = 8;
|
||||
|
||||
+ /*
|
||||
+ * GZIP use KAE.
|
||||
+ */
|
||||
+ private boolean gzipUseKae = false;
|
||||
+
|
||||
/**
|
||||
* Creates a new output stream with the specified buffer size.
|
||||
*
|
||||
@@ -91,6 +96,12 @@ class GZIPOutputStream extends DeflaterOutputStream {
|
||||
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;
|
||||
writeHeader();
|
||||
crc.reset();
|
||||
}
|
||||
@@ -160,6 +171,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) {
|
||||
+ out.write(buf, 0, len);
|
||||
+ return;
|
||||
+ }
|
||||
writeTrailer(buf, len);
|
||||
len = len + TRAILER_SIZE;
|
||||
out.write(buf, 0, len);
|
||||
@@ -168,6 +184,10 @@ 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
|
||||
byte[] trailer = new byte[TRAILER_SIZE];
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/Inflater.java b/jdk/src/share/classes/java/util/zip/Inflater.java
|
||||
index c1eefe122..42e90f525 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/Inflater.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/Inflater.java
|
||||
@@ -80,6 +80,7 @@ class Inflater {
|
||||
private boolean needDict;
|
||||
private long bytesRead;
|
||||
private long bytesWritten;
|
||||
+ private boolean inflaterUseKae;
|
||||
|
||||
private static final byte[] defaultBuf = new byte[0];
|
||||
|
||||
@@ -100,7 +101,11 @@ class Inflater {
|
||||
* @param nowrap if true then support GZIP compatible compression
|
||||
*/
|
||||
public Inflater(boolean nowrap) {
|
||||
- zsRef = new ZStreamRef(init(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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +261,9 @@ class Inflater {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
int thisLen = this.len;
|
||||
- int n = inflateBytes(zsRef.address(), b, off, len);
|
||||
+ int n = this.inflaterUseKae ?
|
||||
+ inflateBytesKAE(zsRef.address(), b, off, len) :
|
||||
+ inflateBytes(zsRef.address(), b, off, len);
|
||||
bytesWritten += n;
|
||||
bytesRead += (thisLen - this.len);
|
||||
return n;
|
||||
@@ -397,10 +404,13 @@ class Inflater {
|
||||
|
||||
private native static void initIDs();
|
||||
private native static long init(boolean nowrap);
|
||||
+ private native static long initKae();
|
||||
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/InflaterOutputStream.java b/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java
|
||||
index 02900c741..62c6bb153 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2006, 2020, 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
|
||||
@@ -236,16 +236,9 @@ public class InflaterOutputStream extends FilterOutputStream {
|
||||
|
||||
// Fill the decompressor buffer with output data
|
||||
if (inf.needsInput()) {
|
||||
- int part;
|
||||
-
|
||||
- if (len < 1) {
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- part = (len < 512 ? len : 512);
|
||||
- inf.setInput(b, off, part);
|
||||
- off += part;
|
||||
- len -= part;
|
||||
+ inf.setInput(b, off, len);
|
||||
+ // Only use input buffer once.
|
||||
+ len = 0;
|
||||
}
|
||||
|
||||
// Decompress and write blocks of output data
|
||||
@@ -256,13 +249,14 @@ public class InflaterOutputStream extends FilterOutputStream {
|
||||
}
|
||||
} while (n > 0);
|
||||
|
||||
- // Check the decompressor
|
||||
- if (inf.finished()) {
|
||||
- break;
|
||||
- }
|
||||
+ // Check for missing dictionary first
|
||||
if (inf.needsDictionary()) {
|
||||
throw new ZipException("ZLIB dictionary missing");
|
||||
}
|
||||
+ // Check the decompressor
|
||||
+ if (inf.finished() || (len == 0) /* no more input */ ) {
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
} catch (DataFormatException ex) {
|
||||
// Improperly formatted compressed (ZIP) data
|
||||
diff --git a/jdk/src/share/lib/security/java.policy b/jdk/src/share/lib/security/java.policy
|
||||
index 8b6289720..baec2ea15 100644
|
||||
--- a/jdk/src/share/lib/security/java.policy
|
||||
+++ b/jdk/src/share/lib/security/java.policy
|
||||
@@ -48,5 +48,7 @@ grant {
|
||||
permission java.util.PropertyPermission "java.vm.name", "read";
|
||||
|
||||
permission java.util.PropertyPermission "sun.security.pkcs11.disableKeyExtraction", "read";
|
||||
+
|
||||
+ permission java.util.PropertyPermission "GZIP_USE_KAE", "read";
|
||||
};
|
||||
|
||||
diff --git a/jdk/src/share/native/java/util/zip/Deflater.c b/jdk/src/share/native/java/util/zip/Deflater.c
|
||||
index c1bd34667..1b048e4f5 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/Deflater.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/Deflater.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "java_util_zip_Deflater.h"
|
||||
|
||||
#define DEF_MEM_LEVEL 8
|
||||
+#define KAE_DEFLATER_WindowBit 31
|
||||
|
||||
static jfieldID levelID;
|
||||
static jfieldID strategyID;
|
||||
@@ -104,6 +105,42 @@ 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)
|
||||
+{
|
||||
+ z_stream *strm = calloc(1, sizeof(z_stream));
|
||||
+
|
||||
+ if (strm == 0) {
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ } else {
|
||||
+ const char *msg;
|
||||
+ int ret = deflateInit2(strm, level, Z_DEFLATED, KAE_DEFLATER_WindowBit, DEF_MEM_LEVEL, strategy);
|
||||
+ switch (ret) {
|
||||
+ case Z_OK:
|
||||
+ return ptr_to_jlong(strm);
|
||||
+ case Z_MEM_ERROR:
|
||||
+ free(strm);
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ case Z_STREAM_ERROR:
|
||||
+ free(strm);
|
||||
+ JNU_ThrowIllegalArgumentException(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ default:
|
||||
+ msg = ((strm->msg != NULL) ? strm->msg :
|
||||
+ (ret == Z_VERSION_ERROR) ?
|
||||
+ "zlib returned Z_VERSION_ERROR: "
|
||||
+ "compile time and runtime zlib implementations differ" :
|
||||
+ "unknown error initializing zlib library");
|
||||
+ free(strm);
|
||||
+ JNU_ThrowInternalError(env, msg);
|
||||
+ return jlong_zero;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_util_zip_Deflater_setDictionary(JNIEnv *env, jclass cls, jlong addr,
|
||||
jarray b, jint off, jint len)
|
||||
diff --git a/jdk/src/share/native/java/util/zip/Inflater.c b/jdk/src/share/native/java/util/zip/Inflater.c
|
||||
index 79bcdd5b6..fca207215 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/Inflater.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/Inflater.c
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#define ThrowDataFormatException(env, msg) \
|
||||
JNU_ThrowByName(env, "java/util/zip/DataFormatException", msg)
|
||||
+#define KAE_INFLATER_WindowBit 31
|
||||
|
||||
static jfieldID needDictID;
|
||||
static jfieldID finishedID;
|
||||
@@ -94,6 +95,39 @@ 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)
|
||||
+{
|
||||
+ z_stream *strm = calloc(1, sizeof(z_stream));
|
||||
+
|
||||
+ if (strm == NULL) {
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ } else {
|
||||
+ const char *msg;
|
||||
+ int ret = inflateInit2(strm, KAE_INFLATER_WindowBit);
|
||||
+ switch (ret) {
|
||||
+ case Z_OK:
|
||||
+ return ptr_to_jlong(strm);
|
||||
+ case Z_MEM_ERROR:
|
||||
+ free(strm);
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ default:
|
||||
+ msg = ((strm->msg != NULL) ? strm->msg :
|
||||
+ (ret == Z_VERSION_ERROR) ?
|
||||
+ "zlib returned Z_VERSION_ERROR: "
|
||||
+ "compile time and runtime zlib implementations differ" :
|
||||
+ (ret == Z_STREAM_ERROR) ?
|
||||
+ "inflateInit2 returned Z_STREAM_ERROR" :
|
||||
+ "unknown error initializing zlib library");
|
||||
+ free(strm);
|
||||
+ JNU_ThrowInternalError(env, msg);
|
||||
+ return jlong_zero;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_util_zip_Inflater_setDictionary(JNIEnv *env, jclass cls, jlong addr,
|
||||
jarray b, jint off, jint len)
|
||||
@@ -181,6 +215,70 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
|
||||
}
|
||||
}
|
||||
|
||||
+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);
|
||||
+ (*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_getAdler(JNIEnv *env, jclass cls, jlong addr)
|
||||
{
|
||||
diff --git a/jdk/test/java/util/zip/DeflateIn_InflateOut.java b/jdk/test/java/util/zip/DeflateIn_InflateOut.java
|
||||
index dd69a7773..048d8e34c 100644
|
||||
--- a/jdk/test/java/util/zip/DeflateIn_InflateOut.java
|
||||
+++ b/jdk/test/java/util/zip/DeflateIn_InflateOut.java
|
||||
@@ -41,14 +41,31 @@ public class DeflateIn_InflateOut {
|
||||
private static ByteArrayOutputStream baos;
|
||||
private static InflaterOutputStream ios;
|
||||
|
||||
- private static void reset() {
|
||||
+ private static Inflater reset(byte[] dict) {
|
||||
new Random(new Date().getTime()).nextBytes(data);
|
||||
|
||||
bais = new ByteArrayInputStream(data);
|
||||
- dis = new DeflaterInputStream(bais);
|
||||
+ if (dict == null) {
|
||||
+ dis = new DeflaterInputStream(bais);
|
||||
+ } else {
|
||||
+ Deflater def = new Deflater();
|
||||
+ def.setDictionary(dict);
|
||||
+ dis = new DeflaterInputStream(bais, def);
|
||||
+ }
|
||||
|
||||
baos = new ByteArrayOutputStream();
|
||||
- ios = new InflaterOutputStream(baos);
|
||||
+ if (dict == null) {
|
||||
+ ios = new InflaterOutputStream(baos);
|
||||
+ return null;
|
||||
+ } else {
|
||||
+ Inflater inf = new Inflater();
|
||||
+ ios = new InflaterOutputStream(baos, inf);
|
||||
+ return inf;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void reset() {
|
||||
+ reset(null);
|
||||
}
|
||||
|
||||
/** Check byte arrays read/write. */
|
||||
@@ -216,6 +233,44 @@ public class DeflateIn_InflateOut {
|
||||
check(numNotSkipped + numSkipBytes == numReadable);
|
||||
}
|
||||
|
||||
+ /** Check "needsDictionary()". */
|
||||
+ private static void NeedsDictionary() throws Throwable {
|
||||
+ byte[] dict = {1, 2, 3, 4};
|
||||
+ Adler32 adler32 = new Adler32();
|
||||
+ adler32.update(dict);
|
||||
+ long checksum = adler32.getValue();
|
||||
+ byte[] buf = new byte[512];
|
||||
+
|
||||
+ Inflater inf = reset(dict);
|
||||
+ check(dis.available() == 1);
|
||||
+ boolean dictSet = false;
|
||||
+ for (;;) {
|
||||
+ int len = dis.read(buf, 0, buf.length);
|
||||
+ if (len < 0) {
|
||||
+ break;
|
||||
+ } else {
|
||||
+ try {
|
||||
+ ios.write(buf, 0, len);
|
||||
+ if (dictSet == false) {
|
||||
+ check(false, "Must throw ZipException without dictionary");
|
||||
+ return;
|
||||
+ }
|
||||
+ } catch (ZipException ze) {
|
||||
+ check(dictSet == false, "Dictonary must be set only once");
|
||||
+ check(checksum == inf.getAdler(), "Incorrect dictionary");
|
||||
+ inf.setDictionary(dict);
|
||||
+ // After setting the dictionary, we have to flush the
|
||||
+ // InflaterOutputStream now in order to consume all the
|
||||
+ // pending input data from the last, failed call to "write()".
|
||||
+ ios.flush();
|
||||
+ dictSet = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ check(dis.available() == 0);
|
||||
+ ios.close();
|
||||
+ check(Arrays.equals(data, baos.toByteArray()));
|
||||
+ }
|
||||
|
||||
public static void realMain(String[] args) throws Throwable {
|
||||
ArrayReadWrite();
|
||||
@@ -227,15 +282,24 @@ public class DeflateIn_InflateOut {
|
||||
ByteReadByteWrite();
|
||||
|
||||
SkipBytes();
|
||||
+
|
||||
+ NeedsDictionary();
|
||||
}
|
||||
|
||||
//--------------------- Infrastructure ---------------------------
|
||||
static volatile int passed = 0, failed = 0;
|
||||
static void pass() {passed++;}
|
||||
- static void fail() {failed++; Thread.dumpStack();}
|
||||
- static void fail(String msg) {System.out.println(msg); fail();}
|
||||
+ static void fail() { fail(null); }
|
||||
+ static void fail(String msg) {
|
||||
+ failed++;
|
||||
+ if (msg != null) {
|
||||
+ System.err.println(msg);
|
||||
+ }
|
||||
+ Thread.dumpStack();
|
||||
+ }
|
||||
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
|
||||
static void check(boolean cond) {if (cond) pass(); else fail();}
|
||||
+ static void check(boolean cond, String msg) {if (cond) pass(); else fail(msg);}
|
||||
static void equal(Object x, Object y) {
|
||||
if (x == null ? y == null : x.equals(y)) pass();
|
||||
else fail(x + " not equal to " + y);}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -257,13 +257,13 @@ index dd107fc..791ddb6 100644
|
||||
+ File.separator + "security" + File.separator + "cacerts";
|
||||
|
||||
// The numbers of certs now.
|
||||
- private static final int COUNT = 108;
|
||||
- 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
|
||||
- = "81:D4:84:F6:92:78:A4:82:25:06:DC:42:25:C9:5D:6C:63:E4:99:CE:BC:ED:66:B3:8C:BA:E6:BA:6B:34:0F:01";
|
||||
- = "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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user