diff options
author | Francis Ricci <francisjricci@gmail.com> | 2017-02-13 22:20:07 +0000 |
---|---|---|
committer | Francis Ricci <francisjricci@gmail.com> | 2017-02-13 22:20:07 +0000 |
commit | 7cda03e6d16ecd585e09eaefbc03b2433670c05d (patch) | |
tree | e0a69d9131b0f2dcd562086dfc30ceea72eb0ca7 /clang/lib/Parse/ParseDecl.cpp | |
parent | 48dfa1a6ed81f0d0d52b8172f823bbaab27f11ed (diff) | |
download | bcm5719-llvm-7cda03e6d16ecd585e09eaefbc03b2433670c05d.tar.gz bcm5719-llvm-7cda03e6d16ecd585e09eaefbc03b2433670c05d.zip |
Use pthreads to manage thread-local storage on darwin for leak sanitizer
Summary:
__thread is supported on Darwin, but is implemented dynamically via
function calls to __tls_get_addr. This causes two issues when combined
with leak sanitizer, due to malloc() interception.
- The dynamic loader calls malloc during the process of loading
the sanitizer dylib, while swapping a placeholder tlv_boostrap
function for __tls_get_addr. This will cause tlv_bootstrap to
be called in DisabledInThisThread() via the asan allocator.
- The first time __tls_get_addr is called, it allocates memory
for the thread-local object, during which it calls malloc(). This
call will be intercepted, leading to an infinite loop in the asan
allocator, in which the allocator calls DisabledInThisThread,
which calls tls_get_addr, which calls into the allocator again.
Reviewers: kcc, glider, kubamracek
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29786
llvm-svn: 294994
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
0 files changed, 0 insertions, 0 deletions