Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8232974

SIGSEGV with brainpool curves on Solaris with SunPKCS11

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 14
    • Fix Version/s: tbd
    • Component/s: security-libs
    • Labels:
      None

      Description

      Seeing this issue on new versions of Solaris. 11.4 in this case. Test case:

      ==
      import java.security.*;
      import java.security.spec.*;


      public class Curves {

          public static void main(String[] args) throws Exception {
              KeyPair kp = null;
              String curve = "brainpoolP160r1";
              Provider p = Security.getProvider("SunPKCS11-Solaris");
              ECParameterSpec e = getECParameterSpec(p, curve);
              System.out.print("\t "+ curve + ": ");

              try {
                  KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
                  kpg.initialize(e);
                  kp = kpg.generateKeyPair();
                  System.out.println("Supported");
              } catch (ProviderException ex) {
                  System.out.println("Unsupported: PKCS11: " +
                           ex.getCause().getMessage());
              } catch (InvalidAlgorithmParameterException ex) {
                  System.out.println("Unsupported: Key Length: " +
                           ex.getMessage());
              }
          }

          private static ECParameterSpec getECParameterSpec(Provider p, String name)
                  throws Exception {

              AlgorithmParameters parameters =
                  AlgorithmParameters.getInstance("EC", p);

              parameters.init(new ECGenParameterSpec(name));

              return parameters.getParameterSpec(ECParameterSpec.class);
          }
      }
      ==

      The hs pid files don't often contain great information but here's one that seemed to indicate where the stack was:

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0xffffffff712383e8, pid=14992, tid=2
      #
      # JRE version: Java(TM) SE Runtime Environment (14.0+19) (build 14-ea+19-824)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (14-ea+19-824, mixed mode, sharing, tiered, compressed oops, g1 gc, solaris-sparc)
      # Problematic frame:
      # C [pkcs11_softtoken.so.1+0x383e8] cleanup_key_attr_list+0x30
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      # The crash happened outside the Java Virtual Machine in native code.
      # See problematic frame for where to report the bug.
      #

      --------------- S U M M A R Y ------------

      Command Line: Curves

      Host: Sparcv9 64 bit 2848 MHz, 64 cores, 127G, Oracle Solaris 11.4 SPARC
      Time: Thu Oct 24 14:02:06 2019 IST elapsed time: 0 seconds (0d 0h 0m 0s)

      --------------- T H R E A D ---------------

      Current thread (0x0000000100123000): JavaThread "main" [_thread_in_native, id=2, stack(0xffffffff7f1f0000,0xffffffff7f2f0000)]

      Stack: [0xffffffff7f1f0000,0xffffffff7f2f0000], sp=0xffffffff7f2eedd0, free space=1019k
      Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C [pkcs11_softtoken.so.1+0x383e8] cleanup_key_attr_list+0x30
      C [pkcs11_softtoken.so.1+0x38e84] ucrypto_ec_genkey_pair+0x27c
      C [pkcs11_softtoken.so.1+0x35b64] crypto_genkey_pair+0x1a4
      C [pkcs11_softtoken.so.1+0x1448c] C_GenerateKeyPair+0x12c
      C [libpkcs11.so.1+0x193c8] C_GenerateKeyPair+0x1a0
      C [libj2pkcs11.so+0xc638] Java_sun_security_pkcs11_wrapper_PKCS11_C_1GenerateKeyPair+0x138
      j sun.security.pkcs11.wrapper.PKCS11.C_GenerateKeyPair(JLsun/security/pkcs11/wrapper/CK_MECHANISM;[Lsun/security/pkcs11/wrapper/CK_ATTRIBUTE;[Lsun/security/pkcs11/wrapper/CK_ATTRIBUTE;)[J+0 jdk.crypto.cryptoki@14-ea
      j sun.security.pkcs11.wrapper.PKCS11.C_GenerateKeyPair(JLsun/security/pkcs11/wrapper/CK_MECHANISM;[Lsun/security/pkcs11/wrapper/CK_ATTRIBUTE;[Lsun/security/pkcs11/wrapper/CK_ATTRIBUTE;)[J+0 jdk.crypto.cryptoki@14-ea
      j sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair()Ljava/security/KeyPair;+505 jdk.crypto.cryptoki@14-ea
      j java.security.KeyPairGenerator$Delegate.generateKeyPair()Ljava/security/KeyPair;+11 java.base@14-ea
      j Curves.main([Ljava/lang/String;)V+133
      v ~StubRoutines::call_stub
      V [libjvm.so+0xf570bc] void JavaCalls::call_helper(JavaValue*,const methodHandle&,JavaCallArguments*,Thread*)+0x23c
      V [libjvm.so+0xfdb810] void jni_invoke_static(JNIEnv_*,JavaValue*,_jobject*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x370
      V [libjvm.so+0xfef550] jni_CallStaticVoidMethod+0x1c0
      C [libjli.so+0x86ac] JavaMain+0x99c
      C [libjli.so+0x122cc] ThreadJavaMain+0xc

      Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
      j sun.security.pkcs11.wrapper.PKCS11.C_GenerateKeyPair(JLsun/security/pkcs11/wrapper/CK_MECHANISM;[Lsun/security/pkcs11/wrapper/CK_ATTRIBUTE;[Lsun/security/pkcs11/wrapper/CK_ATTRIBUTE;)[J+0 jdk.crypto.cryptoki@14-ea
      j sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair()Ljava/security/KeyPair;+505 jdk.crypto.cryptoki@14-ea
      j java.security.KeyPairGenerator$Delegate.generateKeyPair()Ljava/security/KeyPair;+11 java.base@14-ea
      j Curves.main([Ljava/lang/String;)V+133
      v ~StubRoutines::call_stub



      ====

      --------------- S Y S T E M ---------------

      OS: Oracle Solaris 11.4 SPARC
        Copyright (c) 1983, 2018, Oracle and/or its affiliates. All rights reserved.
                                 Assembled 19 December 2018

      uname:SunOS 5.11 11.4.5.3.0 sun4v
        (T2 libthread)
      rlimit: STACK 8192k, CORE infinity, NOFILE 65536, AS infinity, DATA infinity, FSIZE infinity
      load average:0.30 0.22 0.22

      CPU:total 64 (initial active 64) v9, popc, vis1, vis2, blk_init, fmaf, hpc, ima, aes, des, kas, cam, md5, sha1, sha256, sha512, mpmul, mont, pause, cbcond, crc32c, vis3b, vis3c, *idiv, *rdpc, *bis, *ld, *ind_br, *blk_zeroing

      Memory: 8k page, physical 133693440k(29049024k free)

      vm_info: Java HotSpot(TM) 64-Bit Server VM (14-ea+19-824) for solaris-sparc JRE (14-ea+19-824), built on Oct 16 2019 20:27:05 by "mach5one" with unknown Workshop:0x5150

      END.


        Attachments

          Activity

            People

            • Assignee:
              coffeys Sean Coffey
              Reporter:
              coffeys Sean Coffey
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: