[packages/icedtea7] - rel 9; fixes thread safety issues in sunec

arekm arekm at pld-linux.org
Wed Dec 10 08:42:43 CET 2014


commit 5b5b0838a57a84ff00ecb7bec7d7e35720396f7d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Dec 10 08:42:33 2014 +0100

    - rel 9; fixes thread safety issues in sunec

 icedtea7-bug-2135.patch | 202 ++++++++++++++++++++++++++++++++++++++++++++++++
 icedtea7.spec           |   4 +-
 2 files changed, 205 insertions(+), 1 deletion(-)
---
diff --git a/icedtea7.spec b/icedtea7.spec
index e4e8eb2..aed303b 100644
--- a/icedtea7.spec
+++ b/icedtea7.spec
@@ -29,7 +29,7 @@ Summary:	OpenJDK and GNU Classpath code
 Summary(pl.UTF-8):	Kod OpenJDK i GNU Classpath
 Name:		icedtea7
 Version:	2.5.3
-Release:	8
+Release:	9
 License:	GPL v2
 Group:		Development/Languages/Java
 Source0:	http://icedtea.wildebeest.org/download/source/icedtea-%{version}.tar.gz
@@ -54,6 +54,7 @@ Source10:	make-cacerts.sh
 Patch100:	%{name}-libpath.patch
 Patch101:	%{name}-giflib.patch
 Patch102:	icedtea7-bug-2123.patch
+Patch103:	icedtea7-bug-2135.patch
 URL:		http://icedtea.classpath.org/wiki/Main_Page
 BuildRequires:	alsa-lib-devel
 BuildRequires:	ant
@@ -411,6 +412,7 @@ install -d pld-patches
 cp -p %{PATCH100} pld-patches
 cp -p %{PATCH101} pld-patches
 cp -p %{PATCH102} pld-patches
+cp -p %{PATCH103} pld-patches
 
 # let the build system extract the sources where it wants them
 install -d drops
diff --git a/icedtea7-bug-2135.patch b/icedtea7-bug-2135.patch
new file mode 100644
index 0000000..f5940cf
--- /dev/null
+++ b/icedtea7-bug-2135.patch
@@ -0,0 +1,202 @@
+
+# HG changeset patch
+# User andrew
+# Date 1418148279 0
+# Node ID 610eb1b5fd0beb4c4cf8918f418eeddf9ff58121
+# Parent  9ed0bdd5de2a5ebfa5fedb9442ee630b8d63ef0e
+PR2135: Race condition in SunEC provider with system NSS
+
+diff -r 9ed0bdd5de2a -r 610eb1b5fd0b make/sun/security/ec/Makefile
+--- openjdk/jdk/make/sun/security/ec/Makefile	Fri Dec 05 09:52:04 2014 +0000
++++ openjdk/jdk/make/sun/security/ec/Makefile	Tue Dec 09 18:04:39 2014 +0000
+@@ -158,7 +158,8 @@
+   FILES_export = \
+       $(PKGDIR)/ECDHKeyAgreement.java \
+       $(PKGDIR)/ECDSASignature.java \
+-      $(PKGDIR)/ECKeyPairGenerator.java
++      $(PKGDIR)/ECKeyPairGenerator.java \
++      $(PKGDIR)/SunEC.java
+ 
+   JAVAHFLAGS = -bootclasspath \
+     "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
+diff -r 9ed0bdd5de2a -r 610eb1b5fd0b make/sun/security/ec/mapfile-vers
+--- openjdk/jdk/make/sun/security/ec/mapfile-vers	Fri Dec 05 09:52:04 2014 +0000
++++ openjdk/jdk/make/sun/security/ec/mapfile-vers	Tue Dec 09 18:04:39 2014 +0000
+@@ -31,6 +31,8 @@
+ 		Java_sun_security_ec_ECDSASignature_signDigest;
+ 		Java_sun_security_ec_ECDSASignature_verifySignedDigest;
+ 		Java_sun_security_ec_ECDHKeyAgreement_deriveKey;
++		Java_sun_security_ec_SunEC_initialize;
++		Java_sun_security_ec_SunEC_cleanup;
+         local:
+                 *;
+ };
+diff -r 9ed0bdd5de2a -r 610eb1b5fd0b src/share/classes/sun/security/ec/SunEC.java
+--- openjdk/jdk/src/share/classes/sun/security/ec/SunEC.java	Fri Dec 05 09:52:04 2014 +0000
++++ openjdk/jdk/src/share/classes/sun/security/ec/SunEC.java	Tue Dec 09 18:04:39 2014 +0000
+@@ -58,6 +58,7 @@
+             AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                 public Void run() {
+                     System.loadLibrary("sunec"); // check for native library
++                    initialize();
+                     return null;
+                 }
+             });
+@@ -81,4 +82,22 @@
+         }
+     }
+ 
++    /**
++     * Cleanup native resources during finalisation.
++     */
++    @Override
++    protected void finalize() {
++        cleanup();
++    }
++
++    /**
++     * Initialize the native code.
++     */
++    private static native void initialize();
++
++    /**
++     * Cleanup in the native layer.
++     */
++    private static native void cleanup();
++
+ }
+diff -r 9ed0bdd5de2a -r 610eb1b5fd0b src/share/native/sun/security/ec/ECC_JNI.cpp
+--- openjdk/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp	Fri Dec 05 09:52:04 2014 +0000
++++ openjdk/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp	Tue Dec 09 18:04:39 2014 +0000
+@@ -116,13 +116,6 @@
+     params_item.data =
+         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+ 
+-#ifdef SYSTEM_NSS
+-    if (SECOID_Init() != SECSuccess) {
+-	ThrowException(env, INTERNAL_ERROR);
+-	goto cleanup;
+-    }
+-#endif
+-
+     // Fill a new ECParams using the supplied OID
+     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
+         /* bad curve OID */
+@@ -178,11 +171,6 @@
+         if (params_item.data) {
+             env->ReleaseByteArrayElements(encodedParams,
+                 (jbyte *) params_item.data, JNI_ABORT);
+-#ifdef SYSTEM_NSS
+-	    if (SECOID_Shutdown() != SECSuccess) {
+-		ThrowException(env, INTERNAL_ERROR);
+-	    }
+-#endif
+         }
+ 
+         if (ecparams) {
+@@ -246,13 +234,6 @@
+     params_item.data =
+         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+ 
+-#ifdef SYSTEM_NSS
+-    if (SECOID_Init() != SECSuccess) {
+-	ThrowException(env, INTERNAL_ERROR);
+-	goto cleanup;
+-    }
+-#endif
+-
+     // Fill a new ECParams using the supplied OID
+     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
+         /* bad curve OID */
+@@ -294,11 +275,6 @@
+         if (params_item.data) {
+             env->ReleaseByteArrayElements(encodedParams,
+                 (jbyte *) params_item.data, JNI_ABORT);
+-#ifdef SYSTEM_NSS
+-	    if (SECOID_Shutdown() != SECSuccess) {
+-		ThrowException(env, INTERNAL_ERROR);
+-	    }
+-#endif
+         }
+ 
+         if (privKey.privateValue.data) {
+@@ -367,13 +343,6 @@
+     params_item.data =
+         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+ 
+-#ifdef SYSTEM_NSS
+-    if (SECOID_Init() != SECSuccess) {
+-	ThrowException(env, INTERNAL_ERROR);
+-	goto cleanup;
+-    }
+-#endif
+-
+     // Fill a new ECParams using the supplied OID
+     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
+         /* bad curve OID */
+@@ -397,11 +366,6 @@
+         if (params_item.data) {
+             env->ReleaseByteArrayElements(encodedParams,
+                 (jbyte *) params_item.data, JNI_ABORT);
+-#ifdef SYSTEM_NSS
+-	    if (SECOID_Shutdown() != SECSuccess) {
+-		ThrowException(env, INTERNAL_ERROR);
+-	    }
+-#endif
+ 	}
+ 
+         if (pubKey.publicValue.data)
+@@ -451,13 +415,6 @@
+     params_item.data =
+         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+ 
+-#ifdef SYSTEM_NSS
+-    if (SECOID_Init() != SECSuccess) {
+-	ThrowException(env, INTERNAL_ERROR);
+-	goto cleanup;
+-    }
+-#endif
+-
+     // Fill a new ECParams using the supplied OID
+     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
+         /* bad curve OID */
+@@ -499,11 +456,6 @@
+         if (params_item.data) {
+             env->ReleaseByteArrayElements(encodedParams,
+                 (jbyte *) params_item.data, JNI_ABORT);
+-#ifdef SYSTEM_NSS
+-	    if (SECOID_Shutdown() != SECSuccess) {
+-		ThrowException(env, INTERNAL_ERROR);
+-	    }
+-#endif
+ 	}
+ 
+         if (ecparams)
+@@ -513,4 +465,26 @@
+     return jSecret;
+ }
+ 
++JNIEXPORT void
++JNICALL Java_sun_security_ec_SunEC_initialize
++  (JNIEnv *env, jclass UNUSED(clazz))
++{
++#ifdef SYSTEM_NSS
++    if (SECOID_Init() != SECSuccess) {
++	ThrowException(env, INTERNAL_ERROR);
++    }
++#endif
++}
++
++JNIEXPORT void
++JNICALL Java_sun_security_ec_SunEC_cleanup
++  (JNIEnv *env, jclass UNUSED(clazz))
++{
++#ifdef SYSTEM_NSS
++    if (SECOID_Shutdown() != SECSuccess) {
++	ThrowException(env, INTERNAL_ERROR);
++    }
++#endif
++}
++
+ } /* extern "C" */
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/icedtea7.git/commitdiff/5b5b0838a57a84ff00ecb7bec7d7e35720396f7d



More information about the pld-cvs-commit mailing list