8022836: JVM crashes in JVMTIENVBASE::GET_CURRENT_CONTENDED_MONITOR and GET_OWNED_MONITOR

Wed, 18 Sep 2013 16:48:49 +0400

author
sgabdura
date
Wed, 18 Sep 2013 16:48:49 +0400
changeset 5745
c1d7040a1183
parent 5686
6f45933aef35
child 5746
8c84f04ff977

8022836: JVM crashes in JVMTIENVBASE::GET_CURRENT_CONTENDED_MONITOR and GET_OWNED_MONITOR
Summary: Check that the _java_thread parameter is valid when it is possible that the JavaThread has exited after the initial checks were made in generated/jvmtifiles/jvmtiEnter.cpp: jvmti_GetCurrentContendedMonitor()
Reviewed-by: dcubed, dsamersoff

src/share/vm/prims/jvmtiEnvBase.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/prims/jvmtiEnvBase.hpp	Tue Sep 17 20:20:03 2013 +0200
     1.2 +++ b/src/share/vm/prims/jvmtiEnvBase.hpp	Wed Sep 18 16:48:49 2013 +0400
     1.3 @@ -406,7 +406,11 @@
     1.4    VMOp_Type type() const { return VMOp_GetCurrentContendedMonitor; }
     1.5    jvmtiError result() { return _result; }
     1.6    void doit() {
     1.7 -    _result = ((JvmtiEnvBase *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);
     1.8 +    _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
     1.9 +    if (Threads::includes(_java_thread) && !_java_thread->is_exiting() &&
    1.10 +        _java_thread->threadObj() != NULL) {
    1.11 +      _result = ((JvmtiEnvBase *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);
    1.12 +    }
    1.13    }
    1.14  };
    1.15  

mercurial