llvm-project
b571b4db - [lldb] Fix data race in UnwindTable::Initialize (#197816)

Commit
14 hours ago
[lldb] Fix data race in UnwindTable::Initialize (#197816) UnwindTable::Initialize uses double-checked locking (DCL) against m_scanned_all_unwind_sources, but the flag was a plain bool. The fast-path read outside the mutex is unsynchronized with the write inside the mutex, so concurrent first-time callers can observe partially initialized state. Make m_scanned_all_unwind_sources std::atomic<bool>. The default memory ordering (seq_cst) is sufficient for the DCL pattern used here. Found by ThreadSanitizer as part of #197792.
Author
Parents
Loading