On Mar 17 09:11, Corinna Vinschen via RT wrote:
> Hi,
> 
> the below patch is against current CVS HEAD, but it should be applied
> to all supported branches of OpenSSL, starting with 0.9.8.
> 
> On systems running on the Windows platform, there's a DllMain function
> in crypto/cryptlib.c which always calls ERR_remove_state(0) if an
> application thread exits.  While this may be ok for native Windows
> applications, it's wrong for applications running under Cygwin, given
> that Cygwin is a POSIX environment.
> 
> Not only that compliant applications are written so that they call
> ERR_remove_state by themselves right before exiting from a thread, the
> gratuitous ERR_remove_state call in DllMain also potentially crashes
> threaded applications.
> 
> For examples see http://bugs.python.org/issue3947 and
> http://cygwin.com/ml/cygwin/2008-11/msg00341.html
> 
> The latest openssl package in the Cygwin net distribution also has this
> patch applied.

Here's the patch against latest CVS.  However, it would be nice if it
could be applied in the 0.9.8 branch as well.


Thanks,
Corinna


Index: crypto/cryptlib.c
===================================================================
RCS file: /home/cvs/cvsroot/src/openssl/crypto/cryptlib.c,v
retrieving revision 1.87
diff -u -p -r1.87 cryptlib.c
--- crypto/cryptlib.c   3 Feb 2011 23:12:01 -0000       1.87
+++ crypto/cryptlib.c   22 Mar 2011 11:02:45 -0000
@@ -208,7 +208,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, 
        case DLL_THREAD_ATTACH:
                break;
        case DLL_THREAD_DETACH:
-#ifndef OPENSSL_FIPS
+#if !defined(OPENSSL_FIPS) && !defined(__CYGWIN__)
                ERR_remove_state(0);
 #endif
                break;


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to