United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7084560 Crash in net.dll
JDK-7084560 : Crash in net.dll

Details
Type:
Bug
Submit Date:
2011-08-29
Status:
Resolved
Updated Date:
2013-06-26
Project Name:
JDK
Resolved Date:
2011-09-20
Component:
core-libs
OS:
windows_2008
Sub-Component:
java.net
CPU:
unknown
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
Hello everybody,

I got one crash issue on OpenJDK7 windows build.

I captured the stack trace of such a crash, which happens intermittently on my 64bit Windows 2008 server. But unfortunately I have no simple test case to reproduce this problem.

RtlInterlockedFlushSList+0x2ea (0x779F2A7F [ntdll+0x32a7f])
RtlInterlockedFlushSList+0x572 (0x779F2D07 [ntdll+0x32d07])
RtlInterlockedFlushSList+0x45d (0x779F2BF2 [ntdll+0x32bf2])
HeapFree+0x14 (0x755A14D1 [kernel32+0x114d1])
free+0x1c (0x7284016A [msvcr100+0x1016a])
free_netaddr+0x11 (networkinterface.c:107, 0x725A12AC [net+0x12ac])
getAllInterfacesAndAddresses+0xb6 (networkinterface_winxp.c:199, 0x725AB4C8 [net+0xb4c8])
Java_java_net_NetworkInterface_getAll_XP+0x12 (networkinterface_winxp.c:693, 0x725AB7AB [net+0xb7ab])

From the code at src/windows/native/java/net/NetworkInterface_winXP.c:195, I believe it is the dangling pointers that caused this problem. The uninitialized pointer netaddrP is exceptionally freed if the call to Windows API "GetIpAddrTable()" fails.

                                    

Comments
EVALUATION

Suggested fix contributed by IBM. Looks fine.
                                     
2011-08-29
SUGGESTED FIX

Here's the updated patch:

diff -r 9b8c96f96a0f src/windows/native/java/net/NetworkInterface.c
--- a/src/windows/native/java/net/NetworkInterface.c    Mon Jun 27 13:21:34 2011 -0700
+++ b/src/windows/native/java/net/NetworkInterface.c    Mon Aug 29 17:02:56 2011 +0800
@@ -504,8 +504,7 @@
      */
     if (netaddrCount < 0) {
         netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
-        if ((*env)->ExceptionOccurred(env)) {
-            free_netaddr(netaddrP);
+        if (netaddrCount == -1) {
             return NULL;
         }
     }
diff -r 9b8c96f96a0f src/windows/native/java/net/NetworkInterface_winXP.c
--- a/src/windows/native/java/net/NetworkInterface_winXP.c    Mon Jun 27 13:21:34 2011 -0700
+++ b/src/windows/native/java/net/NetworkInterface_winXP.c    Mon Aug 29 17:02:56 2011 +0800
@@ -194,8 +194,7 @@
     while (curr != NULL) {
         netaddr *netaddrP;
         ret = enumAddresses_win(env, curr, &netaddrP);
-        if ((*env)->ExceptionOccurred(env)) {
-            free_netaddr(netaddrP);
+        if (ret == -1) {
             return -1;
         }
         curr->addrs = netaddrP;
@@ -449,8 +448,7 @@
      */
     if (netaddrCount < 0) {
         netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
-        if ((*env)->ExceptionOccurred(env)) {
-            free_netaddr(netaddrP);
+        if (count == -1) {
             return NULL;
         }
     }
                                     
2011-08-29



Hardware and Software, Engineered to Work Together