JDK-6425560 : JVM crashes on failed 'read' call: assertion in p11_general.c:277
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris
  • CPU: generic
  • Submitted: 2006-05-13
  • Updated: 2015-10-13
  • Resolved: 2015-10-13
Related Reports
Duplicate :  
Description
I was imitating "failed read" by returning -1.
If read failure happens on 1934th invocation of read JVM fails with crashes
with following error:

# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xd20fda5f, pid=1308, tid=124
#
# Java VM: Java HotSpot(TM) Server VM (1.6.0-beta2-b84 interpreted mode)
# Problematic frame:
# V  [libjvm.so+0xfda5f]
#
# An error report file with more information is saved as hs_err_pid1308.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
---------------  T H R E A D  ---------------

Current thread (0x08155800):  JavaThread "Thread-110" [_thread_in_vm,
id=124]

siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x00000000;;
;; si_signo=11  SIGSEGV
;; si_code=1    SEGV_MAPERR /* Address not mapped to object.  */

...


Please see full hs_err_pid1308.log attached.


Fastdebug jvm fails with assertion:
    Assertion failed: jInfoClass != 0,
    file ../../../../src/share/native/sun/security/pkcs11/wrapper/p11_general.c, line 277


The stack trace is:
  [1] read(0xa, 0xf2578668, 0x2b4, 0x0, 0x3d898, 0x164000), at 0xff38062c
=>[2] readFully(fd = ???, buf = ???, len = ???) (optimized), at 0xfd29c174
(line ~98) in "zip_util.c"
  [3] readFullyAt(fd = ???, buf = ???, len = ???, offset = ???) (optimized), at 0xfd29c218 (line ~124) in "z
  [4] ZIP_Read(zip = ???, entry = ???, pos = ???, buf = ???, len = ???)
(optimized), at 0xfd29d9e4 (line ~998) in "zip_util.c"
  [5] Java_java_util_zip_ZipFile_read(env = ???, cls = ???, zfile = ???,
zentry = ???, pos = ???, bytes = ???, off = ???, len = ???) (optimized), at
0xfd2933cc (line ~192) in "ZipFile.c"
  [6] 0xfb015a78(0x10a, 0xf257a7f4, 0xf257a760, 0xffffff78, 0xfd1a2000, 0x0), at 0xfb015a78
  [7] 0xfb015938(0x2b4, 0xb8, 0x0, 0x24, 0x1c8210, 0xf257a778), at 0xfb015938
  [8] 0xfb005908(0x2b4, 0xb8, 0x0, 0xfb02c650, 0xfe495d53, 0xf257a810), at 0xfb005908
  [9] 0xfb005908(0xf322c8c8, 0xb6, 0x0, 0xfb02c650, 0x1646ec, 0xf257a8b8), at 0xfb005908
  [10] 0xfb005908(0xf322c8f8, 0xb6, 0x0, 0xfb02be10, 0xf6c00888, 0xf257a940), at 0xfb005908
  [11] 0xfb005a30(0xf322c8f8, 0xb6, 0x0, 0xfb02bcc0, 0x3d800, 0xf257a9d0), at 0xfb005a30
  [12] 0xfb005908(0xf322c8a8, 0xb6, 0x0, 0xfb02be10, 0x10, 0xf257aa68), at 0xfb005908
  [13] 0xfb005908(0xf322c7b0, 0xb6, 0x0, 0xfb02be10, 0xf6d99648, 0xf257ab10), at 0xfb005908
  [14] 0xfb0058c0(0xf418f240, 0xb7, 0x0, 0xfb02bcc0, 0xf3238328, 0xf257abc0), at 0xfb0058c0
  [15] 0xfb0058c0(0xf322c7b0, 0xb8, 0x0, 0xfb02c180, 0x3d800, 0xf257ac40), at 0xfb0058c0
  [16] 0xfb0058c0(0x20, 0xfeeabeb4, 0x0, 0xfb02c500, 0xf257b015, 0xf257acd8), at 0xfb0058c0
  [17] 0xfb0002d0(0xf257adf0, 0xf257b040, 0xa, 0xf6d95598, 0xfb012260, 0xf257afb4), at 0xfb0002d0
  [18] JavaCalls::call_helper(0xf6d95598, 0xf257b040, 0xf6d95598, 0x164000, 0x1, 0xfb000240), at 0xfd9c849c
  [19] JVM_DoPrivileged(0x164104, 0xf257afd0, 0x1bbcc, 0x1646e0, 0x164000, 0x1646e4), at 0xfdb4872c
  [20]
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_A
= ???, cls = ???, action = ???, context = ???) (optimized), at 0xfd1cacb8
(line ~60) in "AccessController.c"
  [21] 0xfb015a78(0x109, 0xf257b534, 0xf257b4b0, 0xffffff80, 0xf6c00dd0, 0x0), at 0xfb015a78
  [22] 0xfb015938(0xf419b320, 0xb8, 0x0, 0x8, 0xf3238328, 0xf257b4c8), at 0xfb015938
  [23] 0xfb0058c0(0xf418f240, 0xb6, 0x0, 0xfb02c6b0, 0xfeed2d38, 0xf257b558), at 0xfb0058c0
  [24] 0xfb0058c0(0xf418f240, 0xb6, 0x0, 0xfb02bcc0, 0xfee69108, 0xf257b5f0), at 0xfb0058c0
  [25] 0xfb0058c0(0xf418f240, 0xb6, 0x0, 0xfb02be10, 0x3d800, 0xf257b670), at 0xfb0058c0
  [26] 0xfb0058c0(0x1f, 0xfeeabeb4, 0x0, 0xfb02bcc0, 0xf257b9b9, 0xf257b6f8), at 0xfb0058c0
  [27] 0xfb0002d0(0xf257b818, 0xf257bad8, 0xa, 0xf6c1f110, 0xfb0126c0, 0xf257b95c), at 0xfb0002d0
  [28] JavaCalls::call_helper(0xf6c1f110, 0xf257bad8, 0xf6c1f110, 0x164000, 0x1, 0xfb000240), at 0xfd9c849c
  [29] JavaCalls::call_special(0xf257bad0, 0x1646d4, 0xf257bab0, 0xf257baac, 0xf257baa8, 0x164004), at 0xfd9
  [30] SystemDictionary::load_instance_class(0xf257bcc0, 0xf257bcbc, 0xf257bcb8, 0x164000, 0xfeea6d70, 0xf25
  [31] SystemDictionary::resolve_instance_class_or_null(0x34b, 0x34b, 0xf257be90, 0xf257be8c, 0xaffd91, 0xaf
  [32] SystemDictionary::resolve_or_null(0xf257bf44, 0xf257bf40, 0xf257bf3c, 0xf257bf38, 0x164000, 0xf71c932
  [33] SystemDictionary::resolve_or_fail(0xf257bff4, 0xf257bff0, 0xf257bfec, 0xf257bfe8, 0x1, 0x164000), at
  [34] find_class_from_class_loader(0x164104, 0xf257c07c, 0x1, 0xf257bff4, 0xf257c074, 0x1), at 0xfdbcf778
  [35] jni_FindClass(0x164104, 0xfd01fb40, 0x164000, 0xf71f1b70, 0xfd95d56c, 0xfee69108), at 0xfd9ff664
  [36] ckSlotInfoPtrToJSlotInfo(env = ???, ckpSlotInfo = ???) (optimized), at 0xfd0181b8 (line ~401) in "p11
  [37] Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetSlotInfo(env = ???, obj
= ???, jSlotID = ???) (optimized), at 0xfd018164 (line ~380) in
"p11_general.c"
  [38] 0xfb015a78(0x20000000, 0xf257c3dc, 0xf257c350, 0xffffff80, 0x0, 0x0), at 0xfb015a78
  [39] 0xfb015938(0xf3223a10, 0x8, 0x0, 0xc, 0x0, 0xf257c368), at 0xfb015938
  [40] 0xfb0058c0(0xf31ccb90, 0x8, 0x0, 0xfb02bda4, 0x0, 0xf257c438), at 0xfb0058c0
  [41] 0xfb005a30(0x1e, 0xfeeabeb4, 0x0, 0xfb02c180, 0xf257c8bd, 0xf257c4b8), at 0xfb005a30
  [42] 0xfb0002d0(0xf257c5d8, 0xf257c7d8, 0xa, 0xf71ca4b8, 0xfb012260, 0xf257c860), at 0xfb0002d0
  [43] JavaCalls::call_helper(0xf71ca4b8, 0xf257c7d8, 0xf71ca4b8, 0x164000, 0x0, 0xfb000240), at 0xfd9c849c
  [44] Reflection::invoke(0xf257cb64, 0x4, 0x164688, 0x164004, 0xfec24f60, 0x0), at 0xfe13006c
  [45] Reflection::invoke_constructor(0xf257cc84, 0x164684, 0x16467c, 0xf257cb50, 0x164000, 0xfeea6d70), at
  [46] JVM_NewInstanceFromConstructor(0x164104, 0x164000, 0xf6cd8628, 0xfeec3ea0, 0x1, 0x3dc00), at 0xfdbe1d
  [47] Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0(env =
???, unused = ???, c = ???, args = ???) (optimized), at 0xfd1d4e4c (line
~21) in "NativeAccessors.c"
  [48] 0xfb015a78(0x10a, 0xf257ce94, 0xf257ce10, 0xffffff80, 0x0, 0x0), at 0xfb015a78
  [49] 0xfb015938(0xf31c6f70, 0xb8, 0x0, 0x8, 0xf31d7188, 0xf257ce28), at 0xfb015938
  [50] 0xfb0058c0(0xf31c6f80, 0xb6, 0x0, 0xfb02c500, 0x15, 0xf257ceb8), at 0xfb0058c0
  [51] 0xfb0058c0(0xf31c6f98, 0xf6c4f9e0, 0x0, 0xfb02bcc0, 0x0, 0xf257cf38), at 0xfb0058c0
  [52] 0xfb005de0(0xf31c6f30, 0x8, 0x0, 0xfb02c880, 0x0, 0xf257cfc8), at 0xfb005de0
  [53] 0xfb0058c0(0x1d, 0xfeeabeb4, 0x0, 0xfb02be70, 0xf257d39d, 0xf257d060), at 0xfb0058c0
  [54] 0xfb0002d0(0xf257d178, 0xf257d3c8, 0xa, 0xf70abb48, 0xfb012260, 0xf257d33c), at 0xfb0002d0
  [55] JavaCalls::call_helper(0xf70abb48, 0xf257d3c8, 0xf70abb48, 0x164000, 0x1, 0xfb000240), at 0xfd9c849c
  [56] JVM_DoPrivileged(0x164104, 0xf257d358, 0x1bbcc, 0x164670, 0x164000, 0x164674), at 0xfdb4872c
  [57]
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2(env
= ???, cls = ???, action = ???) (optimized), at 0xfd1cac4c (line ~27) in
"AccessController.c"
  [58] 0xfb015a78(0x109, 0xf257d8b4, 0xf257d838, 0xffffff80, 0x0, 0x0), at 0xfb015a78
  [59] 0xfb015938(0xf30ee2e0, 0xb8, 0x0, 0x4, 0x0, 0xf257d850), at 0xfb015938
  [60] 0xfb0058c0(0xf30eca68, 0x8, 0x0, 0xfb02c180, 0x0, 0xf257d8d8), at 0xfb0058c0
  [61] 0xfb0058c0(0xf30eca68, 0x8, 0x0, 0xfb02c180, 0x0, 0xf257d970), at 0xfb0058c0
  [62] 0xfb0058c0(0xf30ec7b8, 0x8, 0x0, 0xfb02bcc0, 0x0, 0xf257d9f8), at 0xfb0058c0
  [63] 0xfb0058c0(0xf30ec7b8, 0x8, 0x0, 0xfb02be10, 0x0, 0xf257da88), at 0xfb0058c0
  [64] 0xfb0058c0(0x0, 0x8, 0x0, 0xfb02bcc0, 0x0, 0xf257db28), at 0xfb0058c0
  [65] 0xfb0058c0(0x0, 0x8, 0x0, 0xfb02c500, 0x0, 0xf257dbb0), at 0xfb0058c0
  [66] 0xfb0058c0(0x0, 0x8, 0x0, 0xfb02c500, 0x0, 0xf257dc40), at 0xfb0058c0
  [67] 0xfb0058c0(0x0, 0x8, 0x0, 0xfb02c6b0, 0x0, 0xf257dd08), at 0xfb0058c0
  [68] 0xfb005950(0x0, 0x8, 0x0, 0xfb02c500, 0x0, 0xf257dd88), at 0xfb005950
  [69] 0xfb005950(0x1c, 0xfeeabeb4, 0x0, 0xfb02c6b0, 0xf257e145, 0xf257de08), at 0xfb005950
  [70] 0xfb0002d0(0xf257df20, 0xf257e170, 0xa, 0xf7080148, 0xfb012260, 0xf257e0e4), at 0xfb0002d0
  [71] JavaCalls::call_helper(0xf7080148, 0xf257e170, 0xf7080148, 0x164000, 0x1, 0xfb000240), at 0xfd9c849c
  [72] JVM_DoPrivileged(0x164104, 0xf257e100, 0x1bbcc, 0x164664, 0x164000, 0x164668), at 0xfdb4872c
  [73]
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2(env
= ???, cls = ???, action = ???) (optimized), at 0xfd1cac4c (line ~27) in
"AccessController.c"
  [74] 0xfb015a78(0x109, 0xf257e660, 0xf257e5e0, 0xffffff80, 0x0, 0x0), at 0xfb015a78
  [75] 0xfb015938(0xf30e8438, 0xb8, 0x0, 0x4, 0x0, 0xf257e5f8), at 0xfb015938
  [76] 0xfb0058c0(0xf30d4318, 0x8, 0x0, 0xfb02c180, 0x0, 0xf257e680), at 0xfb0058c0
  [77] 0xfb005950(0xf30d4318, 0x8, 0x0, 0xfb02bcc0, 0x0, 0xf257e710), at 0xfb005950
  [78] 0xfb005a30(0xf30d2fd8, 0x8, 0x0, 0xfb02bcc0, 0x0, 0xf257e790), at 0xfb005a30
  [79] 0xfb005a30(0xf30d2fd8, 0x8, 0x0, 0xfb02bcc0, 0x0, 0xf257e818), at 0xfb005a30
  [80] 0xfb005a30(0xf30d2fd8, 0x8, 0x0, 0xfb02c2d0, 0x0, 0xf257e8a0), at 0xfb005a30
  [81] 0xfb005a30(0xf30d2fd8, 0x8, 0x0, 0xfb02c2d0, 0x0, 0xf257e930), at 0xfb005a30
  [82] 0xfb005a30(0xf30d2fd8, 0x8, 0x0, 0xfb02c2d0, 0x0, 0xf257e9d8), at 0xfb005a30
  [83] 0xfb005a30(0xf30d2fd8, 0x8, 0x0, 0xfb02c2d0, 0x0, 0xf257ea60), at 0xfb005a30
  [84] 0xfb005a30(0x0, 0x8, 0x0, 0xfb02bcc0, 0x0, 0xf257eae8), at 0xfb005a30
  [85] 0xfb0058c0(0x0, 0x8, 0x0, 0xfb02c500, 0x0, 0xf257eb68), at 0xfb0058c0
  [86] 0xfb0058c0(0x1d, 0xfeeabeb4, 0x0, 0xfb02c500, 0xf257f015, 0xf257ec18), at 0xfb0058c0
  [87] 0xfb0002d0(0xf257ed30, 0xf257ef30, 0xa, 0xf6ec4e28, 0xfb012260, 0xf257efb4), at 0xfb0002d0
  [88] JavaCalls::call_helper(0xf6ec4e28, 0xf257ef30, 0xf6ec4e28, 0x164000, 0x1, 0xfb000240), at 0xfd9c849c
  [89] Reflection::invoke(0xf257f39c, 0x1, 0x16465c, 0x164004, 0xfec24f60, 0x0), at 0xfe13006c
  [90] Reflection::invoke_method(0xf257f39c, 0x164650, 0xf257f394, 0xf257f390, 0x164000, 0x164648), at 0xfe1
  [91] JVM_InvokeMethod(0x164104, 0x164000, 0x164640, 0x3dc68, 0x164648, 0x164644), at 0xfdbe09fc
  [92] Java_sun_reflect_NativeMethodAccessorImpl_invoke0(env = ???, unused =
???, m = ???, obj = ???, args = ???) (optimized), at 0xfd1d4e30 (line ~15)
in "NativeAccessors.c"
  [93] 0xfb015a78(0x10a, 0xf257f5cc, 0xf257f540, 0xffffff80, 0xfe495d53, 0x0), at 0xfb015a78
  [94] 0xfb015938(0xf30d0920, 0xb8, 0x0, 0xc, 0xf30dd438, 0xf257f558), at 0xfb015938
  [95] 0xfb0058c0(0xf30d0930, 0xb6, 0x0, 0xfb02c500, 0x0, 0xf257f5f0), at 0xfb0058c0
  [96] 0xfb0058c0(0xf30d0948, 0xf6c4f2d8, 0x0, 0xfb02bcc0, 0x3d865, 0xf257f670), at 0xfb0058c0
  [97] 0xfb005de0(0xf30d0320, 0xb6, 0x0, 0xfb02c880, 0x19a780, 0xf257f700), at 0xfb005de0
  [98] 0xfb0058c0(0xf41ff468, 0xb6, 0x0, 0xfb02bcc0, 0xf30dd438, 0xf257f788), at 0xfb0058c0
  [99] 0xfb0058c0(0xf41ff468, 0xf6dca490, 0x0, 0xfb02bcc0, 0xf6dca490, 0xf257f820), at 0xfb0058c0
  [100] 0xfb005de0(0x1c, 0xfeeabeb4, 0x0, 0xfb02c880, 0xf257fc09, 0xf257f8d8), at 0xfb005de0

Looking at the code in p11_general.c:
   267  jobject ckInfoPtrToJInfo(JNIEnv *env, const CK_INFO_PTR ckpInfo)
   268  {
   269      jclass jInfoClass;
   270      jobject jInfoObject;
   271      jcharArray jTempCharArray;
   272      jfieldID jFieldID;
   273      jobject jTempVersion;
   274
   275      /* load CK_INFO class */
   276      jInfoClass = (*env)->FindClass(env, CLASS_INFO);
   277      assert(jInfoClass != 0);
   278      /* create new CK_INFO object */
   279      jInfoObject = (*env)->AllocObject(env, jInfoClass);
   280      assert(jInfoObject != 0);
   281

looks like the error is ignored in product version.

Looking at the j2se_1.6.0/src/share/native/java/util/zip/ZipFile.c:
   199      if (len == -1) {
   200      if (msg != 0) {
   201          ThrowZipException(env, msg);
   202      } else {
   ...

it looks like the exception is thrown but is not properly handled later.

To reproduce the failure:
1.  login on solaris machine
2.  cp -fr /home/ep155969/work/FaultInjection/read_2 YOUR_LOCAL_DIR
3.  cd YOUR_LOCAL_DIR
4.  make
5.  bash inject_faults.sh JAVA_PATH 1934 1934

The failure results will be stored in ./results dir.
The similar failures:

Assertion failed: jVersionClass != 0, file
../../../../src/share/native/sun/security/pkcs11/wrapper/p11_convert.c, line 135
INJECT_FAULT_AT=1936
INJECT_FAULT_AT=1937

Assertion failed: jSlotInfoClass != 0, file
../../../../src/share/native/sun/security/pkcs11/wrapper/p11_general.c, line 402
INJECT_FAULT_AT=1938
INJECT_FAULT_AT=1939

Assertion failed: jTokenInfoClass != 0, file
../../../../src/share/native/sun/security/pkcs11/wrapper/p11_general.c, line 488
INJECT_FAULT_AT=1957
INJECT_FAULT_AT=1958

Comments
JNI pkcs11 code was hardened up in this area for JDK-6812738 fix. This issue shouldn't happen any more as a result. Closing.
13-10-2015