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

Rich Salz rsalz at openssl.org
Tue Mar 6 18:24:06 UTC 2018


The branch OpenSSL_1_1_0-stable has been updated
       via  4044ebfe2481c240cb37cfcb0e6176fe79394db4 (commit)
      from  9d927ddf1c74c293db4ada85e925b9620adb1436 (commit)


- Log -----------------------------------------------------------------
commit 4044ebfe2481c240cb37cfcb0e6176fe79394db4
Author: knekritz <knekritz at fb.com>
Date:   Tue Mar 6 13:21:49 2018 -0500

    Avoid unconditional store in CRYPTO_malloc.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5372)
    (cherry picked from commit 41aede863b76202347c2d5e2c2666428084f9203)

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

Summary of changes:
 crypto/mem.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/crypto/mem.c b/crypto/mem.c
index bc35132..7ec7a80 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -78,7 +78,14 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
     if (num == 0)
         return NULL;
 
-    allow_customize = 0;
+    if (allow_customize) {
+        /*
+         * Disallow customization after the first allocation. We only set this
+         * if necessary to avoid a store to the same cache line on every
+         * allocation.
+         */
+        allow_customize = 0;
+    }
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
     if (call_malloc_debug) {
         CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);
@@ -117,7 +124,6 @@ void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
         return NULL;
     }
 
-    allow_customize = 0;
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
     if (call_malloc_debug) {
         void *ret;


More information about the openssl-commits mailing list