From e5efd6590004d5383334c20b266c3308a292218d Mon Sep 17 00:00:00 2001 From: hulin Date: Thu, 2 Nov 2023 17:52:56 -0400 Subject: [PATCH] Pass NULL walkState to jvmti callback for JNI local reference on stack We could not pass walkState parameter to jvmti callback for JNI local reference on stack (except normal Stack slot), it could cause jvmti crash, so pass walkState == NULL for the case. Signed-off-by: hulin --- runtime/gc_base/ReferenceChainWalker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/gc_base/ReferenceChainWalker.cpp b/runtime/gc_base/ReferenceChainWalker.cpp index 41e299fce16..37ae1b95fe4 100644 --- a/runtime/gc_base/ReferenceChainWalker.cpp +++ b/runtime/gc_base/ReferenceChainWalker.cpp @@ -646,7 +646,7 @@ MM_ReferenceChainWalker::doStackSlot(J9Object **slotPtr, void *walkState, const /* Only report heap objects */ if (isHeapObject(slotValue) && !_heap->objectIsInGap(slotValue)) { if (J9_STACKWALK_SLOT_TYPE_JNI_LOCAL == ((J9StackWalkState *)walkState)->slotType) { - doSlot(slotPtr, J9GC_ROOT_TYPE_JNI_LOCAL, -1, (J9Object *)walkState); + doSlot(slotPtr, J9GC_ROOT_TYPE_JNI_LOCAL, -1, NULL); } else { doSlot(slotPtr, J9GC_ROOT_TYPE_STACK_SLOT, -1, (J9Object *)walkState); }