!627 sync master to openEuler-24.03-LTS

From: @Autistic_boyya 
Reviewed-by: @kuenking111 
Signed-off-by: @kuenking111
This commit is contained in:
openeuler-ci-bot 2025-02-28 06:27:33 +00:00 committed by Gitee
commit 9b37d1d280
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
31 changed files with 9828 additions and 4328 deletions

View 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

View 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

View File

@ -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

View File

@ -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

View 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

View File

@ -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 */

View 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

View 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

File diff suppressed because it is too large Load Diff

View 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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -258,7 +258,7 @@ index 87e42318..c496c9eb 100644
// For Forte Analyzer AsyncGetCallTrace profiling support - thread is
// currently interrupted by SIGPROF
@@ -39,6 +40,127 @@ 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);
}
@ -345,14 +345,6 @@ index 87e42318..c496c9eb 100644
+ FLAG_SET_DEFAULT(InterpreterProfilePercentage, 17);
+}
+
+void set_intrinsic_param() {
+ if (FLAG_IS_DEFAULT(UseHBaseUtilIntrinsics)) {
+ warning("If your HBase version is lower than 2.4.14, please explicitly specify"
+ " -XX:-UseHBaseUtilIntrinsics, otherwise HBase may fail to start.");
+ FLAG_SET_DEFAULT(UseHBaseUtilIntrinsics, true);
+ }
+}
+
+void JavaThread::os_linux_aarch64_options(int apc, char **name) {
+ if (name == NULL) {
+ return;
@ -363,10 +355,12 @@ index 87e42318..c496c9eb 100644
+ int step = 0;
+ while (name[i] != NULL) {
+ if (stringHash(name[i]) == 1396789436) {
+ set_compilation_tuner_params();
+ set_intrinsic_param();
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && (UseG1GC || UseParallelGC) && apc > 8)
+ FLAG_SET_DEFAULT(ActiveProcessorCount, 8);
+ 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;

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -20,6 +20,8 @@
%bcond_without slowdebug
# Enable release builds by default on relevant arches.
%bcond_without release
# Disable global LTO
%define _lto_cflags %{nil}
# The -g flag says to use strip -g instead of full strip on DSOs or EXEs.
# This fixes detailed NMT and other tools which need minimal debug info.
@ -172,12 +174,12 @@
%global origin_nice OpenJDK
%global top_level_dir_name %{origin}
%global repo jdk8u
%global revision jdk8u432-b06
%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 432
%global updatever 442
%global buildver b06
# priority must be 7 digits in total. The expression is workarounding tip
%global priority 1800%{updatever}
@ -1154,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
@ -1352,6 +1354,13 @@ 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
@ -1362,7 +1371,6 @@ Patch450: Huawei-Fix-build-failures-due-to-wrap-in-x86.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
#############################################
#
@ -1396,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
@ -2015,6 +2022,13 @@ pushd %{top_level_dir_name}
%patch448 -p1
%patch449 -p1
%patch450 -p1
%patch451 -p1
%patch452 -p1
%patch453 -p1
%patch454 -p1
%patch455 -p1
%patch456 -p1
%patch457 -p1
%endif
%ifarch loongarch64
@ -2033,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}
@ -2680,7 +2690,17 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect
%endif
%changelog
* Thu Oct 17 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.432-b05.rolling
* 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
@ -2690,6 +2710,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect
- 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

View File

@ -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;
}

View File

@ -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

View File

@ -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.