]> granicus.if.org Git - openssl/commitdiff
Add a warning stipulating how things should be coded in ossl_init_base
authorRichard Levitte <levitte@openssl.org>
Mon, 14 Nov 2016 23:58:51 +0000 (00:58 +0100)
committerRichard Levitte <richard@levitte.org>
Tue, 15 Nov 2016 00:28:35 +0000 (01:28 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1922)
(cherry picked from commit 8aa9cf7e655ae1e41f283fbf16dcc810970058a0)

crypto/init.c

index a5b6e5aff49302af3356192287db2f73025cb94d..c730e38767fdb0261344291a2cfd6302b69f32e3 100644 (file)
@@ -79,6 +79,13 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base)
     if ((init_lock = CRYPTO_THREAD_lock_new()) == NULL)
         return 0;
     OPENSSL_cpuid_setup();
+
+    /*
+     * BIG FAT WARNING!
+     * Everything needed to be initialized in this function before threads
+     * come along MUST happen before base_inited is set to 1, or we will
+     * see race conditions.
+     */
     base_inited = 1;
 
 #if !defined(OPENSSL_NO_DSO) && !defined(OPENSSL_USE_NODELETE)