diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-06-25 11:30:35 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-06-25 11:30:35 +0000 |
commit | 226906f2c3a6d4e997256bf8f6c562bfd2cb2184 (patch) | |
tree | 588568272ea1aa076ba45ead66d4bb63ce063c14 /lib/msan/msan_thread.cc | |
parent | 4f598d5c528f370172f8364832d18fe2e35d6f84 (diff) |
[msan] Fix false positive on dynamic tls.
Use existing DTLS code in sanitizer_tls_get_addr.{h,cc} to unpoison DTLS
blocks both on allocation and deallocation.
https://code.google.com/p/memory-sanitizer/issues/detail?id=44
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_thread.cc')
-rw-r--r-- | lib/msan/msan_thread.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/msan/msan_thread.cc b/lib/msan/msan_thread.cc index 2289be318..5fe99f68b 100644 --- a/lib/msan/msan_thread.cc +++ b/lib/msan/msan_thread.cc @@ -3,6 +3,8 @@ #include "msan_thread.h" #include "msan_interface_internal.h" +#include "sanitizer_common/sanitizer_tls_get_addr.h" + namespace __msan { MsanThread *MsanThread::Create(thread_callback_t start_routine, @@ -33,6 +35,9 @@ void MsanThread::ClearShadowForThreadStackAndTLS() { __msan_unpoison((void *)stack_bottom_, stack_top_ - stack_bottom_); if (tls_begin_ != tls_end_) __msan_unpoison((void *)tls_begin_, tls_end_ - tls_begin_); + DTLS *dtls = DTLS_Get(); + for (uptr i = 0; i < dtls->dtv_size; ++i) + __msan_unpoison((void *)(dtls->dtv[i].beg), dtls->dtv[i].size); } void MsanThread::Init() { @@ -55,6 +60,7 @@ void MsanThread::Destroy() { ClearShadowForThreadStackAndTLS(); uptr size = RoundUpTo(sizeof(MsanThread), GetPageSizeCached()); UnmapOrDie(this, size); + DTLS_Destroy(); } thread_return_t MsanThread::ThreadStart() { |