[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Matt Caswell matt at openssl.org
Mon Nov 14 12:03:16 UTC 2016


The branch OpenSSL_1_1_0-stable has been updated
       via  c028052c4cfc39dc99f735f1743b18867547129f (commit)
      from  edc18749bd5dfb7e12513d3978f78f9b56104fd6 (commit)


- Log -----------------------------------------------------------------
commit c028052c4cfc39dc99f735f1743b18867547129f
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Nov 14 12:00:45 2016 +0000

    Revert "Fixed deadlock in CRYPTO_THREAD_run_once for Windows"
    
    This reverts commit edc18749bd5dfb7e12513d3978f78f9b56104fd6.
    
    The proposed fix is incorrect. It marks the "run_once" code as having
    finished before it has. The intended semantics of run_once is that no
    threads should proceed until the code has run exactly once. With this
    change the "second" thread will think the run_once code has already been
    run and will continue, even though it is still in progress. This could
    result in a crash or other incorrect behaviour.
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/threads_win.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index 5347c9e..4e0de90 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -78,8 +78,8 @@ int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
     do {
         result = InterlockedCompareExchange(lock, ONCE_ININIT, ONCE_UNINITED);
         if (result == ONCE_UNINITED) {
-            *lock = ONCE_DONE;
             init();
+            *lock = ONCE_DONE;
             return 1;
         }
     } while (result == ONCE_ININIT);


More information about the openssl-commits mailing list