United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6373461 Unhanded oop detector misses naked oops with locks guarded by conditional
6373461 : Unhanded oop detector misses naked oops with locks guarded by conditional

Details
Type:
Bug
Submit Date:
2006-01-17
Status:
Closed
Updated Date:
2012-10-08
Project Name:
JDK
Resolved Date:
2006-11-14
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
hs10

Related Reports
Backport:
Backport:

Sub Tasks

Description
The unhandled oop detector will clear stack allocated oops in MutexLocker code to detect whether an oop is held around a safepoint (lock), but misses the case in code like JvmtiThreadState::state_for() where taking the lock out is conditional.   It should check for naked oops even if the condition around the lock is not true because it may be that way during testing with the switch, and miss the case when it's true.

  // retrieve or create JvmtiThreadState
  inline static JvmtiThreadState *state_for(JavaThread *thread) {
    JvmtiThreadState *state = thread->jvmti_thread_state();
    if (state == NULL) {
      MutexLocker mu(JvmtiThreadState_lock);
      // check again with the lock held
      state = state_for_while_locked(thread);
    }
    return state;
  }

                                    

Comments
EVALUATION

Fixed 6373461: Unhanded oop detector misses naked oops with locks guarded by conditional

The naked oops are cleared so they crash in the call to MutexLocker, but in
a few cases, the MutexLocker was inside a conditional causing the detector
to miss naked oops (esp in code surrounding the JvmtiThreadState
state_for()) call.  I fixed several of these to clear the naked oops in the
else clause if MutexLocker was conditionalized.  That should find more
naked oops.
                                     
2006-10-10
EVALUATION

There were only a few obvious cases like this, so I fixed them.  I didn't change the vm for cases where a call that takes out a lock is protected by a conditional.  Those are harder to find.
                                     
2006-06-14



Hardware and Software, Engineered to Work Together