diff --git a/0053-8146987-Improve-Parallel-GC-Full-GC-by-caching-resul.patch b/0053-8146987-Improve-Parallel-GC-Full-GC-by-caching-resul.patch deleted file mode 100644 index 366147a3d6d7bdfa768276cd1284f1290e5ddf44..0000000000000000000000000000000000000000 --- a/0053-8146987-Improve-Parallel-GC-Full-GC-by-caching-resul.patch +++ /dev/null @@ -1,490 +0,0 @@ -Date: Mon, 5 Jun 2023 20:28:58 +0800 -Subject: [PATCH 53/59] 8146987: Improve Parallel GC Full GC by caching results of live_words_in_range() - -Bug url: https://bugs.openjdk.org/browse/JDK-8146987 ---- - .../parallelScavenge/parMarkBitMap.cpp | 48 ++++++++++++++- - .../parallelScavenge/parMarkBitMap.hpp | 10 +++- - .../parallelScavenge/psCompactionManager.cpp | 10 ++++ - .../parallelScavenge/psCompactionManager.hpp | 21 +++++++ - .../parallelScavenge/psParallelCompact.cpp | 60 ++++++++++--------- - .../parallelScavenge/psParallelCompact.hpp | 31 ++++++---- - hotspot/src/share/vm/oops/instanceKlass.cpp | 2 +- - .../src/share/vm/oops/instanceMirrorKlass.cpp | 2 +- - .../src/share/vm/oops/instanceRefKlass.cpp | 6 +- - hotspot/src/share/vm/oops/objArrayKlass.cpp | 2 +- - 10 files changed, 146 insertions(+), 46 deletions(-) - -diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp -index 1dde10746..06e930ca7 100644 ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp -@@ -24,6 +24,7 @@ - - #include "precompiled.hpp" - #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" -+#include "gc_implementation/parallelScavenge/psCompactionManager.hpp" - #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" - #include "oops/oop.inline.hpp" - #include "runtime/os.hpp" -@@ -110,7 +111,18 @@ ParMarkBitMap::mark_obj(HeapWord* addr, size_t size) - return false; - } - --size_t ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, oop end_obj) const -+inline bool ParMarkBitMap::is_live_words_in_range_in_cache(ParCompactionManager* cm, HeapWord* beg_addr) const { -+ return cm->last_query_begin() == beg_addr; -+} -+ -+inline void ParMarkBitMap::update_live_words_in_range_cache(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj, -+ size_t result) const { -+ cm->set_last_query_begin(beg_addr); -+ cm->set_last_query_object(end_obj); -+ cm->set_last_query_return(result); -+} -+ -+size_t ParMarkBitMap::live_words_in_range_helper(HeapWord* beg_addr, oop end_obj) const - { - assert(beg_addr <= (HeapWord*)end_obj, "bad range"); - assert(is_marked(end_obj), "end_obj must be live"); -@@ -131,6 +143,40 @@ size_t ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, oop end_obj) const - return bits_to_words(live_bits); - } - -+size_t ParMarkBitMap::live_words_in_range_use_cache(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj) const -+{ -+ HeapWord* last_beg = cm->last_query_begin(); -+ oop last_obj = cm->last_query_object(); -+ size_t last_ret = cm->last_query_return(); -+ if (end_obj > last_obj) { -+ last_ret = last_ret + live_words_in_range_helper((HeapWord*)last_obj, end_obj); -+ last_obj = end_obj; -+ } else if (end_obj < last_obj) { -+ // The cached value is for an object that is to the left (lower address) of the current -+ // end_obj. Calculate back from that cached value. -+ if (pointer_delta((HeapWord*)end_obj, (HeapWord*)beg_addr) > pointer_delta((HeapWord*)last_obj, (HeapWord*)end_obj)) { -+ last_ret = last_ret - live_words_in_range_helper((HeapWord*)end_obj, last_obj); -+ } else { -+ last_ret = live_words_in_range_helper(beg_addr, end_obj); -+ } -+ last_obj = end_obj; -+ } -+ -+ update_live_words_in_range_cache(cm, last_beg, last_obj, last_ret); -+ return last_ret; -+} -+ -+size_t ParMarkBitMap::live_words_in_range(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj) const -+{ -+ // Try to reuse result from ParCompactionManager cache first. -+ if (is_live_words_in_range_in_cache(cm, beg_addr)) { -+ return live_words_in_range_use_cache(cm, beg_addr, end_obj); -+ } -+ size_t ret = live_words_in_range_helper(beg_addr, end_obj); -+ update_live_words_in_range_cache(cm, beg_addr, end_obj, ret); -+ return ret; -+} -+ - ParMarkBitMap::IterationStatus - ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure, - idx_t range_beg, idx_t range_end) const -diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp -index 8d0153d48..2d8ad9dd7 100644 ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp -@@ -31,6 +31,7 @@ - - class ParMarkBitMapClosure; - class PSVirtualSpace; -+class ParCompactionManager; - - class ParMarkBitMap: public CHeapObj - { -@@ -124,7 +125,7 @@ public: - // the range are included in the result. The end of the range must be a live object, - // which is the case when updating pointers. This allows a branch to be removed - // from inside the loop. -- size_t live_words_in_range(HeapWord* beg_addr, oop end_obj) const; -+ size_t live_words_in_range(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj) const; - - inline HeapWord* region_start() const; - inline HeapWord* region_end() const; -@@ -167,6 +168,13 @@ public: - #endif // #ifdef ASSERT - - private: -+ -+ size_t live_words_in_range_helper(HeapWord* beg_addr, oop end_obj) const; -+ -+ inline bool is_live_words_in_range_in_cache(ParCompactionManager* cm, HeapWord* beg_addr) const; -+ size_t live_words_in_range_use_cache(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj) const; -+ inline void update_live_words_in_range_cache(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj, size_t result) const; -+ - // Each bit in the bitmap represents one unit of 'object granularity.' Objects - // are double-word aligned in 32-bit VMs, but not in 64-bit VMs, so the 32-bit - // granularity is 2, 64-bit is 1. -diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp -index 415d62947..e38997bc6 100644 ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp -@@ -65,6 +65,8 @@ ParCompactionManager::ParCompactionManager() : - - marking_stack()->initialize(); - _objarray_stack.initialize(); -+ -+ reset_bitmap_query_cache(); - } - - ParCompactionManager::~ParCompactionManager() { -@@ -121,6 +123,14 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { - "Not initialized?"); - } - -+void ParCompactionManager::reset_all_bitmap_query_caches() { -+ uint parallel_gc_threads = PSParallelCompact::gc_task_manager()->workers(); -+ for (uint i=0; i<=parallel_gc_threads; i++) { -+ _manager_array[i]->reset_bitmap_query_cache(); -+ } -+} -+ -+ - int ParCompactionManager::pop_recycled_stack_index() { - assert(_recycled_bottom <= _recycled_top, "list is empty"); - // Get the next available index -diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp -index a16a16762..9b1c4f9a0 100644 ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp -@@ -114,6 +114,10 @@ private: - - Action _action; - -+ HeapWord* _last_query_beg; -+ oop _last_query_obj; -+ size_t _last_query_ret; -+ - static PSOldGen* old_gen() { return _old_gen; } - static ObjectStartArray* start_array() { return _start_array; } - static OopTaskQueueSet* stack_array() { return _stack_array; } -@@ -132,9 +136,26 @@ private: - // marking stack and overflow stack directly. - - public: -+ void reset_bitmap_query_cache() { -+ _last_query_beg = NULL; -+ _last_query_obj = NULL; -+ _last_query_ret = 0; -+ } -+ - Action action() { return _action; } - void set_action(Action v) { _action = v; } - -+ // Bitmap query support, cache last query and result -+ HeapWord* last_query_begin() { return _last_query_beg; } -+ oop last_query_object() { return _last_query_obj; } -+ size_t last_query_return() { return _last_query_ret; } -+ -+ void set_last_query_begin(HeapWord *new_beg) { _last_query_beg = new_beg; } -+ void set_last_query_object(oop new_obj) { _last_query_obj = new_obj; } -+ void set_last_query_return(size_t new_ret) { _last_query_ret = new_ret; } -+ -+ static void reset_all_bitmap_query_caches(); -+ - RegionTaskQueue* region_stack() { return _region_stack; } - void set_region_stack(RegionTaskQueue* v) { _region_stack = v; } - -diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp -index 26d64a135..2c75c4d68 100644 ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp -@@ -748,7 +748,7 @@ bool ParallelCompactData::summarize(SplitInfo& split_info, - return true; - } - --HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr) { -+HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr, ParCompactionManager* cm) { - assert(addr != NULL, "Should detect NULL oop earlier"); - assert(PSParallelCompact::gc_heap()->is_in(addr), "not in heap"); - assert(PSParallelCompact::mark_bitmap()->is_marked(addr), "not marked"); -@@ -785,7 +785,7 @@ HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr) { - const size_t block_offset = addr_to_block_ptr(addr)->offset(); - - const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap(); -- const size_t live = bitmap->live_words_in_range(search_start, oop(addr)); -+ const size_t live = bitmap->live_words_in_range(cm, search_start, oop(addr)); - result += block_offset + live; - DEBUG_ONLY(PSParallelCompact::check_new_location(addr, result)); - return result; -@@ -825,11 +825,8 @@ bool PSParallelCompact::IsAliveClosure::do_object_b(oop p) { return mark_bitmap( - void PSParallelCompact::KeepAliveClosure::do_oop(oop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); } - void PSParallelCompact::KeepAliveClosure::do_oop(narrowOop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); } - --PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_pointer_closure; --PSParallelCompact::AdjustKlassClosure PSParallelCompact::_adjust_klass_closure; -- --void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { adjust_pointer(p); } --void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p); } -+void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { adjust_pointer(p, _cm); } -+void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p, _cm); } - - void PSParallelCompact::FollowStackClosure::do_void() { _compaction_manager->follow_marking_stacks(); } - -@@ -842,7 +839,8 @@ void PSParallelCompact::FollowKlassClosure::do_klass(Klass* klass) { - klass->oops_do(_mark_and_push_closure); - } - void PSParallelCompact::AdjustKlassClosure::do_klass(Klass* klass) { -- klass->oops_do(&PSParallelCompact::_adjust_pointer_closure); -+ PSParallelCompact::AdjustPointerClosure closure(_cm); -+ klass->oops_do(&closure); - } - - void PSParallelCompact::post_initialize() { -@@ -1021,6 +1019,8 @@ void PSParallelCompact::pre_compact(PreGCValues* pre_gc_values) - - // Have worker threads release resources the next time they run a task. - gc_task_manager()->release_all_resources(); -+ -+ ParCompactionManager::reset_all_bitmap_query_caches(); - } - - void PSParallelCompact::post_compact() -@@ -2093,7 +2093,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { - - // adjust_roots() updates Universe::_intArrayKlassObj which is - // needed by the compaction for filling holes in the dense prefix. -- adjust_roots(); -+ adjust_roots(vmthread_cm); - - compaction_start.update(); - compact(); -@@ -2450,40 +2450,46 @@ void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, - cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); - } - --void PSParallelCompact::adjust_roots() { -+void PSParallelCompact::adjust_roots(ParCompactionManager* cm) { - // Adjust the pointers to reflect the new locations - GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer, _gc_tracer.gc_id()); - - // Need new claim bits when tracing through and adjusting pointers. - ClassLoaderDataGraph::clear_claimed_marks(); - -+ PSParallelCompact::AdjustPointerClosure oop_closure(cm); -+ PSParallelCompact::AdjustKlassClosure klass_closure(cm); -+ - // General strong roots. -- Universe::oops_do(adjust_pointer_closure()); -- JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles -- CLDToOopClosure adjust_from_cld(adjust_pointer_closure()); -- Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL); -- ObjectSynchronizer::oops_do(adjust_pointer_closure()); -- FlatProfiler::oops_do(adjust_pointer_closure()); -- Management::oops_do(adjust_pointer_closure()); -- JvmtiExport::oops_do(adjust_pointer_closure()); -- SystemDictionary::oops_do(adjust_pointer_closure()); -- ClassLoaderDataGraph::oops_do(adjust_pointer_closure(), adjust_klass_closure(), true); -+ Universe::oops_do(&oop_closure); -+ JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles -+ CLDToOopClosure adjust_from_cld(&oop_closure); -+ Threads::oops_do(&oop_closure, &adjust_from_cld, NULL); -+ ObjectSynchronizer::oops_do(&oop_closure); -+ FlatProfiler::oops_do(&oop_closure); -+ Management::oops_do(&oop_closure); -+ JvmtiExport::oops_do(&oop_closure); -+ SystemDictionary::oops_do(&oop_closure); -+ ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true); -+ - - // Now adjust pointers in remaining weak roots. (All of which should - // have been cleared if they pointed to non-surviving objects.) - // Global (weak) JNI handles -- JNIHandles::weak_oops_do(adjust_pointer_closure()); -- JFR_ONLY(Jfr::weak_oops_do(adjust_pointer_closure())); -+ JNIHandles::weak_oops_do(&oop_closure); -+ // adjust weak pointers in jfr oops. for TestJcmdDump.java -+ JFR_ONLY(Jfr::weak_oops_do(&oop_closure)); - -- CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations); -+ CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations); - CodeCache::blobs_do(&adjust_from_blobs); -- StringTable::oops_do(adjust_pointer_closure()); -- ref_processor()->weak_oops_do(adjust_pointer_closure()); -+ StringTable::oops_do(&oop_closure); -+ ref_processor()->weak_oops_do(&oop_closure); -+ - // Roots were visited so references into the young gen in roots - // may have been scanned. Process them also. - // Should the reference processor have a span that excludes - // young gen objects? -- PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure()); -+ PSScavenge::reference_processor()->weak_oops_do(&oop_closure); - } - - void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, -@@ -3342,7 +3348,7 @@ MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) { - assert(bitmap()->obj_size(addr) == words, "bad size"); - - _source = addr; -- assert(PSParallelCompact::summary_data().calc_new_pointer(source()) == -+ assert(PSParallelCompact::summary_data().calc_new_pointer(source(), compaction_manager()) == - destination(), "wrong destination"); - - if (words > words_remaining()) { -diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp -index f971383a0..efec18746 100644 ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp -@@ -452,10 +452,10 @@ public: - HeapWord* partial_obj_end(size_t region_idx) const; - - // Return the location of the object after compaction. -- HeapWord* calc_new_pointer(HeapWord* addr); -+ HeapWord* calc_new_pointer(HeapWord* addr, ParCompactionManager* cm); - -- HeapWord* calc_new_pointer(oop p) { -- return calc_new_pointer((HeapWord*) p); -+ HeapWord* calc_new_pointer(oop p, ParCompactionManager* cm) { -+ return calc_new_pointer((HeapWord*) p, cm); - } - - #ifdef ASSERT -@@ -957,15 +957,28 @@ class PSParallelCompact : AllStatic { - - class AdjustPointerClosure: public OopClosure { - public: -+ AdjustPointerClosure(ParCompactionManager* cm) { -+ assert(cm != NULL, "associate ParCompactionManage should not be NULL"); -+ _cm = cm; -+ } -+ - virtual void do_oop(oop* p); - virtual void do_oop(narrowOop* p); - // do not walk from thread stacks to the code cache on this phase - virtual void do_code_blob(CodeBlob* cb) const { } -+ private: -+ ParCompactionManager* _cm; - }; - - class AdjustKlassClosure : public KlassClosure { - public: -+ AdjustKlassClosure(ParCompactionManager* cm) { -+ assert(cm != NULL, "associate ParCompactionManage should not be NULL"); -+ _cm = cm; -+ } - void do_klass(Klass* klass); -+ private: -+ ParCompactionManager* _cm; - }; - - friend class KeepAliveClosure; -@@ -989,8 +1002,6 @@ class PSParallelCompact : AllStatic { - static IsAliveClosure _is_alive_closure; - static SpaceInfo _space_info[last_space_id]; - static bool _print_phases; -- static AdjustPointerClosure _adjust_pointer_closure; -- static AdjustKlassClosure _adjust_klass_closure; - - // Reference processing (used in ...follow_contents) - static ReferenceProcessor* _ref_processor; -@@ -1114,7 +1125,7 @@ class PSParallelCompact : AllStatic { - static void summary_phase(ParCompactionManager* cm, bool maximum_compaction); - - // Adjust addresses in roots. Does not adjust addresses in heap. -- static void adjust_roots(); -+ static void adjust_roots(ParCompactionManager* cm); - - DEBUG_ONLY(static void write_block_fill_histogram(outputStream* const out);) - -@@ -1184,8 +1195,6 @@ class PSParallelCompact : AllStatic { - static bool initialize(); - - // Closure accessors -- static OopClosure* adjust_pointer_closure() { return (OopClosure*)&_adjust_pointer_closure; } -- static KlassClosure* adjust_klass_closure() { return (KlassClosure*)&_adjust_klass_closure; } - static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&_is_alive_closure; } - - // Public accessors -@@ -1205,7 +1214,7 @@ class PSParallelCompact : AllStatic { - // Check mark and maybe push on marking stack - template static inline void mark_and_push(ParCompactionManager* cm, - T* p); -- template static inline void adjust_pointer(T* p); -+ template static inline void adjust_pointer(T* p, ParCompactionManager* cm); - - static inline void follow_klass(ParCompactionManager* cm, Klass* klass); - -@@ -1368,11 +1377,11 @@ inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) { - } - - template --inline void PSParallelCompact::adjust_pointer(T* p) { -+inline void PSParallelCompact::adjust_pointer(T* p, ParCompactionManager* cm) { - T heap_oop = oopDesc::load_heap_oop(p); - if (!oopDesc::is_null(heap_oop)) { - oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); -- oop new_obj = (oop)summary_data().calc_new_pointer(obj); -+ oop new_obj = (oop)summary_data().calc_new_pointer(obj, cm); - assert(new_obj != NULL, // is forwarding ptr? - "should be forwarded"); - // Just always do the update unconditionally? -diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp -index 538645bbe..ad9eb8b01 100644 ---- a/hotspot/src/share/vm/oops/instanceKlass.cpp -+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp -@@ -2544,7 +2544,7 @@ int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { - int size = size_helper(); - InstanceKlass_OOP_MAP_ITERATE( \ - obj, \ -- PSParallelCompact::adjust_pointer(p), \ -+ PSParallelCompact::adjust_pointer(p, cm), \ - assert_is_in) - return size; - } -diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp -index fdf2e42af..ee911d190 100644 ---- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp -+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp -@@ -345,7 +345,7 @@ int InstanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) - - InstanceMirrorKlass_OOP_ITERATE( \ - start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\ -- PSParallelCompact::adjust_pointer(p), \ -+ PSParallelCompact::adjust_pointer(p, cm), \ - assert_nothing) - return size; - } -diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp -index 2c3fe7496..eb6c12edd 100644 ---- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp -+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp -@@ -429,11 +429,11 @@ template - void specialized_oop_update_pointers(InstanceRefKlass *ref, - ParCompactionManager* cm, oop obj) { - T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); -- PSParallelCompact::adjust_pointer(referent_addr); -+ PSParallelCompact::adjust_pointer(referent_addr, cm); - T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); -- PSParallelCompact::adjust_pointer(next_addr); -+ PSParallelCompact::adjust_pointer(next_addr, cm); - T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); -- PSParallelCompact::adjust_pointer(discovered_addr); -+ PSParallelCompact::adjust_pointer(discovered_addr, cm); - debug_only(trace_reference_gc("InstanceRefKlass::oop_update_ptrs", obj, - referent_addr, next_addr, discovered_addr);) - } -diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp -index 60d173e9e..c69abdc06 100644 ---- a/hotspot/src/share/vm/oops/objArrayKlass.cpp -+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp -@@ -590,7 +590,7 @@ int ObjArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { - assert (obj->is_objArray(), "obj must be obj array"); - objArrayOop a = objArrayOop(obj); - int size = a->object_size(); -- ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p)) -+ ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p, cm)) - return size; - } - #endif // INCLUDE_ALL_GCS --- -2.22.0 - diff --git a/8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch b/8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch new file mode 100644 index 0000000000000000000000000000000000000000..5e41bd132d423cc91448e6409f8e871b793b7613 --- /dev/null +++ b/8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch @@ -0,0 +1,227 @@ +From d85c283f3bb1fd5f1d96c076e858a7409af19aae Mon Sep 17 00:00:00 2001 +Subject: 8283441: C2: segmentation fault in ciMethodBlocks::make_block_at(int) + +Bug url: https://bugs.openjdk.org/browse/JDK-8283441 +--- + hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 12 ++++-- + hotspot/src/share/vm/ci/ciMethodBlocks.cpp | 17 +++++--- + .../src/share/vm/compiler/methodLiveness.cpp | 9 ++-- + hotspot/test/compiler/parsing/Custom.jasm | 38 +++++++++++++++++ + ...UnreachableBlockFallsThroughEndOfCode.java | 42 +++++++++++++++++++ + 5 files changed, 106 insertions(+), 12 deletions(-) + create mode 100644 hotspot/test/compiler/parsing/Custom.jasm + create mode 100644 hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java + +diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +index eb8ffe5e5..db353541f 100644 +--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp ++++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +@@ -206,8 +206,10 @@ void BlockListBuilder::handle_exceptions(BlockBegin* current, int cur_bci) { + } + + void BlockListBuilder::handle_jsr(BlockBegin* current, int sr_bci, int next_bci) { +- // start a new block after jsr-bytecode and link this block into cfg +- make_block_at(next_bci, current); ++ if (next_bci < method()->code_size()) { ++ // start a new block after jsr-bytecode and link this block into cfg ++ make_block_at(next_bci, current); ++ } + + // start a new block at the subroutine entry at mark it with special flag + BlockBegin* sr_block = make_block_at(sr_bci, current); +@@ -227,6 +229,8 @@ void BlockListBuilder::set_leaders() { + // branch target and a modification of the successor lists. + BitMap bci_block_start = method()->bci_block_start(); + ++ int end_bci = method()->code_size(); ++ + ciBytecodeStream s(method()); + while (s.next() != ciBytecodeStream::EOBC()) { + int cur_bci = s.cur_bci(); +@@ -297,7 +301,9 @@ void BlockListBuilder::set_leaders() { + case Bytecodes::_if_acmpne: // fall through + case Bytecodes::_ifnull: // fall through + case Bytecodes::_ifnonnull: +- make_block_at(s.next_bci(), current); ++ if (s.next_bci() < end_bci) { ++ make_block_at(s.next_bci(), current); ++ } + make_block_at(s.get_dest(), current); + current = NULL; + break; +diff --git a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp +index 3ce828ecb..bb3937c15 100644 +--- a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp ++++ b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -33,12 +33,13 @@ + + + ciBlock *ciMethodBlocks::block_containing(int bci) { ++ assert(bci >= 0 && bci < _code_size, "valid bytecode range"); + ciBlock *blk = _bci_to_block[bci]; + return blk; + } + + bool ciMethodBlocks::is_block_start(int bci) { +- assert(bci >=0 && bci < _code_size, "valid bytecode range"); ++ assert(bci >= 0 && bci < _code_size, "valid bytecode range"); + ciBlock *b = _bci_to_block[bci]; + assert(b != NULL, "must have block for bytecode"); + return b->start_bci() == bci; +@@ -146,7 +147,9 @@ void ciMethodBlocks::do_analysis() { + case Bytecodes::_ifnonnull : + { + cur_block->set_control_bci(bci); +- ciBlock *fall_through = make_block_at(s.next_bci()); ++ if (s.next_bci() < limit_bci) { ++ ciBlock *fall_through = make_block_at(s.next_bci()); ++ } + int dest_bci = s.get_dest(); + ciBlock *dest = make_block_at(dest_bci); + break; +@@ -166,7 +169,9 @@ void ciMethodBlocks::do_analysis() { + case Bytecodes::_jsr : + { + cur_block->set_control_bci(bci); +- ciBlock *ret = make_block_at(s.next_bci()); ++ if (s.next_bci() < limit_bci) { ++ ciBlock *ret = make_block_at(s.next_bci()); ++ } + int dest_bci = s.get_dest(); + ciBlock *dest = make_block_at(dest_bci); + break; +@@ -224,7 +229,9 @@ void ciMethodBlocks::do_analysis() { + case Bytecodes::_jsr_w : + { + cur_block->set_control_bci(bci); +- ciBlock *ret = make_block_at(s.next_bci()); ++ if (s.next_bci() < limit_bci) { ++ ciBlock *ret = make_block_at(s.next_bci()); ++ } + int dest_bci = s.get_far_dest(); + ciBlock *dest = make_block_at(dest_bci); + break; +diff --git a/hotspot/src/share/vm/compiler/methodLiveness.cpp b/hotspot/src/share/vm/compiler/methodLiveness.cpp +index eda1ab156..7fb496dc9 100644 +--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp ++++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp +@@ -268,10 +268,11 @@ void MethodLiveness::init_basic_blocks() { + case Bytecodes::_ifnull: + case Bytecodes::_ifnonnull: + // Two way branch. Set predecessors at each destination. +- dest = _block_map->at(bytes.next_bci()); +- assert(dest != NULL, "must be a block immediately following this one."); +- dest->add_normal_predecessor(current_block); +- ++ if (bytes.next_bci() < method_len) { ++ dest = _block_map->at(bytes.next_bci()); ++ assert(dest != NULL, "must be a block immediately following this one."); ++ dest->add_normal_predecessor(current_block); ++ } + dest = _block_map->at(bytes.get_dest()); + assert(dest != NULL, "branch desination must start a block."); + dest->add_normal_predecessor(current_block); +diff --git a/hotspot/test/compiler/parsing/Custom.jasm b/hotspot/test/compiler/parsing/Custom.jasm +new file mode 100644 +index 000000000..78bfc518d +--- /dev/null ++++ b/hotspot/test/compiler/parsing/Custom.jasm +@@ -0,0 +1,38 @@ ++/* ++ * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++package compiler/parsing; ++ ++super public class Custom { ++ ++ public static Method test:"(I)V" stack 2 locals 1 { ++ return; ++Loop: ++ // Unreachable block ++ iload_0; ++ bipush 100; ++ if_icmpge Loop; ++ // Falls through ++ } ++ ++} +\ No newline at end of file +diff --git a/hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java b/hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java +new file mode 100644 +index 000000000..5b1d17d97 +--- /dev/null ++++ b/hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java +@@ -0,0 +1,42 @@ ++/* ++ * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++/* ++ * @test UnreachableBlockFallsThroughEndOfCode.java ++ * @bug 8283441 ++ * @compile Custom.jasm UnreachableBlockFallsThroughEndOfCode.java ++ * @summary Compiling method that falls off the end of the code array ++ * @run main/othervm -XX:TieredStopAtLevel=1 -Xbatch compiler.parsing.UnreachableBlockFallsThroughEndOfCode ++ * @run main/othervm -XX:-TieredCompilation -Xbatch compiler.parsing.UnreachableBlockFallsThroughEndOfCode ++ */ ++ ++ package compiler.parsing; ++ ++ public class UnreachableBlockFallsThroughEndOfCode { ++ public static void main(String[] strArr) { ++ for (int i = 0; i < 20000; i++) { ++ Custom.test(i); ++ } ++ } ++ } +\ No newline at end of file +-- +2.22.0 + diff --git a/Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified.patch b/Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified.patch new file mode 100644 index 0000000000000000000000000000000000000000..c14207f1e335598529781560398881ec779bcbcb --- /dev/null +++ b/Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified.patch @@ -0,0 +1,319 @@ +From 46b7cb7838a2de1a6463ddf17edefef73ec1217f Mon Sep 17 00:00:00 2001 +Date: Thu, 3 Aug 2023 10:03:27 +0800 +Subject: [PATCH] Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified + +--- + .../security/auth/kerberos/KerberosKey.java | 46 ++------ + .../javax/security/auth/kerberos/KeyImpl.java | 26 ++--- + .../sun/security/krb5/EncryptionKey.java | 17 +-- + .../security/auth/kerberos/StandardNames.java | 108 ------------------ + 4 files changed, 28 insertions(+), 169 deletions(-) + delete mode 100644 jdk/test/javax/security/auth/kerberos/StandardNames.java + +diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java +index a8d12131a..5c8b65f27 100644 +--- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java ++++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java +@@ -52,20 +52,7 @@ import javax.security.auth.DestroyFailedException; + * application depends on the default JGSS Kerberos mechanism to access the + * KerberosKey. In that case, however, the application will need an + * appropriate +- * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.

+- * +- * When creating a {@code KerberosKey} using the +- * {@link #KerberosKey(KerberosPrincipal, char[], String)} constructor, +- * an implementation may accept non-IANA algorithm names (For example, +- * "ArcFourMac" for "rc4-hmac"), but the {@link #getAlgorithm} method +- * must always return the IANA algorithm name.

+- * +- * @implNote Old algorithm names used before JDK 9 are supported in the +- * {@link #KerberosKey(KerberosPrincipal, char[], String)} constructor in this +- * implementation for compatibility reasons, which are "DES" (and null) for +- * "des-cbc-md5", "DESede" for "des3-cbc-sha1-kd", "ArcFourHmac" for "rc4-hmac", +- * "AES128" for "aes128-cts-hmac-sha1-96", and "AES256" for +- * "aes256-cts-hmac-sha1-96". ++ * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}. + * + * @author Mayank Upadhyay + * @since 1.4 +@@ -86,7 +73,7 @@ public class KerberosKey implements SecretKey, Destroyable { + * + * @serial + */ +- private final int versionNum; ++ private int versionNum; + + /** + * {@code KeyImpl} is serialized by writing out the ASN1 Encoded bytes +@@ -126,16 +113,13 @@ public class KerberosKey implements SecretKey, Destroyable { + } + + /** +- * Constructs a KerberosKey from a principal's password using the specified +- * algorithm name. The algorithm name (case insensitive) should be provided +- * as the encryption type string defined on the IANA +- * Kerberos Encryption Type Numbers +- * page. The version number of the key generated will be 0. ++ * Constructs a KerberosKey from a principal's password. + * + * @param principal the principal that this password belongs to + * @param password the password that should be used to compute the key + * @param algorithm the name for the algorithm that this key will be +- * used for ++ * used for. This parameter may be null in which case the default ++ * algorithm "DES" will be assumed. + * @throws IllegalArgumentException if the name of the + * algorithm passed is unsupported. + */ +@@ -144,7 +128,6 @@ public class KerberosKey implements SecretKey, Destroyable { + String algorithm) { + + this.principal = principal; +- this.versionNum = 0; + // Pass principal in for salt + key = new KeyImpl(principal, password, algorithm); + } +@@ -187,18 +170,13 @@ public class KerberosKey implements SecretKey, Destroyable { + */ + + /** +- * Returns the standard algorithm name for this key. The algorithm names +- * are the encryption type string defined on the IANA +- * Kerberos Encryption Type Numbers +- * page. +- *

+- * This method can return the following value not defined on the IANA page: +- *

    +- *
  1. none: for etype equal to 0
  2. +- *
  3. unknown: for etype greater than 0 but unsupported by +- * the implementation
  4. +- *
  5. private: for etype smaller than 0
  6. +- *
++ * Returns the standard algorithm name for this key. For ++ * example, "DES" would indicate that this key is a DES key. ++ * See Appendix A in the ++ * Java Cryptography Architecture API Specification & Reference ++ * ++ * for information about standard algorithm names. + * + * @return the name of the algorithm associated with this key. + */ +diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java +index 571387e0c..6791c42f0 100644 +--- a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java ++++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java +@@ -36,6 +36,7 @@ import sun.security.krb5.PrincipalName; + import sun.security.krb5.EncryptionKey; + import sun.security.krb5.EncryptedData; + import sun.security.krb5.KrbException; ++import sun.security.krb5.KrbCryptoException; + import sun.security.util.DerValue; + + /** +@@ -85,12 +86,8 @@ class KeyImpl implements SecretKey, Destroyable, Serializable { + + try { + PrincipalName princ = new PrincipalName(principal.getName()); +- EncryptionKey key; +- if ("none".equalsIgnoreCase(algorithm)) { +- key = EncryptionKey.NULL_KEY; +- } else { +- key = new EncryptionKey(password, princ.getSalt(), algorithm); +- } ++ EncryptionKey key = ++ new EncryptionKey(password, princ.getSalt(), algorithm); + this.keyBytes = key.getBytes(); + this.keyType = key.getEType(); + } catch (KrbException e) { +@@ -121,22 +118,20 @@ class KeyImpl implements SecretKey, Destroyable, Serializable { + + switch (eType) { + case EncryptedData.ETYPE_DES_CBC_CRC: +- return "des-cbc-crc"; +- + case EncryptedData.ETYPE_DES_CBC_MD5: +- return "des-cbc-md5"; ++ return "DES"; + + case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD: +- return "des3-cbc-sha1-kd"; ++ return "DESede"; + + case EncryptedData.ETYPE_ARCFOUR_HMAC: +- return "rc4-hmac"; ++ return "ArcFourHmac"; + + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96: +- return "aes128-cts-hmac-sha1-96"; ++ return "AES128"; + + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: +- return "aes256-cts-hmac-sha1-96"; ++ return "AES256"; + + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + return "aes128-cts-hmac-sha256-128"; +@@ -145,10 +140,11 @@ class KeyImpl implements SecretKey, Destroyable, Serializable { + return "aes256-cts-hmac-sha384-192"; + + case EncryptedData.ETYPE_NULL: +- return "none"; ++ return "NULL"; + + default: +- return eType > 0 ? "unknown" : "private"; ++ throw new IllegalArgumentException( ++ "Unsupported encryption type: " + eType); + } + } + +diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java +index 627168e70..71e667028 100644 +--- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java ++++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java +@@ -277,22 +277,15 @@ public class EncryptionKey + String salt, + String algorithm) throws KrbCryptoException { + +- if (algorithm == null || algorithm.equalsIgnoreCase("DES") +- || algorithm.equalsIgnoreCase("des-cbc-md5")) { ++ if (algorithm == null || algorithm.equalsIgnoreCase("DES")) { + keyType = EncryptedData.ETYPE_DES_CBC_MD5; +- } else if (algorithm.equalsIgnoreCase("des-cbc-crc")) { +- keyType = EncryptedData.ETYPE_DES_CBC_CRC; +- } else if (algorithm.equalsIgnoreCase("DESede") +- || algorithm.equalsIgnoreCase("des3-cbc-sha1-kd")) { ++ } else if (algorithm.equalsIgnoreCase("DESede")) { + keyType = EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD; +- } else if (algorithm.equalsIgnoreCase("AES128") +- || algorithm.equalsIgnoreCase("aes128-cts-hmac-sha1-96")) { ++ } else if (algorithm.equalsIgnoreCase("AES128")) { + keyType = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96; +- } else if (algorithm.equalsIgnoreCase("ArcFourHmac") +- || algorithm.equalsIgnoreCase("rc4-hmac")) { ++ } else if (algorithm.equalsIgnoreCase("ArcFourHmac")) { + keyType = EncryptedData.ETYPE_ARCFOUR_HMAC; +- } else if (algorithm.equalsIgnoreCase("AES256") +- || algorithm.equalsIgnoreCase("aes256-cts-hmac-sha1-96")) { ++ } else if (algorithm.equalsIgnoreCase("AES256")) { + keyType = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96; + // validate if AES256 is enabled + if (!EType.isSupported(keyType)) { +diff --git a/jdk/test/javax/security/auth/kerberos/StandardNames.java b/jdk/test/javax/security/auth/kerberos/StandardNames.java +deleted file mode 100644 +index 40590f6d0..000000000 +--- a/jdk/test/javax/security/auth/kerberos/StandardNames.java ++++ /dev/null +@@ -1,108 +0,0 @@ +-/* +- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- */ +- +-/* +- * @test +- * @bug 8035986 +- * @summary KerberosKey algorithm names are not specified +- */ +- +-import sun.security.krb5.EncryptedData; +- +-import javax.crypto.Cipher; +-import javax.security.auth.kerberos.KerberosKey; +-import javax.security.auth.kerberos.KerberosPrincipal; +-import java.util.Locale; +- +-public class StandardNames { +- static KerberosPrincipal kp = new KerberosPrincipal("user@REALM"); +- static char[] pass = "secret".toCharArray(); +- static byte[] keyBytes = new byte[1]; +- +- public static void main(String[] args) throws Exception { +- for (EncType e: EncType.values()) { +- if (e == EncType.e18) { +- if (Cipher.getMaxAllowedKeyLength("AES") < 256) { +- System.out.println("Skipping aes256-cts-hmac-sha1-96"); +- continue; +- } +- } +- checkByName(e.name, e); +- checkByName(e.name.toUpperCase(Locale.US), e); +- for (String n: e.oldnames) { +- checkByName(n, e); +- if (n != null) { +- checkByName(n.toLowerCase(Locale.US), e); +- } +- } +- checkByEType(e.etype, e.name); +- } +- checkByEType(100, "unknown"); +- checkByEType(-1, "private"); +- +- try { +- System.out.println("unsupported"); +- new KerberosKey(kp, pass, "unsupported"); +- throw new Exception("unsupported"); +- } catch (IllegalArgumentException iae) { +- // Expected +- } +- } +- +- private static void checkByName(String n, EncType e) throws Exception { +- System.out.println("CheckByName " + n); +- KerberosKey k = new KerberosKey(kp, pass, n); +- if (!k.getAlgorithm().equals(e.name)) throw new Exception(n); +- if (k.getKeyType() != e.etype) throw new Exception(n); +- if (k.getVersionNumber() != 0) throw new Exception(n); +- } +- +- private static void checkByEType(int i, String n) throws Exception { +- System.out.println("CheckByInt " + i); +- KerberosKey k = new KerberosKey(kp, keyBytes, i, 13); +- if (!k.getAlgorithm().equals(n)) throw new Exception("" + i); +- if (k.getKeyType() != i) throw new Exception("" + i); +- if (k.getVersionNumber() != 13) throw new Exception("" + i); +- } +-} +- +-enum EncType { +- e0("none", EncryptedData.ETYPE_NULL), +- e1("des-cbc-crc", EncryptedData.ETYPE_DES_CBC_CRC), +- e3("des-cbc-md5", EncryptedData.ETYPE_DES_CBC_MD5, "DES", null), +- e16("des3-cbc-sha1-kd", EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD, "DESede"), +- e17("aes128-cts-hmac-sha1-96", EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, "AES128"), +- e18("aes256-cts-hmac-sha1-96", EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96, "AES256"), +- e23("rc4-hmac", EncryptedData.ETYPE_ARCFOUR_HMAC, "ArcFourHmac"), +- ; +- +- final String name; +- final int etype; +- final String[] oldnames; +- +- EncType(String name, int etype, String... oldnames) { +- this.name = name; +- this.etype = etype; +- this.oldnames = oldnames; +- } +-} +-- +2.22.0 + diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index 4912bcd687b3d20195dad1a130124e89ca1be115..4cb1313e8cf97514724c51424baee4fe5d94449a 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: 0 +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 @@ -1235,7 +1235,6 @@ Patch354: 0049-Modify-G1GC-log-information.patch Patch355: 0050-8181644-C1-crashes-with-XX-PrintCFGToFile.patch Patch356: 0051-8071962-The-SA-code-needs-to-be-updated-to-support-S.patch Patch357: 0052-8177959-G1CollectedHeap-print_on-prints-incorrect-ca.patch -Patch358: 0053-8146987-Improve-Parallel-GC-Full-GC-by-caching-resul.patch Patch359: 0054-Fix-jmap-heapdump-symbols-when-the-class-is-loaded-f.patch Patch360: 0055-Fix-CodelistTest.java-Failed-to-Execute-CodelistTest.patch @@ -1246,6 +1245,8 @@ Patch363: fixing-a-bug-in-the-processing-of-default-attributes.patch Patch364: enhance-java-heap-oom-err-log.patch Patch365: 8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch Patch366: 8179273-sun.net.httpserver.LeftOverInputStream-shoul.patch +Patch367: Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified.patch +Patch368: 8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch ############################################# # @@ -1817,7 +1818,6 @@ pushd %{top_level_dir_name} %patch355 -p1 %patch356 -p1 %patch357 -p1 -%patch358 -p1 %patch359 -p1 %patch360 -p1 %patch361 -p1 @@ -1826,6 +1826,8 @@ pushd %{top_level_dir_name} %patch364 -p1 %patch365 -p1 %patch366 -p1 +%patch367 -p1 +%patch368 -p1 popd # System library fixes @@ -2449,6 +2451,16 @@ cjc.mainProgram(arg) %endif %changelog +* Fri Aug 25 2023 kuenking111 - 1:1.8.0.382-b05.3 +- add 8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch +- fix cve-2022-40433 + +* Thu Aug 24 2023 kuenking111 - 1:1.8.0.382-b05.2 +- deleted 0053-8146987-Improve-Parallel-GC-Full-GC-by-caching-resul.patch + +* Thu Aug 3 2023 kuenking111 - 1:1.8.0.382-b05.1 +- add Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified.patch + * Mon Jul 31 2023 wanghao_hw - 1:1.8.0.382-b05.0 - add Huawei-Print-more-information-when-AbortVMOnException.patch - deleted patch 8185736-missing-default-exception-handler-in-calls-t.patch