-
Bug
-
Resolution: Fixed
-
P3
-
6, 7, 8
-
b115
-
generic
-
generic
There are no checks for NULLs in Java_java_net_NetworkInterface_init:
*/
JNIEXPORT void JNICALL
Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
{
/*
* Get the various JNI ids that we require
*/
ni_class = (*env)->NewGlobalRef(env, cls);
ni_nameID = (*env)->GetFieldID(env, ni_class, "name", "Ljava/lang/String;");
ni_displayNameID = (*env)->GetFieldID(env, ni_class, "displayName", "Ljava/lang/String;");
ni_indexID = (*env)->GetFieldID(env, ni_class, "index", "I");
ni_addrsID = (*env)->GetFieldID(env, ni_class, "addrs", "[Ljava/net/InetAddress;");
ni_bindsID = (*env)->GetFieldID(env, ni_class, "bindings", "[Ljava/net/InterfaceAddress;");
ni_childsID = (*env)->GetFieldID(env, ni_class, "childs", "[Ljava/net/NetworkInterface;");
ni_ctor = (*env)->GetMethodID(env, ni_class, "<init>", "()V");
ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
ni_ia4Ctor = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress");
ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls);
ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
ni_ibbroadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
ni_ibmaskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
}
However, on OOME JNI functions will return NULL and VM will crash if it will be passed as argument to another JNI function:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/tmp/workspace/8-2-build-solaris-sparcv9/jdk8/495/hotspot/src/share/vm/runtime/jniHandles.hpp:184), pid=22977, tid=65
# assert(handle != NULL) failed: JNI handle should not be null
#
# JRE version: Java(TM) SE Runtime Environment (8.0-b112) (build 1.8.0-ea-fastdebug-b112)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b54-fastdebug mixed mode solaris-sparc compressed oops)
# Core dump written. Default location: /export/local/aurora/sandbox/results/ResultDir/jck60007_copy_1/core or core.22977
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x00000001038a8800): JavaThread "TestThread #43" [_thread_in_vm, id=65, stack(0xffffffff58500000,0xffffffff58600000)]
Stack: [0xffffffff58500000,0xffffffff58600000], sp=0xffffffff585f6f90, free space=987k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x1220254] void VMError::report_and_die()+0x714
V [libjvm.so+0x70ff20] void report_vm_error(const char*,int,const char*,const char*)+0x78
V [libjvm.so+0x567208] oop JNIHandles::resolve_non_null(_jobject*)+0x40
V [libjvm.so+0xa9b6a4] _jmethodID*get_method_id(JNIEnv_*,_jclass*,const char*,const char*,bool,Thread*)+0xd4
V [libjvm.so+0xa9c0d0] jni_GetMethodID+0x36c
C [libnet.so+0x6a84] Java_java_net_NetworkInterface_init+0x2dc
j java.net.NetworkInterface.init()V+-1584104464
j java.net.NetworkInterface.init()V+0
j java.net.NetworkInterface.<clinit>()V+11
...
8-b112 crashes during VM testing.
It is not a regression and probably could be reproduced with JDK 5,6,7 as well.
*/
JNIEXPORT void JNICALL
Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
{
/*
* Get the various JNI ids that we require
*/
ni_class = (*env)->NewGlobalRef(env, cls);
ni_nameID = (*env)->GetFieldID(env, ni_class, "name", "Ljava/lang/String;");
ni_displayNameID = (*env)->GetFieldID(env, ni_class, "displayName", "Ljava/lang/String;");
ni_indexID = (*env)->GetFieldID(env, ni_class, "index", "I");
ni_addrsID = (*env)->GetFieldID(env, ni_class, "addrs", "[Ljava/net/InetAddress;");
ni_bindsID = (*env)->GetFieldID(env, ni_class, "bindings", "[Ljava/net/InterfaceAddress;");
ni_childsID = (*env)->GetFieldID(env, ni_class, "childs", "[Ljava/net/NetworkInterface;");
ni_ctor = (*env)->GetMethodID(env, ni_class, "<init>", "()V");
ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
ni_ia4Ctor = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress");
ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls);
ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
ni_ibbroadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
ni_ibmaskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
}
However, on OOME JNI functions will return NULL and VM will crash if it will be passed as argument to another JNI function:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/tmp/workspace/8-2-build-solaris-sparcv9/jdk8/495/hotspot/src/share/vm/runtime/jniHandles.hpp:184), pid=22977, tid=65
# assert(handle != NULL) failed: JNI handle should not be null
#
# JRE version: Java(TM) SE Runtime Environment (8.0-b112) (build 1.8.0-ea-fastdebug-b112)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b54-fastdebug mixed mode solaris-sparc compressed oops)
# Core dump written. Default location: /export/local/aurora/sandbox/results/ResultDir/jck60007_copy_1/core or core.22977
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x00000001038a8800): JavaThread "TestThread #43" [_thread_in_vm, id=65, stack(0xffffffff58500000,0xffffffff58600000)]
Stack: [0xffffffff58500000,0xffffffff58600000], sp=0xffffffff585f6f90, free space=987k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x1220254] void VMError::report_and_die()+0x714
V [libjvm.so+0x70ff20] void report_vm_error(const char*,int,const char*,const char*)+0x78
V [libjvm.so+0x567208] oop JNIHandles::resolve_non_null(_jobject*)+0x40
V [libjvm.so+0xa9b6a4] _jmethodID*get_method_id(JNIEnv_*,_jclass*,const char*,const char*,bool,Thread*)+0xd4
V [libjvm.so+0xa9c0d0] jni_GetMethodID+0x36c
C [libnet.so+0x6a84] Java_java_net_NetworkInterface_init+0x2dc
j java.net.NetworkInterface.init()V+-1584104464
j java.net.NetworkInterface.init()V+0
j java.net.NetworkInterface.<clinit>()V+11
...
8-b112 crashes during VM testing.
It is not a regression and probably could be reproduced with JDK 5,6,7 as well.
- relates to
-
JDK-8027448 'assert(handle != NULL) failed: JNI handle should not be null' at Java_java_net_NetworkInterface_init
-
- Closed
-