diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-02-27 14:43:31 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-02-27 14:43:31 +0000 |
commit | 193f6a9096d47213a0c4e5ba5b089b3d50fddcfe (patch) | |
tree | f6a0e8444b3a5ac7bb3b64907623b7eca1986738 /lib | |
parent | 1f4a433ad9d2e04d9f27de41621b1eae726d1063 (diff) | |
download | compiler-rt-193f6a9096d47213a0c4e5ba5b089b3d50fddcfe.tar.gz |
tsan: work around known bug in libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sanitizer_common/sanitizer_tls_get_addr.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/sanitizer_common/sanitizer_tls_get_addr.cc b/lib/sanitizer_common/sanitizer_tls_get_addr.cc index b3ffa8c70..d98640e1f 100644 --- a/lib/sanitizer_common/sanitizer_tls_get_addr.cc +++ b/lib/sanitizer_common/sanitizer_tls_get_addr.cc @@ -75,21 +75,26 @@ void DTLS_on_tls_get_addr(void *arg_void, void *res) { return; uptr tls_size = 0; uptr tls_beg = reinterpret_cast<uptr>(res) - arg->offset; - VPrintf(2, "__tls_get_addr: %p {%p,%p} => %p; tls_beg: %p; sp: %p\n", arg, - arg->dso_id, arg->offset, res, tls_beg, &tls_beg); + // Don't do anything fancy in this function, in particular don't print. + // Some versions of libstdc++ are miscompiled and call this function + // with mis-aligned stack: + // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 + // Printf uses SSE instructions that crash with mis-aligned accesses. + // VPrintf(2, "__tls_get_addr: %p {%p,%p} => %p; tls_beg: %p; sp: %p\n", arg, + // arg->dso_id, arg->offset, res, tls_beg, &tls_beg); if (dtls.last_memalign_ptr == tls_beg) { tls_size = dtls.last_memalign_size; - VPrintf(2, "__tls_get_addr: glibc <=2.18 suspected; tls={%p,%p}\n", tls_beg, - tls_size); + // VPrintf(2, "__tls_get_addr: glibc <=2.18 suspected; tls={%p,%p}\n", + // tls_beg, tls_size); } else if ((tls_beg % 4096) == sizeof(Glibc_2_19_tls_header)) { // We may want to check gnu_get_libc_version(). Glibc_2_19_tls_header *header = (Glibc_2_19_tls_header *)tls_beg - 1; tls_size = header->size; tls_beg = header->start; - VPrintf(2, "__tls_get_addr: glibc >=2.19 suspected; tls={%p %p}\n", tls_beg, - tls_size); + //VPrintf(2, "__tls_get_addr: glibc >=2.19 suspected; tls={%p %p}\n", + // tls_beg, tls_size); } else { - VPrintf(2, "__tls_get_addr: Can't guess glibc version\n"); + //VPrintf(2, "__tls_get_addr: Can't guess glibc version\n"); // This may happen inside the DTOR of main thread, so just ignore it. tls_size = 0; } @@ -98,7 +103,7 @@ void DTLS_on_tls_get_addr(void *arg_void, void *res) { } void DTLS_on_libc_memalign(void *ptr, uptr size) { - VPrintf(2, "DTLS_on_libc_memalign: %p %p\n", ptr, size); + // VPrintf(2, "DTLS_on_libc_memalign: %p %p\n", ptr, size); dtls.last_memalign_ptr = reinterpret_cast<uptr>(ptr); dtls.last_memalign_size = size; } |