JDK-6264872 : Fix unhandled oops found in mustang development
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0u5
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-05-03
  • Updated: 2012-10-08
  • Resolved: 2005-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0u5 b03Fixed
Description
There were some naked oops found and fixed during development of the unhandled oop detector.  These fixes should be backported to an update release.

http://jruntime.east/~coleenp/webrev/4816341_cleanups/src/share/vm/prims/jvmtiImpl.hpp.diff.html

jvmtiError
JvmtiEnv::GetLocalObject(JavaThread* java_thread, jint depth, jint slot, jobject* value_ptr) {
  VM_GetOrSetLocal op(java_thread, depth, slot, T_OBJECT);
  VMThread::execute(&op);   <-- safepoint
  jvmtiError err = op.result();
  if (err != JVMTI_ERROR_NONE) {
    return err;
  } else {
    oop obj = op.oop_value();   <- oop_value can be GC'ed
    *value_ptr = jni_reference(((Handle)obj)());
    return JVMTI_ERROR_NONE;
  }
} /* end GetLocalObject */

VM_GetOrSetLocal needs an oops_do()

In:

http://jruntime.east/~coleenp/webrev/4816341_cleanups/src/share/vm/prims/jvmtiExport.cpp.diff.html

  jmethodID to_jmethodID(methodOop method) { return method->jmethod_id(); }

can eventually take out the lock JNIIdentifier_lock in jniIDCreator::mid() so
method is an unsafe oop.

In:

http://jruntime.east/~coleenp/webrev/4816341_cleanups/src/share/vm/prims/jvmtiTagMap.cpp.diff.html

void JvmtiTagMap::iterate_over_instances_of_class(klassOop k_oop...
{
  MutexLocker ml(Heap_lock);
  IterateOverHeapOperation op(this, _k_oop, object_filter, heap_object_callback, user_data);
  VMThread::execute(&op);
}

k_oop is unsafe because the Heap_lock can cause GC.

There were 2 naked oops in other code:

http://jruntime.east/~coleenp/webrev/4816341_cleanups/src/share/vm/ci/ciEnv.cpp.diff.html

In get_klass_by_index_impl klass is unsafe because it's used after the acquisition of the lock
      ObjectLocker ol(cpool, THREAD);
in the same function.

http://jruntime.east/~coleenp/webrev/4816341_cleanups/src/share/vm/memory/universe.cpp.diff.html

There was an oop k used after link_class() which can take out a lock.

These are already fixed in mustang.
###@###.### 2005-05-03 20:26:37 GMT
###@###.### 2005-05-03 23:39:19 GMT


After much discussion, it was decided that the naked oop found in
ciEnv.cpp was an artifact of the early naked oop detector and not
an actual naked oop. The other naked oops mentioned should be
back ported.

###@###.### 2005-06-07 04:09:50 GMT


Alan Bateman pointed out another naked oop problem that was fixed in
Mustang via the following bug:

    6264760 3/4 potential naked oop issue with Set/ClearBreakpoints

I'm adding that fix to the backport collection.

###@###.### 2005-06-14 21:47:15 GMT

Comments
EVALUATION Coleen has provided the changes that need to be backported to Tiger. I'll do the testing and add the fixes to my queue of Tiger-Update work. ###@###.### 2005-06-07 04:09:51 GMT
07-06-2005