Mercurial > hg > icedtea7-forest > jdk
changeset 9256:44e58259e68b
PR3480, RH1486025: ECC and NSS JVM crash
Summary: SunEC provider can have multiple instances, leading to premature NSS shutdown
Contributed-by: Martin Balao <mbalao@redhat.com>
author | andrew |
---|---|
date | Wed, 25 Oct 2017 18:08:25 +0100 |
parents | 34de8dabb31b |
children | 686a9079ddba |
files | make/sun/security/ec/mapfile-vers src/share/classes/sun/security/ec/SunEC.java src/share/native/sun/security/ec/ECC_JNI.cpp |
diffstat | 3 files changed, 3 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/make/sun/security/ec/mapfile-vers Wed Oct 25 18:02:19 2017 +0100 +++ b/make/sun/security/ec/mapfile-vers Wed Oct 25 18:08:25 2017 +0100 @@ -32,7 +32,6 @@ 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: *; };
--- a/src/share/classes/sun/security/ec/SunEC.java Wed Oct 25 18:02:19 2017 +0100 +++ b/src/share/classes/sun/security/ec/SunEC.java Wed Oct 25 18:08:25 2017 +0100 @@ -83,21 +83,8 @@ } /** - * 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(); - }
--- a/src/share/native/sun/security/ec/ECC_JNI.cpp Wed Oct 25 18:02:19 2017 +0100 +++ b/src/share/native/sun/security/ec/ECC_JNI.cpp Wed Oct 25 18:08:25 2017 +0100 @@ -532,14 +532,12 @@ } JNIEXPORT void -JNICALL Java_sun_security_ec_SunEC_cleanup - (JNIEnv *env, jclass UNUSED(clazz)) +JNICALL JNI_OnUnload + (JavaVM *vm, void *reserved) { #ifdef SYSTEM_NSS RNG_RNGShutdown(); - if (SECOID_Shutdown() != SECSuccess) { - ThrowException(env, INTERNAL_ERROR); - } + SECOID_Shutdown(); #endif }