Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1ae1abc47aac1c3a39986bd5e4148a9eae40f009
https://github.com/WebKit/WebKit/commit/1ae1abc47aac1c3a39986bd5e4148a9eae40f009
Author: David Kilzer <[email protected]>
Date: 2026-04-20 (Mon, 20 Apr 2026)
Changed paths:
M Source/WTF/wtf/ThreadSafeWeakPtr.h
Log Message:
-----------
ThreadSanitizer reports false-positive data race on
ThreadSafeWeakPtrControlBlock members after relaxed load of control block
pointer
<https://bugs.webkit.org/show_bug.cgi?id=312726>
<rdar://175117037>
Reviewed by Geoffrey Garen.
Use `memory_order_acquire` when loading `m_bits` to obtain the
control block pointer, pairing with the `memory_order_release`
store in `controlBlock()`. Without this, TSan reports a data race
between the non-atomic initialization of control block members and
subsequent atomic operations on them (e.g., `WordLock::lock()`).
ARM64 dependency ordering and x86 total store ordering make this
benign in practice, so gate the acquire behind `TSAN_ENABLED`.
No tests since this is only needed with TSan builds.
* Source/WTF/wtf/ThreadSafeWeakPtr.h:
(WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::ref const):
(WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::deref const):
(WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::refCount const):
(WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::weakRefCount const):
(WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::controlBlock const):
(WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::bits const): Add.
Canonical link: https://commits.webkit.org/311633@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications