Skip to content

TSan data race in mimalloc metadata allocator during BLS worker thread execution #7558

Closed

Description

@PastaPastaPasta

A ThreadSanitizer data race occurred during CI run 31211790533 (job 92978916567) in test_dash (bls_tests / bls_verify_contribution_shares_honest_tests).

Stack Trace

WARNING: ThreadSanitizer: data race (pid=52099)
  Write of size 8 at 0xff6fa7424400 by thread T7:
    #0 memcpy
    #1 _mi_heap_init (test_dash+0x1e79fa0)
    #2 operator() src/bls/bls_worker.cpp:103:37

  Previous write of size 8 at 0xff6fa7424400 by thread T5:
    #0 memset
    #1 _mi_meta_zalloc (test_dash+0x1ebf378)
    #2 operator() src/bls/bls_worker.cpp:91:41

Description

In src/dashbls/depends/mimalloc/src/arena-meta.c, _mi_meta_zalloc and _mi_meta_free use non-atomic _mi_memzero_aligned (memset) to zero out metadata blocks (mi_heap_t). When a block is freed or allocated by thread T5, it updates the atomic free bitmap blocks_free. Thread T7 immediately claims that metadata block via atomic operations and begins calling _mi_heap_init (memcpy) on the same memory address.

Because non-atomic memset in T5 and non-atomic memcpy in T7 target the exact same address across thread boundaries without TSan acquire-release synchronization annotations in mimalloc's custom metadata allocator, ThreadSanitizer reports a data race.

cc @kwvg

Activity

  1. added a commit that references this issue on Aug 7, 2026
    4dfe036
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions