RFR (XS) 8199012: JVM crash during LevelDB JNI access

David Holmes david.holmes at oracle.com
Thu Mar 8 21:39:03 UTC 2018


On 9/03/2018 12:31 AM, Daniel D. Daugherty wrote:
> On 3/6/18 6:31 PM, David Holmes wrote:
>> webrev: http://cr.openjdk.java.net/~dholmes/8199012/webrev/
> 
> src/hotspot/share/prims/jni.cpp
>      No comments.
> 
> Thumbs up!
> 
> Since you're in that function would you mind fixing the indenting
> on these two lines:
> 
> L4223:   HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_OK);
> L4231:   HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
>     Both need two more spaces... no webrev needed if you decide
>     to fix this.

Will do! Also found a typo "middel" that I fixed.

Thanks,
David

> Dan
> 
> 
>> bug: https://bugs.openjdk.java.net/browse/JDK-8199012
>>
>> JNI DetachCurrentThread is defined as a no-op if called by a thread 
>> that is not attached. But the check for that was occurring after we 
>> called VM_Exit::block_if_vm_exited(). If the thread was not in fact 
>> attached then we have a NULL current thread and that can cause in 
>> crash in VM_Exit::block_if_vm_exited() if we actually need to block - 
>> which explains the scenario reported in the bug.
>>
>> Simple, obvious, fix is to do the "not attached" check first.
>>
>> Testing:
>>   - Mach5 CI equivalent testing (tier1/2)
>>   - internal JNI tests
>>
>> I marked this noreg-hard as a regression test is difficult to set up 
>> due to the need to coordinate with a VM shutdown.
>>
>> Thanks,
>> David
>>
> 


More information about the hotspot-runtime-dev mailing list