Fix re-entrancy into Chrome's TLS implementation during thread destruction.
Chrome's TLS implementation is not safe to use after internal structures have been destroyed during thread destruction. On POSIX, doing so will cause extra, unnecessary work as internal structures are recreated, then destroyed later. On Windows, doing so will cause a leak. This CL adds a kDestroyed state that Chrome TLS sets after it finishes destruction. Slot::Get() DCHECKs that state != kDestroyed. There are currently two legitimate cases where an external consumer would need to check the status of kDestroyed. The heap-profiling shim can be invoked by BoringSSL's thread destructor. It's important that this doesn't cause re-entrancy into Chrome TLS. This CL adds a private function ThreadLocalStorage::HasBeenDestroyed which is exposed via friendship for the two implementations of the heap profiler to use. Change-Id: I5bd8dca3d48ee1c9d456bc05fa0824800575ca38 Bug: 825218 Reviewed-on: https://chromium-review.googlesource.com/978393 Commit-Queue: Erik Chen <erikchen@chromium.org> Reviewed-by:Nico Weber <thakis@chromium.org> Reviewed-by:
Robert Liao <robliao@chromium.org> Reviewed-by:
Dmitry Skiba <dskiba@chromium.org> Cr-Commit-Position: refs/heads/master@{#547949}
Showing
This diff is collapsed.
Please register or sign in to comment