Ensure that we don't suspend during GetOwnedMonitorInfoCommon
We incorrectly failed to tell the synchronous checkpoint in
GetOwnedMonitorInfoCommon that the calling thread needs to avoid
suspending. Because of this it is possible for the monitors being
transfered between threads to miss gc-marking. If the function is
called during a GC this can lead to illegal reads.
Bug: 76003243
Test: while ./test/run-test --host 1922; do; done
Test: ./test.py --host
Change-Id: I99be60b0541ee82f241605e6492610a21f5ee4ec
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index 41a649b..4526be4 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -925,7 +925,9 @@
if (target != self) {
called_method = true;
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!target->RequestSynchronousCheckpoint(&closure)) {
+ // Since this deals with object references we need to avoid going to sleep.
+ art::ScopedAssertNoThreadSuspension sants("Getting owned monitor usage");
+ if (!target->RequestSynchronousCheckpoint(&closure, art::ThreadState::kRunnable)) {
return ERR(THREAD_NOT_ALIVE);
}
} else {