!375 upgrade master branch to jdk8u352-b08 for openEuler 22.03-LTS-Next
From: @kuenking111 Reviewed-by: @alexanderbill Signed-off-by: @alexanderbill
This commit is contained in:
commit
7ac55506fe
@ -0,0 +1,485 @@
|
||||
From 69371858fda3c1793faf8bbf116ec4fe554605ac Mon Sep 17 00:00:00 2001
|
||||
From: hedongbo <hedongbo@huawei.com>
|
||||
Date: Fri, 21 Oct 2022 15:16:04 +0800
|
||||
Subject: 8065895: Synchronous signals during error reporting may
|
||||
terminate or hang VM process
|
||||
|
||||
Bug url: https://bugs.openjdk.java.net/browse/JDK-8065895
|
||||
---
|
||||
hotspot/src/os/aix/vm/vmError_aix.cpp | 11 +++--
|
||||
hotspot/src/os/bsd/vm/vmError_bsd.cpp | 47 +++++++++++-------
|
||||
hotspot/src/os/linux/vm/vmError_linux.cpp | 48 ++++++++++++-------
|
||||
hotspot/src/os/solaris/vm/vmError_solaris.cpp | 48 ++++++++++++-------
|
||||
hotspot/src/share/vm/runtime/globals.hpp | 4 ++
|
||||
hotspot/src/share/vm/utilities/debug.cpp | 48 ++++++++++++++++---
|
||||
hotspot/src/share/vm/utilities/debug.hpp | 18 +++++++
|
||||
hotspot/src/share/vm/utilities/vmError.cpp | 29 +++++++++++
|
||||
8 files changed, 196 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/os/aix/vm/vmError_aix.cpp b/hotspot/src/os/aix/vm/vmError_aix.cpp
|
||||
index d99436ebc..34709134a 100644
|
||||
--- a/hotspot/src/os/aix/vm/vmError_aix.cpp
|
||||
+++ b/hotspot/src/os/aix/vm/vmError_aix.cpp
|
||||
@@ -80,7 +80,6 @@ static void save_signal(int idx, int sig) {
|
||||
}
|
||||
|
||||
int VMError::get_resetted_sigflags(int sig) {
|
||||
- // Handle all program errors.
|
||||
for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
if (SIGNALS[i] == sig) {
|
||||
return resettedSigflags[i];
|
||||
@@ -90,7 +89,6 @@ int VMError::get_resetted_sigflags(int sig) {
|
||||
}
|
||||
|
||||
address VMError::get_resetted_sighandler(int sig) {
|
||||
- // Handle all program errors.
|
||||
for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
if (SIGNALS[i] == sig) {
|
||||
return resettedSighandler[i];
|
||||
@@ -100,12 +98,19 @@ address VMError::get_resetted_sighandler(int sig) {
|
||||
}
|
||||
|
||||
static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
|
||||
+
|
||||
// Unmask current signal.
|
||||
sigset_t newset;
|
||||
sigemptyset(&newset);
|
||||
sigaddset(&newset, sig);
|
||||
+ // and all other synchronous signals too.
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ sigthreadmask(SIG_UNBLOCK, &newset, NULL);
|
||||
|
||||
- Unimplemented();
|
||||
+ VMError err(NULL, sig, NULL, info, ucVoid);
|
||||
+ err.report_and_die();
|
||||
}
|
||||
|
||||
void VMError::reset_signal_handlers() {
|
||||
diff --git a/hotspot/src/os/bsd/vm/vmError_bsd.cpp b/hotspot/src/os/bsd/vm/vmError_bsd.cpp
|
||||
index 8ec6ca04c..f09e1163f 100644
|
||||
--- a/hotspot/src/os/bsd/vm/vmError_bsd.cpp
|
||||
+++ b/hotspot/src/os/bsd/vm/vmError_bsd.cpp
|
||||
@@ -63,9 +63,15 @@ void VMError::show_message_box(char *buf, int buflen) {
|
||||
} while (yes);
|
||||
}
|
||||
|
||||
+// handle all synchronous program error signals which may happen during error
|
||||
+// reporting. They must be unblocked, caught, handled.
|
||||
+
|
||||
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
|
||||
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
|
||||
+
|
||||
// Space for our "saved" signal flags and handlers
|
||||
-static int resettedSigflags[2];
|
||||
-static address resettedSighandler[2];
|
||||
+static int resettedSigflags[NUM_SIGNALS];
|
||||
+static address resettedSighandler[NUM_SIGNALS];
|
||||
|
||||
static void save_signal(int idx, int sig)
|
||||
{
|
||||
@@ -78,19 +84,19 @@ static void save_signal(int idx, int sig)
|
||||
}
|
||||
|
||||
int VMError::get_resetted_sigflags(int sig) {
|
||||
- if(SIGSEGV == sig) {
|
||||
- return resettedSigflags[0];
|
||||
- } else if(SIGBUS == sig) {
|
||||
- return resettedSigflags[1];
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ if (SIGNALS[i] == sig) {
|
||||
+ return resettedSigflags[i];
|
||||
+ }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
address VMError::get_resetted_sighandler(int sig) {
|
||||
- if(SIGSEGV == sig) {
|
||||
- return resettedSighandler[0];
|
||||
- } else if(SIGBUS == sig) {
|
||||
- return resettedSighandler[1];
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ if (SIGNALS[i] == sig) {
|
||||
+ return resettedSighandler[i];
|
||||
+ }
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -100,16 +106,25 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
|
||||
sigset_t newset;
|
||||
sigemptyset(&newset);
|
||||
sigaddset(&newset, sig);
|
||||
- sigprocmask(SIG_UNBLOCK, &newset, NULL);
|
||||
+ // also unmask other synchronous signals
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
|
||||
|
||||
VMError err(NULL, sig, NULL, info, ucVoid);
|
||||
err.report_and_die();
|
||||
}
|
||||
|
||||
void VMError::reset_signal_handlers() {
|
||||
- // Save sigflags for resetted signals
|
||||
- save_signal(0, SIGSEGV);
|
||||
- save_signal(1, SIGBUS);
|
||||
- os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
- os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
+ // install signal handlers for all synchronous program error signals
|
||||
+ sigset_t newset;
|
||||
+ sigemptyset(&newset);
|
||||
+
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ save_signal(i, SIGNALS[i]);
|
||||
+ os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
|
||||
}
|
||||
diff --git a/hotspot/src/os/linux/vm/vmError_linux.cpp b/hotspot/src/os/linux/vm/vmError_linux.cpp
|
||||
index 378c9a6ab..fca239c7e 100644
|
||||
--- a/hotspot/src/os/linux/vm/vmError_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/vmError_linux.cpp
|
||||
@@ -63,9 +63,15 @@ void VMError::show_message_box(char *buf, int buflen) {
|
||||
} while (yes);
|
||||
}
|
||||
|
||||
+// handle all synchronous program error signals which may happen during error
|
||||
+// reporting. They must be unblocked, caught, handled.
|
||||
+
|
||||
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
|
||||
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
|
||||
+
|
||||
// Space for our "saved" signal flags and handlers
|
||||
-static int resettedSigflags[2];
|
||||
-static address resettedSighandler[2];
|
||||
+static int resettedSigflags[NUM_SIGNALS];
|
||||
+static address resettedSighandler[NUM_SIGNALS];
|
||||
|
||||
static void save_signal(int idx, int sig)
|
||||
{
|
||||
@@ -78,19 +84,19 @@ static void save_signal(int idx, int sig)
|
||||
}
|
||||
|
||||
int VMError::get_resetted_sigflags(int sig) {
|
||||
- if(SIGSEGV == sig) {
|
||||
- return resettedSigflags[0];
|
||||
- } else if(SIGBUS == sig) {
|
||||
- return resettedSigflags[1];
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ if (SIGNALS[i] == sig) {
|
||||
+ return resettedSigflags[i];
|
||||
+ }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
address VMError::get_resetted_sighandler(int sig) {
|
||||
- if(SIGSEGV == sig) {
|
||||
- return resettedSighandler[0];
|
||||
- } else if(SIGBUS == sig) {
|
||||
- return resettedSighandler[1];
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ if (SIGNALS[i] == sig) {
|
||||
+ return resettedSighandler[i];
|
||||
+ }
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -100,16 +106,26 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
|
||||
sigset_t newset;
|
||||
sigemptyset(&newset);
|
||||
sigaddset(&newset, sig);
|
||||
- sigprocmask(SIG_UNBLOCK, &newset, NULL);
|
||||
+ // also unmask other synchronous signals
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
|
||||
|
||||
VMError err(NULL, sig, NULL, info, ucVoid);
|
||||
err.report_and_die();
|
||||
}
|
||||
|
||||
void VMError::reset_signal_handlers() {
|
||||
- // Save sigflags for resetted signals
|
||||
- save_signal(0, SIGSEGV);
|
||||
- save_signal(1, SIGBUS);
|
||||
- os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
- os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
+ // install signal handlers for all synchronous program error signals
|
||||
+ sigset_t newset;
|
||||
+ sigemptyset(&newset);
|
||||
+
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ save_signal(i, SIGNALS[i]);
|
||||
+ os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
|
||||
+
|
||||
}
|
||||
diff --git a/hotspot/src/os/solaris/vm/vmError_solaris.cpp b/hotspot/src/os/solaris/vm/vmError_solaris.cpp
|
||||
index 6f3f5b06f..e24e5f6bf 100644
|
||||
--- a/hotspot/src/os/solaris/vm/vmError_solaris.cpp
|
||||
+++ b/hotspot/src/os/solaris/vm/vmError_solaris.cpp
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
+#include <thread.h>
|
||||
#include <signal.h>
|
||||
|
||||
void VMError::show_message_box(char *buf, int buflen) {
|
||||
@@ -59,9 +60,15 @@ void VMError::show_message_box(char *buf, int buflen) {
|
||||
} while (yes);
|
||||
}
|
||||
|
||||
+// handle all synchronous program error signals which may happen during error
|
||||
+// reporting. They must be unblocked, caught, handled.
|
||||
+
|
||||
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
|
||||
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
|
||||
+
|
||||
// Space for our "saved" signal flags and handlers
|
||||
-static int resettedSigflags[2];
|
||||
-static address resettedSighandler[2];
|
||||
+static int resettedSigflags[NUM_SIGNALS];
|
||||
+static address resettedSighandler[NUM_SIGNALS];
|
||||
|
||||
static void save_signal(int idx, int sig)
|
||||
{
|
||||
@@ -74,19 +81,19 @@ static void save_signal(int idx, int sig)
|
||||
}
|
||||
|
||||
int VMError::get_resetted_sigflags(int sig) {
|
||||
- if(SIGSEGV == sig) {
|
||||
- return resettedSigflags[0];
|
||||
- } else if(SIGBUS == sig) {
|
||||
- return resettedSigflags[1];
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ if (SIGNALS[i] == sig) {
|
||||
+ return resettedSigflags[i];
|
||||
+ }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
address VMError::get_resetted_sighandler(int sig) {
|
||||
- if(SIGSEGV == sig) {
|
||||
- return resettedSighandler[0];
|
||||
- } else if(SIGBUS == sig) {
|
||||
- return resettedSighandler[1];
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ if (SIGNALS[i] == sig) {
|
||||
+ return resettedSighandler[i];
|
||||
+ }
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -96,16 +103,25 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
|
||||
sigset_t newset;
|
||||
sigemptyset(&newset);
|
||||
sigaddset(&newset, sig);
|
||||
- sigprocmask(SIG_UNBLOCK, &newset, NULL);
|
||||
+ // also unmask other synchronous signals
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
|
||||
|
||||
VMError err(NULL, sig, NULL, info, ucVoid);
|
||||
err.report_and_die();
|
||||
}
|
||||
|
||||
void VMError::reset_signal_handlers() {
|
||||
- // Save sigflags for resetted signals
|
||||
- save_signal(0, SIGSEGV);
|
||||
- save_signal(1, SIGBUS);
|
||||
- os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
- os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
+ // install signal handlers for all synchronous program error signals
|
||||
+ sigset_t newset;
|
||||
+ sigemptyset(&newset);
|
||||
+
|
||||
+ for (int i = 0; i < NUM_SIGNALS; i++) {
|
||||
+ save_signal(i, SIGNALS[i]);
|
||||
+ os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
|
||||
+ sigaddset(&newset, SIGNALS[i]);
|
||||
+ }
|
||||
+ thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
index eb13ee0d7..0dab18e1a 100644
|
||||
--- a/hotspot/src/share/vm/runtime/globals.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
@@ -916,6 +916,10 @@ class CommandLineFlags {
|
||||
"determines which error to provoke. See test_error_handler() " \
|
||||
"in debug.cpp.") \
|
||||
\
|
||||
+ notproduct(uintx, TestCrashInErrorHandler, 0, \
|
||||
+ "If > 0, provokes an error inside VM error handler (a secondary " \
|
||||
+ "crash). see test_error_handler() in debug.cpp.") \
|
||||
+ \
|
||||
develop(bool, Verbose, false, \
|
||||
"Print additional debugging information from other modes") \
|
||||
\
|
||||
diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp
|
||||
index 58a32a2b8..8cea16d32 100644
|
||||
--- a/hotspot/src/share/vm/utilities/debug.cpp
|
||||
+++ b/hotspot/src/share/vm/utilities/debug.cpp
|
||||
@@ -337,13 +337,47 @@ bool is_error_reported() {
|
||||
#ifndef PRODUCT
|
||||
#include <signal.h>
|
||||
|
||||
+typedef void (*voidfun_t)();
|
||||
+// Crash with an authentic sigfpe
|
||||
+static void crash_with_sigfpe() {
|
||||
+ // generate a native synchronous SIGFPE where possible;
|
||||
+ // if that did not cause a signal (e.g. on ppc), just
|
||||
+ // raise the signal.
|
||||
+ volatile int x = 0;
|
||||
+ volatile int y = 1/x;
|
||||
+#ifndef _WIN32
|
||||
+ raise(SIGFPE);
|
||||
+#endif
|
||||
+} // end: crash_with_sigfpe
|
||||
+
|
||||
+// crash with sigsegv at non-null address.
|
||||
+static void crash_with_segfault() {
|
||||
+
|
||||
+ char* const crash_addr = (char*) get_segfault_address();
|
||||
+ *crash_addr = 'X';
|
||||
+
|
||||
+} // end: crash_with_segfault
|
||||
+
|
||||
+// returns an address which is guaranteed to generate a SIGSEGV on read,
|
||||
+// for test purposes, which is not NULL and contains bits in every word
|
||||
+void* get_segfault_address() {
|
||||
+ return (void*)
|
||||
+#ifdef _LP64
|
||||
+ 0xABC0000000000ABCULL;
|
||||
+#else
|
||||
+ 0x00000ABC;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
void test_error_handler() {
|
||||
- uintx test_num = ErrorHandlerTest;
|
||||
- if (test_num == 0) return;
|
||||
+ controlled_crash(ErrorHandlerTest);
|
||||
+}
|
||||
+
|
||||
+void controlled_crash(int how) {
|
||||
+ if (how == 0) return;
|
||||
|
||||
// If asserts are disabled, use the corresponding guarantee instead.
|
||||
- size_t n = test_num;
|
||||
- NOT_DEBUG(if (n <= 2) n += 2);
|
||||
+ NOT_DEBUG(if (how <= 2) how += 2);
|
||||
|
||||
const char* const str = "hello";
|
||||
const size_t num = (size_t)os::vm_page_size();
|
||||
@@ -354,7 +388,7 @@ void test_error_handler() {
|
||||
const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer
|
||||
|
||||
// Keep this in sync with test/runtime/6888954/vmerrors.sh.
|
||||
- switch (n) {
|
||||
+ switch (how) {
|
||||
case 1: assert(str == NULL, "expected null");
|
||||
case 2: assert(num == 1023 && *str == 'X',
|
||||
err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
|
||||
@@ -379,8 +413,10 @@ void test_error_handler() {
|
||||
// There's no guarantee the bad function pointer will crash us
|
||||
// so "break" out to the ShouldNotReachHere().
|
||||
case 13: (*funcPtr)(); break;
|
||||
+ case 14: crash_with_segfault(); break;
|
||||
+ case 15: crash_with_sigfpe(); break;
|
||||
|
||||
- default: tty->print_cr("ERROR: %d: unexpected test_num value.", n);
|
||||
+ default: tty->print_cr("ERROR: %d: unexpected test_num value.", how);
|
||||
}
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp
|
||||
index 3c3f8afe2..7a5e1523b 100644
|
||||
--- a/hotspot/src/share/vm/utilities/debug.hpp
|
||||
+++ b/hotspot/src/share/vm/utilities/debug.hpp
|
||||
@@ -266,6 +266,24 @@ void set_error_reported();
|
||||
/* Test assert(), fatal(), guarantee(), etc. */
|
||||
NOT_PRODUCT(void test_error_handler();)
|
||||
|
||||
+// crash in a controlled way:
|
||||
+// how can be one of:
|
||||
+// 1,2 - asserts
|
||||
+// 3,4 - guarantee
|
||||
+// 5-7 - fatal
|
||||
+// 8 - vm_exit_out_of_memory
|
||||
+// 9 - ShouldNotCallThis
|
||||
+// 10 - ShouldNotReachHere
|
||||
+// 11 - Unimplemented
|
||||
+// 12,13 - (not guaranteed) crashes
|
||||
+// 14 - SIGSEGV
|
||||
+// 15 - SIGFPE
|
||||
+NOT_PRODUCT(void controlled_crash(int how);)
|
||||
+
|
||||
+// returns an address which is guaranteed to generate a SIGSEGV on read,
|
||||
+// for test purposes, which is not NULL and contains bits in every word
|
||||
+NOT_PRODUCT(void* get_segfault_address();)
|
||||
+
|
||||
void pd_ps(frame f);
|
||||
void pd_obfuscate_location(char *buf, size_t buflen);
|
||||
|
||||
diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp
|
||||
index aa0b63a80..9b40a3468 100644
|
||||
--- a/hotspot/src/share/vm/utilities/vmError.cpp
|
||||
+++ b/hotspot/src/share/vm/utilities/vmError.cpp
|
||||
@@ -397,6 +397,26 @@ void VMError::report(outputStream* st) {
|
||||
"Runtime Environment to continue.");
|
||||
}
|
||||
|
||||
+#ifndef PRODUCT
|
||||
+ // Error handler self tests
|
||||
+
|
||||
+ // test secondary error handling. Test it twice, to test that resetting
|
||||
+ // error handler after a secondary crash works.
|
||||
+ STEP(13, "(test secondary crash 1)")
|
||||
+ if (_verbose && TestCrashInErrorHandler != 0) {
|
||||
+ st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
|
||||
+ TestCrashInErrorHandler);
|
||||
+ controlled_crash(TestCrashInErrorHandler);
|
||||
+ }
|
||||
+
|
||||
+ STEP(14, "(test secondary crash 2)")
|
||||
+ if (_verbose && TestCrashInErrorHandler != 0) {
|
||||
+ st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
|
||||
+ TestCrashInErrorHandler);
|
||||
+ controlled_crash(TestCrashInErrorHandler);
|
||||
+ }
|
||||
+#endif // PRODUCT
|
||||
+
|
||||
STEP(15, "(printing type of error)")
|
||||
|
||||
switch(static_cast<unsigned int>(_id)) {
|
||||
@@ -829,6 +849,15 @@ void VMError::report(outputStream* st) {
|
||||
st->cr();
|
||||
}
|
||||
|
||||
+#ifndef PRODUCT
|
||||
+ // print a defined marker to show that error handling finished correctly.
|
||||
+ STEP(290, "(printing end marker)" )
|
||||
+
|
||||
+ if (_verbose) {
|
||||
+ st->print_cr("END.");
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
END
|
||||
|
||||
# undef BEGIN
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From 85a351276984f56d817560db8b5b837254ec2994 Mon Sep 17 00:00:00 2001
|
||||
From: zhangyipeng <zhangyipeng7@huawei.com>
|
||||
Date: Tue, 7 Jun 2022 20:10:03 +0800
|
||||
Subject: [PATCH 05/10] 8173339: AArch64: Fix minimum stack size computations
|
||||
|
||||
Bug url: https://bugs.openjdk.java.net/browse/JDK-8173339
|
||||
---
|
||||
hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp
|
||||
index 6610cc4fb..7c6b24879 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp
|
||||
@@ -56,7 +56,10 @@ define_pd_global(intx, InlineFrequencyCount, 100);
|
||||
define_pd_global(intx, StackYellowPages, 2);
|
||||
define_pd_global(intx, StackRedPages, 1);
|
||||
|
||||
-define_pd_global(intx, StackShadowPages, 4 DEBUG_ONLY(+5));
|
||||
+// Java_java_net_SocketOutputStream_socketWrite0() uses a 64k buffer on the
|
||||
+// stack if compiled for unix and LP64. To pass stack overflow tests we need
|
||||
+// 20 shadow pages.
|
||||
+define_pd_global(intx, StackShadowPages, 20 DEBUG_ONLY(+5));
|
||||
|
||||
define_pd_global(intx, PreInflateSpin, 10);
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -1,290 +0,0 @@
|
||||
diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp
|
||||
index 175c195c6..01e878022 100644
|
||||
--- a/hotspot/src/share/vm/code/nmethod.cpp
|
||||
+++ b/hotspot/src/share/vm/code/nmethod.cpp
|
||||
@@ -1656,24 +1656,28 @@ bool nmethod::can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_
|
||||
// Transfer information from compilation to jvmti
|
||||
void nmethod::post_compiled_method_load_event() {
|
||||
|
||||
- Method* moop = method();
|
||||
+ // This is a bad time for a safepoint. We don't want
|
||||
+ // this nmethod to get unloaded while we're queueing the event.
|
||||
+ No_Safepoint_Verifier nsv;
|
||||
+
|
||||
+ Method* m = method();
|
||||
#ifndef USDT2
|
||||
HS_DTRACE_PROBE8(hotspot, compiled__method__load,
|
||||
- moop->klass_name()->bytes(),
|
||||
- moop->klass_name()->utf8_length(),
|
||||
- moop->name()->bytes(),
|
||||
- moop->name()->utf8_length(),
|
||||
- moop->signature()->bytes(),
|
||||
- moop->signature()->utf8_length(),
|
||||
+ m->klass_name()->bytes(),
|
||||
+ m->klass_name()->utf8_length(),
|
||||
+ m->name()->bytes(),
|
||||
+ m->name()->utf8_length(),
|
||||
+ m->signature()->bytes(),
|
||||
+ m->signature()->utf8_length(),
|
||||
insts_begin(), insts_size());
|
||||
#else /* USDT2 */
|
||||
HOTSPOT_COMPILED_METHOD_LOAD(
|
||||
- (char *) moop->klass_name()->bytes(),
|
||||
- moop->klass_name()->utf8_length(),
|
||||
- (char *) moop->name()->bytes(),
|
||||
- moop->name()->utf8_length(),
|
||||
- (char *) moop->signature()->bytes(),
|
||||
- moop->signature()->utf8_length(),
|
||||
+ (char *) m->klass_name()->bytes(),
|
||||
+ m->klass_name()->utf8_length(),
|
||||
+ (char *) m->name()->bytes(),
|
||||
+ m->name()->utf8_length(),
|
||||
+ (char *) m->signature()->bytes(),
|
||||
+ m->signature()->utf8_length(),
|
||||
insts_begin(), insts_size());
|
||||
#endif /* USDT2 */
|
||||
|
||||
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
index 895fbbf07..367c9a09d 100644
|
||||
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
@@ -1786,7 +1786,7 @@ jmethodID InstanceKlass::get_jmethod_id(instanceKlassHandle ik_h, methodHandle m
|
||||
// we're single threaded or at a safepoint - no locking needed
|
||||
get_jmethod_id_length_value(jmeths, idnum, &length, &id);
|
||||
} else {
|
||||
- MutexLocker ml(JmethodIdCreation_lock);
|
||||
+ MutexLockerEx ml(JmethodIdCreation_lock, Mutex::_no_safepoint_check_flag);
|
||||
get_jmethod_id_length_value(jmeths, idnum, &length, &id);
|
||||
}
|
||||
}
|
||||
@@ -1836,7 +1836,7 @@ jmethodID InstanceKlass::get_jmethod_id(instanceKlassHandle ik_h, methodHandle m
|
||||
id = get_jmethod_id_fetch_or_update(ik_h, idnum, new_id, new_jmeths,
|
||||
&to_dealloc_id, &to_dealloc_jmeths);
|
||||
} else {
|
||||
- MutexLocker ml(JmethodIdCreation_lock);
|
||||
+ MutexLockerEx ml(JmethodIdCreation_lock, Mutex::_no_safepoint_check_flag);
|
||||
id = get_jmethod_id_fetch_or_update(ik_h, idnum, new_id, new_jmeths,
|
||||
&to_dealloc_id, &to_dealloc_jmeths);
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp
|
||||
index 9b612598f..967ed200d 100644
|
||||
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp
|
||||
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp
|
||||
@@ -1754,7 +1754,7 @@ jvmtiCompiledMethodLoadInlineRecord* create_inline_record(nmethod* nm) {
|
||||
int stackframe = 0;
|
||||
for(ScopeDesc* sd = nm->scope_desc_at(p->real_pc(nm));sd != NULL;sd = sd->sender()) {
|
||||
// sd->method() can be NULL for stubs but not for nmethods. To be completely robust, include an assert that we should never see a null sd->method()
|
||||
- assert(sd->method() != NULL, "sd->method() cannot be null.");
|
||||
+ guarantee(sd->method() != NULL, "sd->method() cannot be null.");
|
||||
record->pcinfo[scope].methods[stackframe] = sd->method()->jmethod_id();
|
||||
record->pcinfo[scope].bcis[stackframe] = sd->bci();
|
||||
stackframe++;
|
||||
diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.cpp b/hotspot/src/share/vm/prims/jvmtiImpl.cpp
|
||||
index 3c66b1671..3bcd15ed6 100644
|
||||
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp
|
||||
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp
|
||||
@@ -897,9 +897,6 @@ JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_load_event(
|
||||
nmethod* nm) {
|
||||
JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_LOAD);
|
||||
event._event_data.compiled_method_load = nm;
|
||||
- // Keep the nmethod alive until the ServiceThread can process
|
||||
- // this deferred event.
|
||||
- nmethodLocker::lock_nmethod(nm);
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -932,14 +929,12 @@ JvmtiDeferredEvent JvmtiDeferredEvent::dynamic_code_generated_event(
|
||||
}
|
||||
|
||||
void JvmtiDeferredEvent::post() {
|
||||
- assert(ServiceThread::is_service_thread(Thread::current()),
|
||||
+ assert(Thread::current()->is_service_thread(),
|
||||
"Service thread must post enqueued events");
|
||||
switch(_type) {
|
||||
case TYPE_COMPILED_METHOD_LOAD: {
|
||||
nmethod* nm = _event_data.compiled_method_load;
|
||||
JvmtiExport::post_compiled_method_load(nm);
|
||||
- // done with the deferred event so unlock the nmethod
|
||||
- nmethodLocker::unlock_nmethod(nm);
|
||||
break;
|
||||
}
|
||||
case TYPE_COMPILED_METHOD_UNLOAD: {
|
||||
@@ -969,6 +964,21 @@ void JvmtiDeferredEvent::post() {
|
||||
}
|
||||
}
|
||||
|
||||
+// Keep the nmethod for compiled_method_load from being unloaded.
|
||||
+void JvmtiDeferredEvent::oops_do(OopClosure* f, CodeBlobClosure* cf) {
|
||||
+ if (cf != NULL && _type == TYPE_COMPILED_METHOD_LOAD) {
|
||||
+ cf->do_code_blob(_event_data.compiled_method_load);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+// The sweeper calls this and marks the nmethods here on the stack so that
|
||||
+// they cannot be turned into zombies while in the queue.
|
||||
+void JvmtiDeferredEvent::nmethods_do(CodeBlobClosure* cf) {
|
||||
+ if (cf != NULL && _type == TYPE_COMPILED_METHOD_LOAD) {
|
||||
+ cf->do_code_blob(_event_data.compiled_method_load);
|
||||
+ } // May add UNLOAD event but it doesn't work yet.
|
||||
+}
|
||||
+
|
||||
JvmtiDeferredEventQueue::QueueNode* JvmtiDeferredEventQueue::_queue_tail = NULL;
|
||||
JvmtiDeferredEventQueue::QueueNode* JvmtiDeferredEventQueue::_queue_head = NULL;
|
||||
|
||||
@@ -1084,3 +1094,15 @@ void JvmtiDeferredEventQueue::process_pending_events() {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+void JvmtiDeferredEventQueue::oops_do(OopClosure* f, CodeBlobClosure* cf) {
|
||||
+ for(QueueNode* node = _queue_head; node != NULL; node = node->next()) {
|
||||
+ node->event().oops_do(f, cf);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void JvmtiDeferredEventQueue::nmethods_do(CodeBlobClosure* cf) {
|
||||
+ for(QueueNode* node = _queue_head; node != NULL; node = node->next()) {
|
||||
+ node->event().nmethods_do(cf);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.hpp b/hotspot/src/share/vm/prims/jvmtiImpl.hpp
|
||||
index 9f36f28fb..d74789451 100644
|
||||
--- a/hotspot/src/share/vm/prims/jvmtiImpl.hpp
|
||||
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.hpp
|
||||
@@ -492,6 +492,10 @@ class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
// Actually posts the event.
|
||||
void post() NOT_JVMTI_RETURN;
|
||||
+ // Sweeper support to keep nmethods from being zombied while in the queue.
|
||||
+ void nmethods_do(CodeBlobClosure* cf);
|
||||
+ // GC support to keep nmethod from being unloaded while in the queue.
|
||||
+ void oops_do(OopClosure* f, CodeBlobClosure* cf);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -511,7 +515,7 @@ class JvmtiDeferredEventQueue : AllStatic {
|
||||
QueueNode(const JvmtiDeferredEvent& event)
|
||||
: _event(event), _next(NULL) {}
|
||||
|
||||
- const JvmtiDeferredEvent& event() const { return _event; }
|
||||
+ JvmtiDeferredEvent& event() { return _event; }
|
||||
QueueNode* next() const { return _next; }
|
||||
|
||||
void set_next(QueueNode* next) { _next = next; }
|
||||
@@ -529,6 +533,10 @@ class JvmtiDeferredEventQueue : AllStatic {
|
||||
static bool has_events() NOT_JVMTI_RETURN_(false);
|
||||
static void enqueue(const JvmtiDeferredEvent& event) NOT_JVMTI_RETURN;
|
||||
static JvmtiDeferredEvent dequeue() NOT_JVMTI_RETURN_(JvmtiDeferredEvent());
|
||||
+ // Sweeper support to keep nmethods from being zombied while in the queue.
|
||||
+ static void nmethods_do(CodeBlobClosure* cf);
|
||||
+ // GC support to keep nmethod from being unloaded while in the queue.
|
||||
+ static void oops_do(OopClosure* f, CodeBlobClosure* cf);
|
||||
|
||||
// Used to enqueue events without using a lock, for times (such as during
|
||||
// safepoint) when we can't or don't want to lock the Service_lock.
|
||||
diff --git a/hotspot/src/share/vm/runtime/serviceThread.cpp b/hotspot/src/share/vm/runtime/serviceThread.cpp
|
||||
index c3a2b88a5..a2a32ad2b 100644
|
||||
--- a/hotspot/src/share/vm/runtime/serviceThread.cpp
|
||||
+++ b/hotspot/src/share/vm/runtime/serviceThread.cpp
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "services/diagnosticFramework.hpp"
|
||||
|
||||
ServiceThread* ServiceThread::_instance = NULL;
|
||||
+JvmtiDeferredEvent* ServiceThread::_jvmti_event = NULL;
|
||||
|
||||
void ServiceThread::initialize() {
|
||||
EXCEPTION_MARK;
|
||||
@@ -112,12 +113,15 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||
}
|
||||
|
||||
if (has_jvmti_events) {
|
||||
+ // Get the event under the Service_lock
|
||||
jvmti_event = JvmtiDeferredEventQueue::dequeue();
|
||||
+ _jvmti_event = &jvmti_event;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_jvmti_events) {
|
||||
- jvmti_event.post();
|
||||
+ _jvmti_event->post();
|
||||
+ _jvmti_event = NULL; // reset
|
||||
}
|
||||
|
||||
if (sensors_changed) {
|
||||
@@ -138,6 +142,26 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||
}
|
||||
}
|
||||
|
||||
-bool ServiceThread::is_service_thread(Thread* thread) {
|
||||
- return thread == _instance;
|
||||
+void ServiceThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
|
||||
+ JavaThread::oops_do(f, cld_f, cf);
|
||||
+ // The ServiceThread "owns" the JVMTI Deferred events, scan them here
|
||||
+ // to keep them alive until they are processed.
|
||||
+ if (cf != NULL) {
|
||||
+ if (_jvmti_event != NULL) {
|
||||
+ _jvmti_event->oops_do(f, cf);
|
||||
+ }
|
||||
+ MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
+ JvmtiDeferredEventQueue::oops_do(f, cf);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void ServiceThread::nmethods_do(CodeBlobClosure* cf) {
|
||||
+ JavaThread::nmethods_do(cf);
|
||||
+ if (cf != NULL) {
|
||||
+ if (_jvmti_event != NULL) {
|
||||
+ _jvmti_event->nmethods_do(cf);
|
||||
+ }
|
||||
+ MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
+ JvmtiDeferredEventQueue::nmethods_do(cf);
|
||||
+ }
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/runtime/serviceThread.hpp b/hotspot/src/share/vm/runtime/serviceThread.hpp
|
||||
index 42373e6f7..a9c219580 100644
|
||||
--- a/hotspot/src/share/vm/runtime/serviceThread.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/serviceThread.hpp
|
||||
@@ -29,11 +29,13 @@
|
||||
|
||||
// A JavaThread for low memory detection support and JVMTI
|
||||
// compiled-method-load events.
|
||||
+class JvmtiDeferredEvent;
|
||||
+
|
||||
class ServiceThread : public JavaThread {
|
||||
friend class VMStructs;
|
||||
private:
|
||||
-
|
||||
static ServiceThread* _instance;
|
||||
+ static JvmtiDeferredEvent* _jvmti_event;
|
||||
|
||||
static void service_thread_entry(JavaThread* thread, TRAPS);
|
||||
ServiceThread(ThreadFunction entry_point) : JavaThread(entry_point) {};
|
||||
@@ -43,9 +45,11 @@ class ServiceThread : public JavaThread {
|
||||
|
||||
// Hide this thread from external view.
|
||||
bool is_hidden_from_external_view() const { return true; }
|
||||
+ bool is_service_thread() const { return true; }
|
||||
|
||||
- // Returns true if the passed thread is the service thread.
|
||||
- static bool is_service_thread(Thread* thread);
|
||||
+ // GC support
|
||||
+ void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf);
|
||||
+ void nmethods_do(CodeBlobClosure* cf);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_RUNTIME_SERVICETHREAD_HPP
|
||||
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
|
||||
index cc976182d..950c1b4fa 100644
|
||||
--- a/hotspot/src/share/vm/runtime/thread.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/thread.hpp
|
||||
@@ -313,6 +313,7 @@ class Thread: public ThreadShadow {
|
||||
virtual bool is_VM_thread() const { return false; }
|
||||
virtual bool is_Java_thread() const { return false; }
|
||||
virtual bool is_Compiler_thread() const { return false; }
|
||||
+ virtual bool is_service_thread() const { return false; }
|
||||
virtual bool is_hidden_from_external_view() const { return false; }
|
||||
virtual bool is_jvmti_agent_thread() const { return false; }
|
||||
// True iff the thread can perform GC operations at a safepoint.
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@ -116,34 +116,6 @@ index c27a534ef..f75501dba 100644
|
||||
JVM_END
|
||||
|
||||
JVM_ENTRY(void, JVM_Yield(JNIEnv *env, jclass threadClass))
|
||||
diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.hpp b/hotspot/src/share/vm/prims/jvmtiImpl.hpp
|
||||
index d74789451..ec721ca20 100644
|
||||
--- a/hotspot/src/share/vm/prims/jvmtiImpl.hpp
|
||||
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.hpp
|
||||
@@ -493,9 +493,9 @@ class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
|
||||
// Actually posts the event.
|
||||
void post() NOT_JVMTI_RETURN;
|
||||
// Sweeper support to keep nmethods from being zombied while in the queue.
|
||||
- void nmethods_do(CodeBlobClosure* cf);
|
||||
+ void nmethods_do(CodeBlobClosure* cf) NOT_JVMTI_RETURN;
|
||||
// GC support to keep nmethod from being unloaded while in the queue.
|
||||
- void oops_do(OopClosure* f, CodeBlobClosure* cf);
|
||||
+ void oops_do(OopClosure* f, CodeBlobClosure* cf) NOT_JVMTI_RETURN;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -534,9 +534,9 @@ class JvmtiDeferredEventQueue : AllStatic {
|
||||
static void enqueue(const JvmtiDeferredEvent& event) NOT_JVMTI_RETURN;
|
||||
static JvmtiDeferredEvent dequeue() NOT_JVMTI_RETURN_(JvmtiDeferredEvent());
|
||||
// Sweeper support to keep nmethods from being zombied while in the queue.
|
||||
- static void nmethods_do(CodeBlobClosure* cf);
|
||||
+ static void nmethods_do(CodeBlobClosure* cf) NOT_JVMTI_RETURN;
|
||||
// GC support to keep nmethod from being unloaded while in the queue.
|
||||
- static void oops_do(OopClosure* f, CodeBlobClosure* cf);
|
||||
+ static void oops_do(OopClosure* f, CodeBlobClosure* cf) NOT_JVMTI_RETURN;
|
||||
|
||||
// Used to enqueue events without using a lock, for times (such as during
|
||||
// safepoint) when we can't or don't want to lock the Service_lock.
|
||||
diff --git a/hotspot/src/share/vm/runtime/memprofiler.cpp b/hotspot/src/share/vm/runtime/memprofiler.cpp
|
||||
index ddb22601f..a956c5252 100644
|
||||
--- a/hotspot/src/share/vm/runtime/memprofiler.cpp
|
||||
|
||||
@ -17,7 +17,7 @@ index f20bf3d2b..3ab82c5c4 100644
|
||||
|
||||
+ if (DumpSharedSpaces) {
|
||||
+ tty->print_cr("failed: must not create anonymous classes when dumping.");
|
||||
+ JVM_Exit(0);
|
||||
+ JVM_Halt(0);
|
||||
+ }
|
||||
+
|
||||
if (UsePerfData) {
|
||||
|
||||
@ -224,7 +224,7 @@ index 17447587..d2095e63 100644
|
||||
+ tty->print_cr("The lock path is: %s", _appcds_file_lock_path);
|
||||
+ tty->print_cr("Failed to create jsa file !\n Please check: \n 1. The directory exists.\n "
|
||||
+ "2. You have the permission.\n 3. Make sure no other process using the same lock file.\n");
|
||||
+ JVM_Exit(0);
|
||||
+ JVM_Halt(0);
|
||||
+ }
|
||||
+ tty->print_cr("You are using file lock %s in concurrent mode", AppCDSLockFile);
|
||||
+ }
|
||||
|
||||
@ -125,7 +125,7 @@ index 00000000..9b614024
|
||||
--- /dev/null
|
||||
+++ b/version.txt
|
||||
@@ -0,0 +1 @@
|
||||
+8.342.7.0.13
|
||||
+8.352.8.0.13
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
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
|
||||
|
||||
@ -33,7 +33,7 @@ index 5858c9355..99b1f58d0 100644
|
||||
- tty->print_cr("The lock path is: %s", _appcds_file_lock_path);
|
||||
tty->print_cr("Failed to create jsa file !\n Please check: \n 1. The directory exists.\n "
|
||||
"2. You have the permission.\n 3. Make sure no other process using the same lock file.\n");
|
||||
- JVM_Exit(0);
|
||||
- JVM_Halt(0);
|
||||
+ fail_stop("Failed to create appcds lock file, the lock path is: %s.", _appcds_file_lock_path);
|
||||
}
|
||||
tty->print_cr("You are using file lock %s in concurrent mode", AppCDSLockFile);
|
||||
|
||||
@ -38,7 +38,7 @@ index 9cfa0451..170f1fd9 100644
|
||||
if (match_option(option, "-XX:+UseAppCDS", &tail)) {
|
||||
+#ifndef __linux__
|
||||
+ tty->print_cr("failed: must not use AppCDS on non-linux system.");
|
||||
+ JVM_Exit(0);
|
||||
+ JVM_Halt(0);
|
||||
+#endif
|
||||
if (!process_argument("+UseAppCDS", args->ignoreUnrecognized, origin)) {
|
||||
return JNI_EINVAL;
|
||||
|
||||
@ -1,134 +0,0 @@
|
||||
diff --git a/jdk/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java b/jdk/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
|
||||
index 944958de4..5c7602925 100644
|
||||
--- a/jdk/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
|
||||
+++ b/jdk/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
|
||||
@@ -77,34 +77,26 @@ public abstract class AbstractAlgorithmConstraints
|
||||
return new ArrayList<>(Arrays.asList(algorithmsInProperty));
|
||||
}
|
||||
|
||||
- static boolean checkAlgorithm(List<String> algorithms, String algorithm,
|
||||
+ static boolean checkAlgorithm(Set<String> algorithms, String algorithm,
|
||||
AlgorithmDecomposer decomposer) {
|
||||
if (algorithm == null || algorithm.length() == 0) {
|
||||
throw new IllegalArgumentException("No algorithm name specified");
|
||||
}
|
||||
|
||||
Set<String> elements = null;
|
||||
- for (String item : algorithms) {
|
||||
- if (item == null || item.isEmpty()) {
|
||||
- continue;
|
||||
- }
|
||||
+ if (algorithms.contains(algorithm.toLowerCase())) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
- // check the full name
|
||||
- if (item.equalsIgnoreCase(algorithm)) {
|
||||
+ // decompose the algorithm into sub-elements
|
||||
+ if (elements == null) {
|
||||
+ elements = decomposer.decompose(algorithm);
|
||||
+ }
|
||||
+ // check the element of the elements
|
||||
+ for (String element : elements) {
|
||||
+ if (algorithms.contains(element.toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
-
|
||||
- // decompose the algorithm into sub-elements
|
||||
- if (elements == null) {
|
||||
- elements = decomposer.decompose(algorithm);
|
||||
- }
|
||||
-
|
||||
- // check the items of the algorithm
|
||||
- for (String element : elements) {
|
||||
- if (item.equalsIgnoreCase(element)) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java b/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
|
||||
index 51e625632..6ff26bf2f 100644
|
||||
--- a/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
|
||||
+++ b/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
|
||||
@@ -96,7 +96,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
||||
new DisabledAlgorithmConstraints(PROPERTY_JAR_DISABLED_ALGS);
|
||||
}
|
||||
|
||||
- private final List<String> disabledAlgorithms;
|
||||
+ private final Set<String> disabledAlgorithms;
|
||||
private final Constraints algorithmConstraints;
|
||||
|
||||
public static DisabledAlgorithmConstraints certPathConstraints() {
|
||||
@@ -128,11 +128,11 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
||||
public DisabledAlgorithmConstraints(String propertyName,
|
||||
AlgorithmDecomposer decomposer) {
|
||||
super(decomposer);
|
||||
- disabledAlgorithms = getAlgorithms(propertyName);
|
||||
+ List<String> disabledAlgorithmsList = getAlgorithms(propertyName);
|
||||
|
||||
// Check for alias
|
||||
int ecindex = -1, i = 0;
|
||||
- for (String s : disabledAlgorithms) {
|
||||
+ for (String s : disabledAlgorithmsList) {
|
||||
if (s.regionMatches(true, 0,"include ", 0, 8)) {
|
||||
if (s.regionMatches(true, 8, PROPERTY_DISABLED_EC_CURVES, 0,
|
||||
PROPERTY_DISABLED_EC_CURVES.length())) {
|
||||
@@ -143,11 +143,19 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
||||
i++;
|
||||
}
|
||||
if (ecindex > -1) {
|
||||
- disabledAlgorithms.remove(ecindex);
|
||||
- disabledAlgorithms.addAll(ecindex,
|
||||
+ disabledAlgorithmsList.remove(ecindex);
|
||||
+ disabledAlgorithmsList.addAll(ecindex,
|
||||
getAlgorithms(PROPERTY_DISABLED_EC_CURVES));
|
||||
}
|
||||
- algorithmConstraints = new Constraints(propertyName, disabledAlgorithms);
|
||||
+ algorithmConstraints = new Constraints(propertyName, disabledAlgorithmsList);
|
||||
+
|
||||
+ disabledAlgorithms = new HashSet<String>();
|
||||
+ for (String algorithm : disabledAlgorithmsList) {
|
||||
+ if (algorithm == null || algorithm.isEmpty()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ disabledAlgorithms.add(algorithm.toLowerCase());
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/jdk/src/share/classes/sun/security/util/LegacyAlgorithmConstraints.java b/jdk/src/share/classes/sun/security/util/LegacyAlgorithmConstraints.java
|
||||
index 4e7502fb5..01d0447ab 100644
|
||||
--- a/jdk/src/share/classes/sun/security/util/LegacyAlgorithmConstraints.java
|
||||
+++ b/jdk/src/share/classes/sun/security/util/LegacyAlgorithmConstraints.java
|
||||
@@ -28,6 +28,7 @@ package sun.security.util;
|
||||
import java.security.AlgorithmParameters;
|
||||
import java.security.CryptoPrimitive;
|
||||
import java.security.Key;
|
||||
+import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -40,12 +41,19 @@ public class LegacyAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
||||
public final static String PROPERTY_TLS_LEGACY_ALGS =
|
||||
"jdk.tls.legacyAlgorithms";
|
||||
|
||||
- private final List<String> legacyAlgorithms;
|
||||
+ private final Set<String> legacyAlgorithms;
|
||||
|
||||
public LegacyAlgorithmConstraints(String propertyName,
|
||||
AlgorithmDecomposer decomposer) {
|
||||
super(decomposer);
|
||||
- legacyAlgorithms = getAlgorithms(propertyName);
|
||||
+ List<String> legacyAlgorithmsList = getAlgorithms(propertyName);
|
||||
+ legacyAlgorithms = new HashSet<String>();
|
||||
+ for (String algorithm : legacyAlgorithmsList) {
|
||||
+ if (algorithm == null || algorithm.isEmpty()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ legacyAlgorithms.add(algorithm.toLowerCase());
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
Binary file not shown.
@ -146,13 +146,13 @@
|
||||
%global origin_nice OpenJDK
|
||||
%global top_level_dir_name %{origin}
|
||||
%global repo jdk8u
|
||||
%global revision jdk8u342-b07
|
||||
%global revision jdk8u352-b08
|
||||
%global full_revision %{repo}-%{revision}
|
||||
# Define IcedTea version used for SystemTap tapsets and desktop files
|
||||
%global icedteaver 3.15.0
|
||||
|
||||
%global updatever 342
|
||||
%global buildver b07
|
||||
%global updatever 352
|
||||
%global buildver b08
|
||||
# priority must be 7 digits in total. The expression is workarounding tip
|
||||
%global priority 1800%{updatever}
|
||||
|
||||
@ -916,7 +916,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
|
||||
|
||||
Name: java-%{javaver}-%{origin}
|
||||
Version: %{javaver}.%{updatever}.%{buildver}
|
||||
Release: 15
|
||||
Release: 3
|
||||
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
|
||||
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
|
||||
# also included the epoch in their virtual provides. This created a
|
||||
@ -1079,7 +1079,6 @@ Patch185: update-cacerts-and-VerifyCACerts.java-test.patch
|
||||
Patch186: update-to-keep-same-with-master.patch
|
||||
Patch188: 8247691_incorrect_handling_of_VM_exceptions_in_C1_deopt_stub.patch
|
||||
Patch192: add_kae_implementation_add_default_conf_file.patch
|
||||
Patch193: improve_algorithmConstraints_checkAlgorithm_performance.patch
|
||||
Patch194: modify_the_default_iteration_time_and_forks_in_the_JMH_of_KAEProvider.patch
|
||||
Patch195: support_CMS_parallel_inspection.patch
|
||||
Patch196: g1gc-numa-aware-Implementation.patch
|
||||
@ -1116,7 +1115,6 @@ Patch229: downgrade-the-symver-of-fcntl64.patch
|
||||
|
||||
# 8u322
|
||||
Patch230: add-system-property-swing.JComboBox.useLegacyMode.patch
|
||||
Patch232: 8173361-various-crashes-in-JvmtiExport-post_compiled.patch
|
||||
Patch233: fix-TestUseCompressedOopsErgo-run-failed.patch
|
||||
Patch235: fix-testme-Test6929067-run-faild.patch
|
||||
Patch236: penetration_testing_vulnerability_fix.patch
|
||||
@ -1131,7 +1129,6 @@ 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
|
||||
Patch246: 7092821-java.security.Provider.getService-is-synchro.patch
|
||||
Patch247: 8173339-AArch64-Fix-minimum-stack-size-computations.patch
|
||||
Patch248: 8067941-TESTBUG-Fix-tests-for-OS-with-64K-page-size.patch
|
||||
|
||||
# 8u342
|
||||
@ -1152,6 +1149,10 @@ Patch262: add-configuration-option-of-huawei-internal-version-shown-in-release-f
|
||||
Patch263: The-code-style-is-fixed-and-test-cases-are-added.patch
|
||||
Patch264: 8287109-Distrust-failed-with-CertificateExpired.patch
|
||||
|
||||
# 8u352
|
||||
Patch265: cve-2022-37434-Fix-a-bug-when-getting-a-gzip-header-extra-field-with-inflate.patch
|
||||
Patch266: 8065895-Synchronous-signals-during-error-reporting-may-terminate-or-hang-vm-process.patch
|
||||
|
||||
#############################################
|
||||
#
|
||||
# Upstreamable patches
|
||||
@ -1612,7 +1613,6 @@ pushd %{top_level_dir_name}
|
||||
%patch228 -p1
|
||||
%patch229 -p1
|
||||
%patch230 -p1
|
||||
%patch232 -p1
|
||||
%patch233 -p1
|
||||
%patch235 -p1
|
||||
%patch236 -p1
|
||||
@ -1625,7 +1625,6 @@ pushd %{top_level_dir_name}
|
||||
%patch244 -p1
|
||||
%patch245 -p1
|
||||
%patch246 -p1
|
||||
%patch247 -p1
|
||||
%patch248 -p1
|
||||
%patch249 -p1
|
||||
%patch250 -p1
|
||||
@ -1643,6 +1642,8 @@ pushd %{top_level_dir_name}
|
||||
%patch262 -p1
|
||||
%patch263 -p1
|
||||
%patch264 -p1
|
||||
%patch265 -p1
|
||||
%patch266 -p1
|
||||
popd
|
||||
|
||||
# System library fixes
|
||||
@ -2267,6 +2268,30 @@ cjc.mainProgram(arg)
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Oct 24 2022 kuenking111<wangkun49@huawei.com> - 1:1.8.0.352-b08.3
|
||||
- add 8065895-Synchronous-signals-during-error-reporting-may-terminate-or-hang-vm-process.patch
|
||||
|
||||
* Mon Oct 24 2022 kuenking111<wangkun49@huawei.com> - 1:1.8.0.352-b08.2
|
||||
- add cve-2022-37434-Fix-a-bug-when-getting-a-gzip-header-extra-field-with-inflate.patch
|
||||
|
||||
* Mon Oct 24 2022 kuenking111<wangkun49@huawei.com> - 1:1.8.0.352-b08.1
|
||||
- remove gitattributes gitignore jcheck files
|
||||
|
||||
* Wed Oct 19 2022 kuenking111<wangkun49@huawei.com> - 1:1.8.0.352-b08.0
|
||||
- modified add-missing-test-case.patch
|
||||
- upgrade to jdk8u352-b08
|
||||
|
||||
* Thu Sep 29 2022 DXwangg<wangjiawei80@huawei.com> - 1:1.8.0.352-b07.0
|
||||
- upgrade to jdk8u352-b07
|
||||
- deleted Improve_AlgorithmConstraints_checkAlgorithm_performance.patch
|
||||
- deleted 8173361-various-crashes-in-JvmtiExport-post_compiled.patch
|
||||
- modified Fix-compile-and-runtime-failures-for-minimal1-versio.patch
|
||||
- deleted 8173339-AArch64-Fix-minimum-stack-size-computations.patch
|
||||
- modified add-appcds-file-lock.patch
|
||||
- modified add-DumpSharedSpace-guarantee-when-create-anonymous-classes.patch
|
||||
- modified fix-appcds-s-option-AppCDSLockFile.patch
|
||||
- modified fix-windows-compile-fail.patch
|
||||
|
||||
* Sat Sep 24 2022 kuenking111<wangkun49@huawei.com> - 1:1.8.0.342-b07.15
|
||||
- add 8287109-Distrust-failed-with-CertificateExpired.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user