Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 536542 - dev-java/icedtea-7.2.5.3: "sunec" USE flag reliably induces segfaults
Summary: dev-java/icedtea-7.2.5.3: "sunec" USE flag reliably induces segfaults
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: AMD64 Linux
: Normal critical (vote)
Assignee: Java team
URL: http://icedtea.classpath.org/bugzilla...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-14 02:42 UTC by Cecil Curry
Modified: 2015-03-23 18:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,19.60 KB, application/x-info)
2015-01-14 02:43 UTC, Cecil Curry
Details
PyCharm segfault backtrace log (#1). (hs_err_pid29891.log,85.73 KB, text/plain)
2015-01-14 02:45 UTC, Cecil Curry
Details
PyCharm segfault backtrace log (#2). (hs_err_pid30073.log,95.00 KB, text/plain)
2015-01-14 02:45 UTC, Cecil Curry
Details
PyCharm segfault backtrace log (#3). (hs_err_pid30529.log,85.84 KB, text/plain)
2015-01-14 02:46 UTC, Cecil Curry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cecil Curry 2015-01-14 02:42:04 UTC
Enabling the "sunec" USE flag for dev-java/icedtea:7 reliably induces segfaults
in various formerly stable Java applications, as described at the following
upstream bug report:

http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1905

On my machine, running Java-based PyCharm (dev-util/pycharm-community) appears
to be the simplest means of reproducing such issue. On startup, simply open any 
directory containing at least one ".py" file as a new project. If this fails to
induce an immediate segfault, then selecting "File" -> "Settings" typically
does. Please find attached both "emerge --info" output and three error logs
produced by PyCharm backtracing such segfaults.

Every segfault occurs at the same "problematic frame"
PL_HashTableLookupConst+0x17 of libplds4.so+0x1ea7. Moreover, register RAX
always maps to SECOID_FindOIDTag_Util+0 in /usr/lib64/libnssutil3.so, the shared
library for Network Security Services (NSS). Even more damningly, the
SunEC-specific function sun.security.ec.ECKeyPairGenerator.generateECKeyPair()
always appears on the Java stack. Relevant logfile content is as follows:

    # JRE version: OpenJDK Runtime Environment (7.0_71-b14) (build 1.7.0_71-b14)
    # Java VM: OpenJDK 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
    # Derivative: IcedTea 2.5.3
    # Distribution: Gentoo Base System release 2.2, package Gentoo package icedtea-7.2.5.3
    # Problematic frame:
    # C  [libplds4.so+0x1ea7]  PL_HashTableLookupConst+0x17

    ...

    Register to memory mapping:

    RAX=0x000000357b615c40: SECOID_FindOIDTag_Util+0 in /usr/lib64/libnssutil3.so at 0x000000357b600000

    ...

    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  sun.security.ec.ECKeyPairGenerator.generateECKeyPair(I[B[B)[Ljava/lang/Object;+0
    j  sun.security.ec.ECKeyPairGenerator.generateKeyPair()Ljava/security/KeyPair;+55
    j  java.security.KeyPairGenerator$Delegate.generateKeyPair()Ljava/security/KeyPair;+23
    j  sun.security.ssl.ECDHCrypt.<init>(Ljava/security/spec/ECParameterSpec;Ljava/security/SecureRandom;)V+17

Either rebuilding dev-java/icedtea:7 with USE flag "sunec" disabled *OR*
employing the fix detailed by both Andrew John Hughes and Dennis Schridde at
such bugzilla report reliably corrects this issue. Of course, both approaches
disable SunEC functionality. Since such functionality appears to be
fundamentally broken (as of this bug report), this is probably a good thing. To
synopsize such fix:

1. Manually edit the system-wide file
   "/usr/lib64/icedtea7/jre/lib/security/java.security".
2. Disable the SunEC security provider. Specifically:
   # Modify this...
   security.provider.3=sun.security.ec.SunEC
   # ...to resemble this.
   #security.provider.3=sun.security.ec.SunEC
3. Renumber all security providers following the SunEC security provider so as
   to preserve consecutive ordering. The resulting lines should resemble:
   security.provider.3=com.sun.net.ssl.internal.ssl.Provider
   security.provider.4=com.sun.crypto.provider.SunJCE
   security.provider.5=sun.security.jgss.SunProvider
   security.provider.6=com.sun.security.sasl.Provider
   security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
   security.provider.8=sun.security.smartcardio.SunPCSC
   # the NSS security provider was not enabled for this build; it can be enabled
   # if NSS (libnss3) is available on the machine. The nss.cfg file may need
   # editing to reflect the location of the NSS installation.
   security.provider.9=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.cfg
4. You're done. (Yay.)

My uncredentialed recommendation would be to issue a revised ebuild ignoring and
hence effectively disabling USE flag "sunec" until resolved by upstream. A post-
installation emerge message or even Gentoo advisory might be applicable.
Happily, you know better than me.

Thanks for your tireless efforts, Gentoo developers. You're awesome. May the
bugginess be with you.

Reproducible: Always

Steps to Reproduce:
1. Run PyCharm.
2. Open project.
3. Fail horribly.
Actual Results:  
Horrible segfault. (See attached logfiles.)

Expected Results:  
No horrible segfault. (Your mileage may vary, of course.)
Comment 1 Cecil Curry 2015-01-14 02:43:57 UTC
Created attachment 393908 [details]
emerge --info
Comment 2 Cecil Curry 2015-01-14 02:45:13 UTC
Created attachment 393910 [details]
PyCharm segfault backtrace log (#1).
Comment 3 Cecil Curry 2015-01-14 02:45:42 UTC
Created attachment 393912 [details]
PyCharm segfault backtrace log (#2).
Comment 4 Cecil Curry 2015-01-14 02:46:08 UTC
Created attachment 393914 [details]
PyCharm segfault backtrace log (#3).
Comment 5 Patrice Clement gentoo-dev 2015-03-23 18:17:56 UTC
# My uncredentialed recommendation would be to issue a revised ebuild ignoring and
# hence effectively disabling USE flag "sunec" until resolved by upstream.

Sounds like a reasonable solution. Upstream bug is assigned to gnu_andrew. Until he finds out what causes the problem, we should disable it.
Comment 6 Andrew John Hughes 2015-03-23 18:24:47 UTC
Check with 2.5.4 as PR2123 was resolved there: http://bitly.com/it20504
Comment 7 Patrice Clement gentoo-dev 2015-03-23 18:35:55 UTC
Thanks Andrew for the link! Version 7.2.5.4 should fix this issue. Please reopen if not.