From 9b54225e35da5411e7a9e51320adc3b014b92261 Mon Sep 17 00:00:00 2001 From: Simon Tooke Date: Fri, 20 Sep 2024 10:06:45 +0200 Subject: [PATCH] 8340401: test for thread with uninitialized stack --- src/hotspot/share/nmt/memMapPrinter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 029d3ac195888..aa2d6f9337e2c 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -172,8 +172,6 @@ static bool vma_touches_thread_stack(const void* from, const void* to, const Thr // Very rarely however is a VMA backing a thread stack folded together with another adjacent VMA by the // kernel. That can happen, e.g., for non-java threads that don't have guard pages. // Therefore we go for the simplest way here and check for intersection between VMA and thread stack. - // If the stack size is zero (i.e. no stack assigned yet), then return false. - if (t->stack_size() == 0) return false; return range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base()); } @@ -211,7 +209,7 @@ static void print_thread_details_for_supposed_stack_address(const void* from, co ResourceMark rm; #define HANDLE_THREAD(T) \ - if (T != nullptr && vma_touches_thread_stack(from, to, T)) { \ + if (T != nullptr && T->stack_size() != 0 && vma_touches_thread_stack(from, to, T)) { \ print_thread_details((uintx)(T->osthread()->thread_id()), T->name(), st); \ return; \ }