From 45f1527adddee99d5967703dd615527b44fa0fce Mon Sep 17 00:00:00 2001 From: kuenking111 Date: Wed, 16 Feb 2022 15:18:47 +0800 Subject: [PATCH] I4TXR9: Fix code consistency after upgrade 8u322 --- ...xception_available_in_product_builds.patch | 179 ++++++++++ ...crashes-in-JvmtiExport-post_compiled.patch | 290 +++++++++++++++ ...the-register-storage-class-specifier.patch | 333 ++++++++++++++++++ ...variable-ZIP_INVALID_LOC_HEADER_EXIT.patch | 63 ++++ ...operty-swing.JComboBox.useLegacyMode.patch | 84 +++++ ...uld-not-contain-the-path-after-unzip.patch | 16 + ...TestUseCompressedOopsErgo-run-failed.patch | 16 + fix-testme-Test6929067-run-faild.patch | 51 +++ ..._Blas_hotspot_function_in_Intrinsics.patch | 111 +++--- openjdk-1.8.0.spec | 35 +- penetration_testing_vulnerability_fix.patch | 124 +++++++ ...e-path-when-a-zip-invalid-loc-header.patch | 49 +++ 12 files changed, 1293 insertions(+), 58 deletions(-) create mode 100755 8136577_Make_AbortVMOnException_available_in_product_builds.patch create mode 100755 8173361-various-crashes-in-JvmtiExport-post_compiled.patch create mode 100755 8207011-Remove-uses-of-the-register-storage-class-specifier.patch create mode 100755 add-environment-variable-ZIP_INVALID_LOC_HEADER_EXIT.patch create mode 100755 add-system-property-swing.JComboBox.useLegacyMode.patch create mode 100755 debuginfo.diz-should-not-contain-the-path-after-unzip.patch create mode 100755 fix-TestUseCompressedOopsErgo-run-failed.patch create mode 100755 fix-testme-Test6929067-run-faild.patch create mode 100755 penetration_testing_vulnerability_fix.patch create mode 100755 print-fd-and-file-path-when-a-zip-invalid-loc-header.patch diff --git a/8136577_Make_AbortVMOnException_available_in_product_builds.patch b/8136577_Make_AbortVMOnException_available_in_product_builds.patch new file mode 100755 index 0000000..1aa04c7 --- /dev/null +++ b/8136577_Make_AbortVMOnException_available_in_product_builds.patch @@ -0,0 +1,179 @@ +diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp +index 3c1ea7280..b8d866786 100644 +--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp ++++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp +@@ -542,7 +542,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t + exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); + } + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(exception)); ++ Exceptions::debug_check_abort(exception); + + // Clear out the exception oop and pc since looking up an + // exception handler can cause class loading, which might throw an +diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +index 3a5f31ae7..dd680a258 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp ++++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +@@ -2861,7 +2861,7 @@ run: + (int)continuation_bci, p2i(THREAD)); + } + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); ++ Exceptions::debug_check_abort(except_oop); + + // Update profiling data. + BI_PROFILE_ALIGN_TO_CURRENT_BCI(); +@@ -2877,7 +2877,8 @@ run: + p2i(THREAD)); + } + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); ++ Exceptions::debug_check_abort(except_oop); ++ + // No handler in this activation, unwind and try again + THREAD->set_pending_exception(except_oop(), NULL, 0); + goto handle_return; +diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +index 5d2845383..b9eeffeee 100644 +--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp ++++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +@@ -472,7 +472,7 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea + // // warning("performance bug: should not call runtime if method has no exception handlers"); + // } + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(h_exception)); ++ Exceptions::debug_check_abort(h_exception); + + // exception handler lookup + KlassHandle h_klass(THREAD, h_exception->klass()); +diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp +index 6cfb99175..0a86211ba 100644 +--- a/hotspot/src/share/vm/opto/runtime.cpp ++++ b/hotspot/src/share/vm/opto/runtime.cpp +@@ -1321,7 +1321,7 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* t + } + + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(exception)); ++ Exceptions::debug_check_abort(exception); + + #ifdef ASSERT + if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { +diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp +index 85e91f95b..65dfcf69b 100644 +--- a/hotspot/src/share/vm/runtime/globals.hpp ++++ b/hotspot/src/share/vm/runtime/globals.hpp +@@ -2739,11 +2739,11 @@ class CommandLineFlags { + "standard exit from VM if bytecode verify error " \ + "(only in debug mode)") \ + \ +- notproduct(ccstr, AbortVMOnException, NULL, \ ++ diagnostic(ccstr, AbortVMOnException, NULL, \ + "Call fatal if this exception is thrown. Example: " \ + "java -XX:AbortVMOnException=java.lang.NullPointerException Foo") \ + \ +- notproduct(ccstr, AbortVMOnExceptionMessage, NULL, \ ++ diagnostic(ccstr, AbortVMOnExceptionMessage, NULL, \ + "Call fatal if the exception pointed by AbortVMOnException " \ + "has this message") \ + \ +diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp +index 5f540247f..5eabd3df0 100644 +--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp ++++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp +@@ -895,7 +895,8 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, + assert(exception_kind == IMPLICIT_NULL || exception_kind == IMPLICIT_DIVIDE_BY_ZERO, "wrong implicit exception kind"); + + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort("java.lang.NullPointerException")); ++ Exceptions::debug_check_abort("java.lang.NullPointerException"); ++ + if (exception_kind == IMPLICIT_NULL) { + Events::log_exception(thread, "Implicit null exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, pc, target_pc); + } else { +diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp +index 4cb783e2d..94b9e69d2 100644 +--- a/hotspot/src/share/vm/runtime/thread.cpp ++++ b/hotspot/src/share/vm/runtime/thread.cpp +@@ -2218,7 +2218,7 @@ void JavaThread::send_thread_stop(oop java_throwable) { + tty->print_cr("Pending Async. exception installed of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name()); + } + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(InstanceKlass::cast(_pending_async_exception->klass())->external_name())); ++ Exceptions::debug_check_abort(InstanceKlass::cast(_pending_async_exception->klass())->external_name()); + } + } + +diff --git a/hotspot/src/share/vm/utilities/exceptions.cpp b/hotspot/src/share/vm/utilities/exceptions.cpp +index db4a17029..8b25cf8c4 100644 +--- a/hotspot/src/share/vm/utilities/exceptions.cpp ++++ b/hotspot/src/share/vm/utilities/exceptions.cpp +@@ -148,7 +148,7 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc + (address)h_exception(), file, line, thread); + } + // for AbortVMOnException flag +- NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message)); ++ Exceptions::debug_check_abort(h_exception, message); + + // Check for special boot-strapping/vm-thread handling + if (special_exception(thread, file, line, h_exception)) { +@@ -477,13 +477,12 @@ ExceptionMark::~ExceptionMark() { + + // ---------------------------------------------------------------------------------------- + +-#ifndef PRODUCT + // caller frees value_string if necessary + void Exceptions::debug_check_abort(const char *value_string, const char* message) { + if (AbortVMOnException != NULL && value_string != NULL && +- strstr(value_string, AbortVMOnException)) { +- if (AbortVMOnExceptionMessage == NULL || message == NULL || +- strcmp(message, AbortVMOnExceptionMessage) == 0) { ++ strstr(AbortVMOnException, value_string)) { ++ if (AbortVMOnExceptionMessage == NULL || (message != NULL && ++ strstr(message, AbortVMOnExceptionMessage))) { + fatal(err_msg("Saw %s, aborting", value_string)); + } + } +@@ -491,14 +490,17 @@ void Exceptions::debug_check_abort(const char *value_string, const char* message + + void Exceptions::debug_check_abort(Handle exception, const char* message) { + if (AbortVMOnException != NULL) { +- ResourceMark rm; +- if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) { +- oop msg = java_lang_Throwable::message(exception); +- if (msg != NULL) { +- message = java_lang_String::as_utf8_string(msg); +- } ++ debug_check_abort_helper(exception, message); ++ } ++} ++ ++void Exceptions::debug_check_abort_helper(Handle exception, const char* message) { ++ ResourceMark rm; ++ if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) { ++ oop msg = java_lang_Throwable::message(exception); ++ if (msg != NULL) { ++ message = java_lang_String::as_utf8_string(msg); + } +- debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message); + } ++ debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message); + } +-#endif +diff --git a/hotspot/src/share/vm/utilities/exceptions.hpp b/hotspot/src/share/vm/utilities/exceptions.hpp +index 7e10f735e..9da8f4d4b 100644 +--- a/hotspot/src/share/vm/utilities/exceptions.hpp ++++ b/hotspot/src/share/vm/utilities/exceptions.hpp +@@ -174,8 +174,9 @@ class Exceptions { + static void print_exception_counts_on_error(outputStream* st); + + // for AbortVMOnException flag +- NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);) +- NOT_PRODUCT(static void debug_check_abort(const char *value_string, const char* message = NULL);) ++ static void debug_check_abort(Handle exception, const char* message = NULL); ++ static void debug_check_abort_helper(Handle exception, const char* message = NULL); ++ static void debug_check_abort(const char *value_string, const char* message = NULL); + }; + + diff --git a/8173361-various-crashes-in-JvmtiExport-post_compiled.patch b/8173361-various-crashes-in-JvmtiExport-post_compiled.patch new file mode 100755 index 0000000..2b14cc7 --- /dev/null +++ b/8173361-various-crashes-in-JvmtiExport-post_compiled.patch @@ -0,0 +1,290 @@ +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 + diff --git a/8207011-Remove-uses-of-the-register-storage-class-specifier.patch b/8207011-Remove-uses-of-the-register-storage-class-specifier.patch new file mode 100755 index 0000000..1c52c32 --- /dev/null +++ b/8207011-Remove-uses-of-the-register-storage-class-specifier.patch @@ -0,0 +1,333 @@ +diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +index f0de6456b..a9562f74a 100644 +--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp ++++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +@@ -280,11 +280,11 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + + address os::current_stack_pointer() { + #if defined(__clang__) || defined(__llvm__) +- register void *esp; ++ void *esp; + __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp)); + return (address) esp; + #elif defined(SPARC_WORKS) +- register void *esp; ++ void *esp; + __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp)); + return (address) ((char*)esp + sizeof(long)*2); + #else +@@ -367,7 +367,7 @@ frame os::get_sender_for_C_frame(frame* fr) { + + intptr_t* _get_previous_fp() { + #if defined(SPARC_WORKS) || defined(__clang__) || defined(__llvm__) +- register intptr_t **ebp; ++ intptr_t **ebp; + __asm__("mov %%" SPELL_REG_FP ", %0":"=r"(ebp)); + #else + register intptr_t **ebp __asm__ (SPELL_REG_FP); +diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +index 65c3165ca..4775dc875 100644 +--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp ++++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +@@ -92,11 +92,11 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + + address os::current_stack_pointer() { + #ifdef SPARC_WORKS +- register void *esp; ++ void *esp; + __asm__("mov %%"SPELL_REG_SP", %0":"=r"(esp)); + return (address) ((char*)esp + sizeof(long)*2); + #elif defined(__clang__) +- intptr_t* esp; ++ void* esp; + __asm__ __volatile__ ("mov %%"SPELL_REG_SP", %0":"=r"(esp):); + return (address) esp; + #else +@@ -179,7 +179,7 @@ frame os::get_sender_for_C_frame(frame* fr) { + + intptr_t* _get_previous_fp() { + #ifdef SPARC_WORKS +- register intptr_t **ebp; ++ intptr_t **ebp; + __asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp)); + #elif defined(__clang__) + intptr_t **ebp; +diff --git a/hotspot/src/share/vm/adlc/adlparse.cpp b/hotspot/src/share/vm/adlc/adlparse.cpp +index 31955ff7d..de66eb414 100644 +--- a/hotspot/src/share/vm/adlc/adlparse.cpp ++++ b/hotspot/src/share/vm/adlc/adlparse.cpp +@@ -4564,7 +4564,7 @@ char *ADLParser::get_paren_expr(const char *description, bool include_location) + // string(still inside the file buffer). Returns a pointer to the string or + // NULL if some other token is found instead. + char *ADLParser::get_ident_common(bool do_preproc) { +- register char c; ++ char c; + char *start; // Pointer to start of token + char *end; // Pointer to end of token + +@@ -4762,7 +4762,7 @@ char *ADLParser::get_unique_ident(FormDict& dict, const char* nameDescription){ + // invokes a parse_err if the next token is not an integer. + // This routine does not leave the integer null-terminated. + int ADLParser::get_int(void) { +- register char c; ++ char c; + char *start; // Pointer to start of token + char *end; // Pointer to end of token + int result; // Storage for integer result +diff --git a/hotspot/src/share/vm/adlc/arena.cpp b/hotspot/src/share/vm/adlc/arena.cpp +index d7e4fc6eb..8ec3584d1 100644 +--- a/hotspot/src/share/vm/adlc/arena.cpp ++++ b/hotspot/src/share/vm/adlc/arena.cpp +@@ -79,7 +79,7 @@ Arena::Arena( Arena *a ) + // Total of all Chunks in arena + size_t Arena::used() const { + size_t sum = _chunk->_len - (_max-_hwm); // Size leftover in this Chunk +- register Chunk *k = _first; ++ Chunk *k = _first; + while( k != _chunk) { // Whilst have Chunks in a row + sum += k->_len; // Total size of this Chunk + k = k->_next; // Bump along to next Chunk +@@ -93,7 +93,7 @@ void* Arena::grow( size_t x ) { + // Get minimal required size. Either real big, or even bigger for giant objs + size_t len = max(x, Chunk::size); + +- register Chunk *k = _chunk; // Get filled-up chunk address ++ Chunk *k = _chunk; // Get filled-up chunk address + _chunk = new (len) Chunk(len); + + if( k ) k->_next = _chunk; // Append new chunk to end of linked list +diff --git a/hotspot/src/share/vm/adlc/dict2.cpp b/hotspot/src/share/vm/adlc/dict2.cpp +index f341a2b67..2dc60b250 100644 +--- a/hotspot/src/share/vm/adlc/dict2.cpp ++++ b/hotspot/src/share/vm/adlc/dict2.cpp +@@ -283,9 +283,9 @@ void Dict::print(PrintKeyOrValue print_key, PrintKeyOrValue print_value) { + // limited to MAXID characters in length. Experimental evidence on 150K of + // C text shows excellent spreading of values for any size hash table. + int hashstr(const void *t) { +- register char c, k = 0; +- register int sum = 0; +- register const char *s = (const char *)t; ++ char c, k = 0; ++ int sum = 0; ++ const char *s = (const char *)t; + + while (((c = s[k]) != '\0') && (k < MAXID-1)) { // Get characters till nul + c = (char) ((c << 1) + 1); // Characters are always odd! +diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp +index 52044f12d..bcb385563 100644 +--- a/hotspot/src/share/vm/adlc/main.cpp ++++ b/hotspot/src/share/vm/adlc/main.cpp +@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) + + // Read command line arguments and file names + for( int i = 1; i < argc; i++ ) { // For all arguments +- register char *s = argv[i]; // Get option/filename ++ char *s = argv[i]; // Get option/filename + + if( *s++ == '-' ) { // It's a flag? (not a filename) + if( !*s ) { // Stand-alone `-' means stdin +diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +index dd680a258..8ffe8f243 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp ++++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +@@ -508,13 +508,13 @@ BytecodeInterpreter::run(interpreterState istate) { + interpreterState orig = istate; + #endif + +- register intptr_t* topOfStack = (intptr_t *)istate->stack(); /* access with STACK macros */ +- register address pc = istate->bcp(); +- register jubyte opcode; +- register intptr_t* locals = istate->locals(); +- register ConstantPoolCache* cp = istate->constants(); // method()->constants()->cache() ++ intptr_t* topOfStack = (intptr_t *)istate->stack(); /* access with STACK macros */ ++ address pc = istate->bcp(); ++ jubyte opcode; ++ intptr_t* locals = istate->locals(); ++ ConstantPoolCache* cp = istate->constants(); // method()->constants()->cache() + #ifdef LOTS_OF_REGS +- register JavaThread* THREAD = istate->thread(); ++ JavaThread* THREAD = istate->thread(); + #else + #undef THREAD + #define THREAD istate->thread() +@@ -603,7 +603,7 @@ BytecodeInterpreter::run(interpreterState istate) { + /* 0xF8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, + /* 0xFC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default + }; +- register uintptr_t *dispatch_table = (uintptr_t*)&opclabels_data[0]; ++ uintptr_t *dispatch_table = (uintptr_t*)&opclabels_data[0]; + #endif /* USELABELS */ + + #ifdef ASSERT +diff --git a/hotspot/src/share/vm/libadt/dict.cpp b/hotspot/src/share/vm/libadt/dict.cpp +index 37559a097..8bef7d6ac 100644 +--- a/hotspot/src/share/vm/libadt/dict.cpp ++++ b/hotspot/src/share/vm/libadt/dict.cpp +@@ -319,9 +319,9 @@ void Dict::print() { + // limited to MAXID characters in length. Experimental evidence on 150K of + // C text shows excellent spreading of values for any size hash table. + int hashstr(const void *t) { +- register char c, k = 0; +- register int32 sum = 0; +- register const char *s = (const char *)t; ++ char c, k = 0; ++ int32 sum = 0; ++ const char *s = (const char *)t; + + while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1 + c = (c<<1)+1; // Characters are always odd! +diff --git a/hotspot/src/share/vm/libadt/set.cpp b/hotspot/src/share/vm/libadt/set.cpp +index 9fab2b64b..8b511d2e7 100644 +--- a/hotspot/src/share/vm/libadt/set.cpp ++++ b/hotspot/src/share/vm/libadt/set.cpp +@@ -73,7 +73,7 @@ char *Set::setstr() const + uint len = 128; // Total string space + char *buf = NEW_C_HEAP_ARRAY(char,len, mtCompiler);// Some initial string space + +- register char *s = buf; // Current working string pointer ++ char *s = buf; // Current working string pointer + *s++ = '{'; + *s = '\0'; + +@@ -125,8 +125,8 @@ void Set::print() const + // Set. Return the amount of text parsed in "len", or zero in "len". + int Set::parse(const char *s) + { +- register char c; // Parse character +- register const char *t = s; // Save the starting position of s. ++ char c; // Parse character ++ const char *t = s; // Save the starting position of s. + do c = *s++; // Skip characters + while( c && (c <= ' ') ); // Till no more whitespace or EOS + if( c != '{' ) return 0; // Oops, not a Set openner +diff --git a/hotspot/src/share/vm/libadt/vectset.cpp b/hotspot/src/share/vm/libadt/vectset.cpp +index ab80afef6..d4c403858 100644 +--- a/hotspot/src/share/vm/libadt/vectset.cpp ++++ b/hotspot/src/share/vm/libadt/vectset.cpp +@@ -105,8 +105,8 @@ void VectorSet::grow( uint newsize ) + // Insert a member into an existing Set. + Set &VectorSet::operator <<= (uint elem) + { +- register uint word = elem >> 5; // Get the longword offset +- register uint32 mask = 1L << (elem & 31); // Get bit mask ++ uint word = elem >> 5; // Get the longword offset ++ uint32 mask = 1L << (elem & 31); // Get bit mask + + if( word >= size ) // Need to grow set? + grow(elem+1); // Then grow it +@@ -118,10 +118,10 @@ Set &VectorSet::operator <<= (uint elem) + // Delete a member from an existing Set. + Set &VectorSet::operator >>= (uint elem) + { +- register uint word = elem >> 5; // Get the longword offset ++ uint word = elem >> 5; // Get the longword offset + if( word >= size ) // Beyond the last? + return *this; // Then it's clear & return clear +- register uint32 mask = 1L << (elem & 31); // Get bit mask ++ uint32 mask = 1L << (elem & 31); // Get bit mask + data[word] &= ~mask; // Clear bit + return *this; + } +@@ -132,8 +132,8 @@ VectorSet &VectorSet::operator &= (const VectorSet &s) + { + // NOTE: The intersection is never any larger than the smallest set. + if( s.size < size ) size = s.size; // Get smaller size +- register uint32 *u1 = data; // Pointer to the destination data +- register uint32 *u2 = s.data; // Pointer to the source data ++ uint32 *u1 = data; // Pointer to the destination data ++ uint32 *u2 = s.data; // Pointer to the source data + for( uint i=0; i> 5; // Get the longword offset ++ uint word = elem >> 5; // Get the longword offset + if( word >= size ) // Beyond the last? + return 0; // Then it's clear +- register uint32 mask = 1L << (elem & 31); // Get bit mask ++ uint32 mask = 1L << (elem & 31); // Get bit mask + return ((data[word] & mask))!=0; // Return the sense of the bit + } + +diff --git a/hotspot/src/share/vm/opto/mulnode.cpp b/hotspot/src/share/vm/opto/mulnode.cpp +index 9f2a134f1..5796af3a0 100644 +--- a/hotspot/src/share/vm/opto/mulnode.cpp ++++ b/hotspot/src/share/vm/opto/mulnode.cpp +@@ -46,7 +46,7 @@ uint MulNode::hash() const { + //------------------------------Identity--------------------------------------- + // Multiplying a one preserves the other argument + Node *MulNode::Identity( PhaseTransform *phase ) { +- register const Type *one = mul_id(); // The multiplicative identity ++ const Type *one = mul_id(); // The multiplicative identity + if( phase->type( in(1) )->higher_equal( one ) ) return in(2); + if( phase->type( in(2) )->higher_equal( one ) ) return in(1); + +-- +2.12.3 + diff --git a/add-environment-variable-ZIP_INVALID_LOC_HEADER_EXIT.patch b/add-environment-variable-ZIP_INVALID_LOC_HEADER_EXIT.patch new file mode 100755 index 0000000..06dad7c --- /dev/null +++ b/add-environment-variable-ZIP_INVALID_LOC_HEADER_EXIT.patch @@ -0,0 +1,63 @@ +diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c +index 5fd6fea04..3dbd2ba62 100644 +--- a/jdk/src/share/native/java/util/zip/zip_util.c ++++ b/jdk/src/share/native/java/util/zip/zip_util.c +@@ -78,6 +78,22 @@ static void freeCEN(jzfile *); + + static jint INITIAL_META_COUNT = 2; /* initial number of entries in meta name array */ + ++#ifdef LINUX ++#define ZIP_INVALID_LOC_HEADER_EXIT "ZIP_INVALID_LOC_HEADER_EXIT" ++ ++char *getExitFlag() { ++ static char *process_exit_flag = NULL; ++ static jboolean is_initialized = JNI_FALSE; ++ if (is_initialized) { ++ return process_exit_flag; ++ } ++ process_exit_flag = getenv(ZIP_INVALID_LOC_HEADER_EXIT); ++ is_initialized = JNI_TRUE; ++ return process_exit_flag; ++} ++ ++#endif ++ + /* + * The ZFILE_* functions exist to provide some platform-independence with + * respect to file access needs. +@@ -1322,6 +1338,32 @@ ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry) + } + if (GETSIG(loc) != LOCSIG) { + zip->msg = "invalid LOC header (bad signature)"; ++ printf("[LOC-ERROR] LOC check failed, %s\n", zip->msg); ++ printf("[LOC-ERROR] LOC check failed for jar: %s, class: %s, LOC: %08lx, pos:%ld\n", ++ zip->name, entry->name, GETSIG(loc), (-(entry->pos))); ++ unsigned int *temp = (unsigned int *) loc; ++ printf("[LOC-ERROR] LOC check failed, readVal: %08x %08x %08x %08x %08x %08x %08x %02x %02x\n", ++ *temp, *(temp + 1), *(temp + 2), *(temp + 3), *(temp + 4), ++ *(temp + 5), *(temp + 6), loc[28], loc[29]); ++ ++#ifdef LINUX ++#define ZIP_INVALID_LOC_HEADER_EXIT_ONLY "1" ++#define ZIP_INVALID_LOC_HEADER_EXIT_CODE_DUMP "2" ++ /* ++ * The meaning of the exit flag is as follows: ++ * 1: exit (126) ++ * 2: core dump ++ * others: throws ZipException ++ */ ++ char *exitFlag = getExitFlag(); ++ if (exitFlag != NULL) { ++ if (strcmp(exitFlag, ZIP_INVALID_LOC_HEADER_EXIT_ONLY) == 0) { ++ exit(126); ++ } else if (strcmp(exitFlag, ZIP_INVALID_LOC_HEADER_EXIT_CODE_DUMP) == 0) { ++ abort(); ++ } ++ } ++#endif + return -1; + } + entry->pos = (- entry->pos) + LOCHDR + LOCNAM(loc) + LOCEXT(loc); +-- +2.12.3 + diff --git a/add-system-property-swing.JComboBox.useLegacyMode.patch b/add-system-property-swing.JComboBox.useLegacyMode.patch new file mode 100755 index 0000000..cd58e56 --- /dev/null +++ b/add-system-property-swing.JComboBox.useLegacyMode.patch @@ -0,0 +1,84 @@ +diff --git a/jdk/src/share/classes/javax/swing/JComboBox.java b/jdk/src/share/classes/javax/swing/JComboBox.java +index 27a0c055a..d62330063 100644 +--- a/jdk/src/share/classes/javax/swing/JComboBox.java ++++ b/jdk/src/share/classes/javax/swing/JComboBox.java +@@ -24,9 +24,12 @@ + */ + package javax.swing; + ++import sun.security.action.GetPropertyAction; ++ + import java.beans.PropertyChangeEvent; + import java.beans.PropertyChangeListener; + import java.beans.Transient; ++import java.security.AccessController; + import java.util.*; + + import java.awt.*; +@@ -86,6 +89,16 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { + */ + private static final String uiClassID = "ComboBoxUI"; + ++ /** ++ * Use legacy mode, rollback JDK-8072767 changes. ++ */ ++ private static final boolean useLegacyMode; ++ ++ static { ++ useLegacyMode = "true".equals(AccessController.doPrivileged( ++ new GetPropertyAction("swing.JComboBox.useLegacyMode", "true"))); ++ } ++ + /** + * This protected field is implementation specific. Do not access directly + * or override. Use the accessor methods instead. +@@ -569,7 +582,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { + return; + } + +- getEditor().setItem(anObject); ++ if (!useLegacyMode) { ++ getEditor().setItem(anObject); ++ } + } + + // Must toggle the state of this flag since this method +@@ -1309,12 +1324,16 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { + * do not call or override. + */ + public void actionPerformed(ActionEvent e) { +- setPopupVisible(false); +- getModel().setSelectedItem(getEditor().getItem()); +- String oldCommand = getActionCommand(); +- setActionCommand("comboBoxEdited"); +- fireActionEvent(); +- setActionCommand(oldCommand); ++ ComboBoxEditor editor = getEditor(); ++ if ((!useLegacyMode) || ((editor != null) && (e != null) && (editor == e.getSource() ++ || editor.getEditorComponent() == e.getSource()))) { ++ setPopupVisible(false); ++ getModel().setSelectedItem(editor.getItem()); ++ String oldCommand = getActionCommand(); ++ setActionCommand("comboBoxEdited"); ++ fireActionEvent(); ++ setActionCommand(oldCommand); ++ } + } + + /** +diff --git a/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java b/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java +index 826e4631d..3d3e42cac 100644 +--- a/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java ++++ b/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java +@@ -41,7 +41,7 @@ import javax.swing.SwingUtilities; + * @author Alexander Scherbatiy + * @summary DefaultCellEditor for comboBox creates ActionEvent with wrong source + * object +- * @run main bug8072767 ++ * @run main/othervm -Dswing.JComboBox.useLegacyMode=false bug8072767 + */ + + public class bug8072767 { +-- +2.22.0 + diff --git a/debuginfo.diz-should-not-contain-the-path-after-unzip.patch b/debuginfo.diz-should-not-contain-the-path-after-unzip.patch new file mode 100755 index 0000000..1f49d5f --- /dev/null +++ b/debuginfo.diz-should-not-contain-the-path-after-unzip.patch @@ -0,0 +1,16 @@ +diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk +index 0e0346374..2d9bdbeed 100644 +--- a/make/common/NativeCompilation.gmk ++++ b/make/common/NativeCompilation.gmk +@@ -537,7 +537,7 @@ define SetupNativeCompilation + # to be rebuilt properly. + $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET) + $(CD) $$($1_OBJECT_DIR) \ +- && $(ZIP) -q $$@ $$($1_DEBUGINFO_FILES) ++ && $(ZIP) -q $$@ $$(subst $$($1_OBJECT_DIR)/,,$$($1_DEBUGINFO_FILES)) + endif + else + ifneq ($$($1_STRIP_POLICY), no_strip) +-- +2.22.0 + diff --git a/fix-TestUseCompressedOopsErgo-run-failed.patch b/fix-TestUseCompressedOopsErgo-run-failed.patch new file mode 100755 index 0000000..81012b3 --- /dev/null +++ b/fix-TestUseCompressedOopsErgo-run-failed.patch @@ -0,0 +1,16 @@ +diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +index 65231abe7..9e1f0cb70 100644 +--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java ++++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +@@ -109,6 +109,8 @@ public class WhiteBox { + public native long g1NumMaxRegions(); + public native long g1NumFreeRegions(); + public native int g1RegionSize(); ++ public native int g1ActiveMemoryNodeCount(); ++ public native int[] g1MemoryNodeIds(); + public native MemoryUsage g1AuxiliaryMemoryUsage(); + public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args); + +-- +2.22.0 + diff --git a/fix-testme-Test6929067-run-faild.patch b/fix-testme-Test6929067-run-faild.patch new file mode 100755 index 0000000..c357721 --- /dev/null +++ b/fix-testme-Test6929067-run-faild.patch @@ -0,0 +1,51 @@ +diff --git a/hotspot/test/runtime/6929067/Test6929067.sh b/hotspot/test/runtime/6929067/Test6929067.sh +index 90b96d5e9..438a287c8 100644 +--- a/hotspot/test/runtime/6929067/Test6929067.sh ++++ b/hotspot/test/runtime/6929067/Test6929067.sh +@@ -101,6 +101,10 @@ case "$ARCH" in + esac + + ++if [ "${VM_CPU}" == "aarch64" ]; then ++ COMP_FLAG="-mabi=lp64" ++fi ++ + # VM type: need to know server or client + VMTYPE=client + grep Server vm_version.out > ${NULL} +@@ -128,7 +132,7 @@ echo "VM type: ${VMTYPE}" + $gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \ + -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ + -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \ +- -ljvm -lpthread invoke.c ++ invoke.c -ljvm -lpthread + + ./invoke + exit $? +diff --git a/hotspot/test/runtime/InitialThreadOverflow/testme.sh b/hotspot/test/runtime/InitialThreadOverflow/testme.sh +index ee8d35ede..ffd7d6e3d 100644 +--- a/hotspot/test/runtime/InitialThreadOverflow/testme.sh ++++ b/hotspot/test/runtime/InitialThreadOverflow/testme.sh +@@ -51,6 +51,10 @@ fi + + CFLAGS="-m${VM_BITS}" + ++if [ "${VM_CPU}" == "aarch64" ]; then ++ CFLAGS="-mabi=lp64" ++fi ++ + LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH + +@@ -67,7 +71,7 @@ echo "Compilation flag: ${COMP_FLAG}" + $gcc_cmd -DLINUX ${CFLAGS} -o invoke \ + -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ + -L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \ +- -ljvm -lpthread invoke.cxx ++ invoke.cxx -ljvm -lpthread + + ./invoke + exit $? +-- +2.22.0 + diff --git a/implementation_of_Blas_hotspot_function_in_Intrinsics.patch b/implementation_of_Blas_hotspot_function_in_Intrinsics.patch index cb2815f..e731e53 100755 --- a/implementation_of_Blas_hotspot_function_in_Intrinsics.patch +++ b/implementation_of_Blas_hotspot_function_in_Intrinsics.patch @@ -1,9 +1,3 @@ -commit 9856171f660f6edb240bb4e7e95a87b60f4d2bc3 -Author: hubodao -Date: Tue Jun 8 08:07:38 2021 +0000 - - blas instrinsic - diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp index 7080ea10d..62a8ab7bd 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp @@ -270,10 +264,55 @@ diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/ index c5ec637a1..125983179 100644 --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp -@@ -3204,6 +3204,218 @@ class StubGenerator: public StubCodeGenerator { +@@ -3221,6 +3221,44 @@ class StubGenerator: public StubCodeGenerator { return start; } - + ++ address load_BLAS_library() { ++ // Try to load BLAS library. ++ const char library_name[] = "openblas"; ++ char err_buf[1024] = {0}; ++ char path[JVM_MAXPATHLEN] = {0}; ++ os::jvm_path(path, sizeof(path)); ++ int jvm_offset = -1; ++ ++ // Match "jvm[^/]*" in jvm_path. ++ const char* last_name = strrchr(path, '/'); ++ last_name = last_name ? last_name : path; ++ const char* last_lib_name = strstr(last_name, "jvm"); ++ if (last_lib_name != NULL) { ++ jvm_offset = last_lib_name - path; ++ } ++ ++ address library = NULL; ++ // Find the BLAS shared library. ++ // Search path: /jre/lib///libopenblas.so ++ if (jvm_offset >= 0) { ++ if (jvm_offset + strlen(library_name) + strlen(os::dll_file_extension()) < JVM_MAXPATHLEN) { ++ strncpy(&path[jvm_offset], library_name, strlen(library_name)); ++ strncat(&path[jvm_offset], os::dll_file_extension(), strlen(os::dll_file_extension())); ++ library = (address)os::dll_load(path, err_buf, sizeof(err_buf)); ++ } ++ } ++ return library; ++ } ++ ++ address get_BLAS_func_entry(address library, const char* func_name) { ++ if (library == NULL) { ++ return NULL; ++ } ++ ++ // Try to find BLAS function entry. ++ return (address)os::dll_lookup((void*)library, func_name); ++ } ++ + /** + * Arguments: + * +@@ -3254,6 +3292,218 @@ class StubGenerator: public StubCodeGenerator { + return start; + } + + // Parameter conversion from JVM to native BLAS + // + // Register: @@ -485,51 +524,6 @@ index c5ec637a1..125983179 100644 + } + + -+ - /** - * Arguments: - * -@@ -3221,6 +3221,44 @@ class StubGenerator: public StubCodeGenerator { - return start; - } - -+ address load_BLAS_library() { -+ // Try to load BLAS library. -+ const char library_name[] = "openblas"; -+ char err_buf[1024] = {0}; -+ char path[JVM_MAXPATHLEN] = {0}; -+ os::jvm_path(path, sizeof(path)); -+ int jvm_offset = -1; -+ -+ // Match "jvm[^/]*" in jvm_path. -+ const char* last_name = strrchr(path, '/'); -+ last_name = last_name ? last_name : path; -+ const char* last_lib_name = strstr(last_name, "jvm"); -+ if (last_lib_name != NULL) { -+ jvm_offset = last_lib_name - path; -+ } -+ -+ address library = NULL; -+ // Find the BLAS shared library. -+ // Search path: /jre/lib///libopenblas.so -+ if (jvm_offset >= 0) { -+ if (jvm_offset + strlen(library_name) + strlen(os::dll_file_extension()) < JVM_MAXPATHLEN) { -+ strncpy(&path[jvm_offset], library_name, strlen(library_name)); -+ strncat(&path[jvm_offset], os::dll_file_extension(), strlen(os::dll_file_extension())); -+ library = (address)os::dll_load(path, err_buf, sizeof(err_buf)); -+ } -+ } -+ return library; -+ } -+ -+ address get_BLAS_func_entry(address library, const char* func_name) { -+ if (library == NULL) { -+ return NULL; -+ } -+ -+ // Try to find BLAS function entry. -+ return (address)os::dll_lookup((void*)library, func_name); -+ } + /** * Arguments: @@ -1313,11 +1307,10 @@ index 5cbc0f012..10eeea217 100644 default: // If you get here, it may be that someone has added a new intrinsic // to the list in vmSymbols.hpp without implementing it here. -@@ -6353,6 +6361,144 @@ bool LibraryCallKit::inline_ddotF2jBLAS() { - return true; +@@ -6354,6 +6362,144 @@ bool LibraryCallKit::inline_ddotF2jBLAS() { } -+/** + /** + * double org.netlib.blas.Dgemm.dgemm(java.lang.String transa, + * java.lang.String transb, int m, int n, int k, + * double alpha, double[] a, int offset_a, int lda, @@ -1455,9 +1448,10 @@ index 5cbc0f012..10eeea217 100644 + return true; +} + - /** ++/** * Calculate CRC32 for ByteBuffer. * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) + */ diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index f1fe4d666..dc8f0c774 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp @@ -1627,3 +1621,6 @@ index a4eeb910d..16075d9f4 100644 static address multiplyToLen() {return _multiplyToLen; } static address squareToLen() {return _squareToLen; } +-- +2.12.3 + diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index 9897299..2282f49 100644 --- a/openjdk-1.8.0.spec +++ b/openjdk-1.8.0.spec @@ -916,7 +916,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r Name: java-%{javaver}-%{origin} Version: %{javaver}.%{updatever}.%{buildver} -Release: 1 +Release: 2 # 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 @@ -1124,6 +1124,16 @@ Patch228: add-wrap_memcpy-to-libsaproc.patch Patch229: downgrade-the-symver-of-fcntl64.patch # 8u322 +Patch230: add-system-property-swing.JComboBox.useLegacyMode.patch +Patch231: debuginfo.diz-should-not-contain-the-path-after-unzip.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 +Patch237: 8136577_Make_AbortVMOnException_available_in_product_builds.patch +Patch238: add-environment-variable-ZIP_INVALID_LOC_HEADER_EXIT.patch +Patch239: print-fd-and-file-path-when-a-zip-invalid-loc-header.patch +Patch240: 8207011-Remove-uses-of-the-register-storage-class-specifier.patch ############################################# # @@ -1592,6 +1602,16 @@ pushd %{top_level_dir_name} %patch226 -p1 %patch228 -p1 %patch229 -p1 +%patch230 -p1 +%patch231 -p1 +%patch232 -p1 +%patch233 -p1 +%patch235 -p1 +%patch236 -p1 +%patch237 -p1 +%patch238 -p1 +%patch239 -p1 +%patch240 -p1 popd # System library fixes @@ -2209,6 +2229,19 @@ require "copy_jdk_configs.lua" %endif %changelog +* Wed Feb 16 2022 kuenking111 - 1:1.8.0.322-b06.2 +- add add-system-property-swing.JComboBox.useLegacyMode.patch +- add debuginfo.diz-should-not-contain-the-path-after-unzip.patch +- add 8173361-various-crashes-in-JvmtiExport-post_compiled.patch +- add fix-TestUseCompressedOopsErgo-run-failed.patch +- add fix-testme-Test6929067-run-faild.patch +- add penetration_testing_vulnerability_fix.patch +- add 8136577_Make_AbortVMOnException_available_in_product_builds.patch +- add add-environment-variable-ZIP_INVALID_LOC_HEADER_EXIT.patch +- add print-fd-and-file-path-when-a-zip-invalid-loc-header.patch +- add 8207011-Remove-uses-of-the-register-storage-class-specifier.patch +- modified implementation_of_Blas_hotspot_function_in_Intrinsics.patch + * Tue Feb 15 2022 eapen - 1:1.8.0.322-b06.1 - fix makes failure when gcc version is lower than 8 diff --git a/penetration_testing_vulnerability_fix.patch b/penetration_testing_vulnerability_fix.patch new file mode 100755 index 0000000..1cbabca --- /dev/null +++ b/penetration_testing_vulnerability_fix.patch @@ -0,0 +1,124 @@ +diff --git a/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java b/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java +index 429c65fc0..6094c82a1 100644 +--- a/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java ++++ b/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java +@@ -148,6 +148,9 @@ public class KAEDHKeyPairGenerator + throw new ProviderException("Invoke nativeGenerateKeyPair failed.", e); + } + ++ // check keys ++ checkKeys(keys); ++ + BigInteger pubKey = new BigInteger(keys[0]); + BigInteger priKey = new BigInteger(keys[1]); + +@@ -162,5 +165,21 @@ public class KAEDHKeyPairGenerator + throw new ProviderException(ikse); + } + } ++ ++ private void checkKeys(byte[][] keys) { ++ if (keys == null) { ++ throw new ProviderException("Invalid keys, keys is null."); ++ } ++ // The keys needs to contain at least 2 byte arrays, which are public and private keys. ++ if (keys.length < 2) { ++ throw new ProviderException("Invalid keys, keys length is less than 2."); ++ } ++ for (int i = 0; i < keys.length; i++) { ++ if (keys[i] == null) { ++ throw new ProviderException("Invalid keys, keys[" + i + "]" + "is null."); ++ } ++ } ++ } ++ + protected native static byte[][] nativeGenerateKeyPair(byte[] p, byte[] g, int lSize); + } +diff --git a/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java b/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java +index 5f0c4db05..812980608 100644 +--- a/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java ++++ b/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java +@@ -65,9 +65,8 @@ public class KAEECKeyPairGenerator extends KeyPairGeneratorSpi { + + private ECParameterSpec getParamsByCurve(String curveName) { + byte[][] params = nativeGenerateParam(curveName); +- if (params == null) { +- throw new InvalidParameterException("unknown curve " + curveName); +- } ++ // check params ++ checkParams(params, curveName); + BigInteger p = new BigInteger(params[0]); + BigInteger a = new BigInteger(params[1]); + BigInteger b = new BigInteger(params[2]); +@@ -82,6 +81,21 @@ public class KAEECKeyPairGenerator extends KeyPairGeneratorSpi { + return spec; + } + ++ private void checkParams(byte[][] params, String curveName) { ++ if (params == null) { ++ throw new InvalidParameterException("Unknown curve " + curveName); ++ } ++ // The params needs to contain at least 7 byte arrays, which are p,a,b,x,y,order and cofactor. ++ if (params.length < 7) { ++ throw new InvalidParameterException("The params length is less than 7."); ++ } ++ for (int i = 0; i < params.length; i++) { ++ if (params[i] == null) { ++ throw new InvalidParameterException("The params[" + i + "]" + "is null."); ++ } ++ } ++ } ++ + @Override + public void initialize(AlgorithmParameterSpec param, SecureRandom random) throws InvalidAlgorithmParameterException { + if (param instanceof ECParameterSpec) { +diff --git a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_exception.c b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_exception.c +index 9ccc617c4..a43da7b30 100644 +--- a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_exception.c ++++ b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_exception.c +@@ -105,14 +105,10 @@ void KAE_ThrowFromOpenssl(JNIEnv* env, const char* msg, void (* defaultException + KAE_TRACE("OpenSSL error in %s: err=%lx, lib=%x, reason=%x, file=%s, line=%d, estring=%s, data=%s", msg, err, + lib, reason, file, line, estring, (flags & ERR_TXT_STRING) ? data : "(no data)"); + +- switch (lib) { +- case ERR_LIB_EVP: +- case ERR_LIB_RSA: +- KAE_ThrowEvpException(env, reason, estring, defaultException); +- break; +- default: +- defaultException(env, estring); +- break; ++ if (lib == ERR_LIB_EVP || lib == ERR_LIB_RSA) { ++ KAE_ThrowEvpException(env, reason, estring, defaultException); ++ } else { ++ defaultException(env, estring); + } + } + +diff --git a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_hmac.c b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_hmac.c +index 7b28fa1fa..554a9750c 100644 +--- a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_hmac.c ++++ b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_hmac.c +@@ -182,7 +182,7 @@ JNIEXPORT jint JNICALL Java_org_openeuler_security_openssl_KAEHMac_nativeFinal + + // write back to output_array + (*env)->SetByteArrayRegion(env, output, out_offset, bytesWritten, (jbyte*) temp_result); +- KAE_TRACE("KAEHMac_nativeFinal success, output_offset = %d, bytesWritten = %d", out_offset, bytesWritten); ++ KAE_TRACE("KAEHMac_nativeFinal success, output_offset = %d, bytesWritten = %u", out_offset, bytesWritten); + + cleanup: + free(temp_result); +diff --git a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c +index 0b23aa7d6..2ca978bbe 100644 +--- a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c ++++ b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c +@@ -136,7 +136,8 @@ static jobjectArray NewRSAKeyParams(JNIEnv* env, RSA* rsa) { + } + + // set rsa key param +- for (RSAParamIndex paramIndex = rsaN; paramIndex <= rsaIqmp; paramIndex++) { ++ RSAParamIndex paramIndex; ++ for (paramIndex = rsaN; paramIndex <= rsaIqmp; paramIndex++) { + if (!SetRSAKeyParam(env, rsa, params, paramIndex)) { + return NULL; + } diff --git a/print-fd-and-file-path-when-a-zip-invalid-loc-header.patch b/print-fd-and-file-path-when-a-zip-invalid-loc-header.patch new file mode 100755 index 0000000..745d925 --- /dev/null +++ b/print-fd-and-file-path-when-a-zip-invalid-loc-header.patch @@ -0,0 +1,49 @@ +diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c +index 3dbd2ba62..ff59c5ecc 100644 +--- a/jdk/src/share/native/java/util/zip/zip_util.c ++++ b/jdk/src/share/native/java/util/zip/zip_util.c +@@ -81,6 +81,20 @@ static jint INITIAL_META_COUNT = 2; /* initial number of entries in meta name + #ifdef LINUX + #define ZIP_INVALID_LOC_HEADER_EXIT "ZIP_INVALID_LOC_HEADER_EXIT" + ++void printFdInfo(jzfile *zip) { ++ int fd = zip->zfd; ++ char fdPath[100]; ++ char filePath[PATH_MAX + 1]; ++ sprintf(fdPath, "/proc/self/fd/%d", fd); ++ int len = readlink(fdPath, filePath, PATH_MAX); ++ if (len < 0) { ++ printf("[LOC-ERROR] Could not find fd : %d\n", fd); ++ return; ++ } ++ filePath[len] = '\0'; ++ printf("[LOC-ERROR] LOC check failed, zfd : %d , zfd file : %s\n", zip->zfd, filePath); ++} ++ + char *getExitFlag() { + static char *process_exit_flag = NULL; + static jboolean is_initialized = JNI_FALSE; +@@ -1339,8 +1353,8 @@ ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry) + if (GETSIG(loc) != LOCSIG) { + zip->msg = "invalid LOC header (bad signature)"; + printf("[LOC-ERROR] LOC check failed, %s\n", zip->msg); +- printf("[LOC-ERROR] LOC check failed for jar: %s, class: %s, LOC: %08lx, pos:%ld\n", +- zip->name, entry->name, GETSIG(loc), (-(entry->pos))); ++ printf("[LOC-ERROR] LOC check failed for jar: %s, class: %s, LOCSIG: %08lx, expected LOCSIG: %08lx, " ++ "pos:%ld\n", zip->name, entry->name, GETSIG(loc), LOCSIG, (-(entry->pos))); + unsigned int *temp = (unsigned int *) loc; + printf("[LOC-ERROR] LOC check failed, readVal: %08x %08x %08x %08x %08x %08x %08x %02x %02x\n", + *temp, *(temp + 1), *(temp + 2), *(temp + 3), *(temp + 4), +@@ -1349,6 +1363,9 @@ ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry) + #ifdef LINUX + #define ZIP_INVALID_LOC_HEADER_EXIT_ONLY "1" + #define ZIP_INVALID_LOC_HEADER_EXIT_CODE_DUMP "2" ++ // print fd info ++ printFdInfo(zip); ++ + /* + * The meaning of the exit flag is as follows: + * 1: exit (126) +-- +2.12.3 +