RFR (S): 8238676: jni crashes on accessing it from process exit hook

David Holmes david.holmes at oracle.com
Tue Feb 25 23:57:18 UTC 2020


Hi Fred,

On 26/02/2020 1:29 am, Frederic Parain wrote:
> Hi David,
> 
> Changes look good according to the explanations in the CR.

Thank for taking a look at this.

> Minor comment:
> 
> 4078   // If executing from an atexit hook we may be in the VMThread.
> 4079   if (!current->is_Java_thread()) {
> 4080     return JNI_ERR;
> 4081   }
> 
> Could be written:
> 
> 4078   // If executing from an atexit hook we may be in the VMThread.
> 4079   if (!current->is_Java_thread()) {
> 4080     HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
> 4081     return JNI_ERR;
> 4082   }
> 
> in order to have consistent DTrace events.

Fixed.

Thanks,
David
-----

> Fred
> 
> 
>> On Feb 23, 2020, at 20:01, David Holmes <david.holmes at oracle.com> wrote:
>>
>> Any takers?
>>
>> David
>>
>> On 19/02/2020 12:04 pm, David Holmes wrote:
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8238676
>>> webrev: http://cr.openjdk.java.net/~dholmes/8238676/webrev/
>>> If an application tries to use JNI from an atexit handler, the attempt can't succeed (the VM has already logically terminated) but it should not crash. The JNI Invocation API code was missing some checks in places and wasn't aware of the possibility of trying to make calls from the VMThread.
>>> Testing:
>>>   - new test added for the JNI Invocation API
>>>   - tiers 1-3
>>> Thanks,
>>> David
> 


More information about the hotspot-runtime-dev mailing list