From 334683e634c23a3672585e4309a528d0944d942e Mon Sep 17 00:00:00 2001 From: David Holmes Date: Thu, 26 Jun 2025 21:48:46 +0000 Subject: [PATCH] 8358645: Access violation in ThreadsSMRSupport::print_info_on during thread dump Reviewed-by: fbredberg, shade, dcubed --- src/hotspot/share/runtime/threadSMR.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index bcfd950ee39..631a7ed8d79 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -1168,9 +1168,10 @@ void ThreadsSMRSupport::print_info_on(const Thread* thread, outputStream* st) { // The count is only interesting if we have a _threads_list_ptr. st->print(", _nested_threads_hazard_ptr_cnt=%u", thread->_nested_threads_hazard_ptr_cnt); } - if (SafepointSynchronize::is_at_safepoint() || Thread::current() == thread) { - // It is only safe to walk the list if we're at a safepoint or the - // calling thread is walking its own list. + if ((SafepointSynchronize::is_at_safepoint() && thread->is_Java_thread()) || + Thread::current() == thread) { + // It is only safe to walk the list if we're at a safepoint and processing a JavaThread, + // or the calling thread is walking its own list. SafeThreadsListPtr* current = thread->_threads_list_ptr; if (current != nullptr) { // Skip the top nesting level as it is always printed above.