From 8aa9cf7e655ae1e41f283fbf16dcc810970058a0 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 15 Nov 2016 00:58:51 +0100 Subject: [PATCH] Add a warning stipulating how things should be coded in ossl_init_base Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/1922) --- crypto/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crypto/init.c b/crypto/init.c index 01619bc129..3f91119407 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -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) -- 2.25.1