Commit dce4a3743f for openssl.org

commit dce4a3743fa9cd1348d0fba3686e8778224efd35
Author: insightlabs38-pixel <insightlabs38@gmail.com>
Date:   Tue Oct 6 16:47:14 2026 -0400

    crypto/mem.c: suppress benign TSan race in allocator initialization

    The allow_customize flag is intentionally accessed concurrently
    when multiple threads perform the first allocation.  Annotate the flag
    as a benign race, rather than adding atomic operations
    to the allocation path.

    Resolves: https://github.com/openssl/openssl/issues/33111
    CLA: trivial
    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Merge-date: Sun Oct 11 20:48:39 2026
    Merged-from: https://github.com/openssl/openssl/pull/33156

diff --git a/crypto/mem.c b/crypto/mem.c
index 2bdbc2d11d..acf60ec3fe 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -8,6 +8,7 @@
  */

 #include "internal/e_os.h"
+#include "internal/threads_common.h"
 #include "internal/cryptlib.h"
 #include "internal/mem_alloc_utils.h"
 #include "crypto/cryptlib.h"
@@ -219,6 +220,8 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
         return NULL;

     if (allow_customize) {
+        TSAN_BENIGN(&allow_customize,
+            "allow_customize is intentionally racy");
         /*
          * Disallow customization after the first allocation. We only set this
          * if necessary to avoid a store to the same cache line on every