[compiler-rt] r202403 - tsan: work around known bug in libstdc++
Dmitry Vyukov
dvyukov at google.com
Thu Feb 27 06:43:31 PST 2014
Author: dvyukov
Date: Thu Feb 27 08:43:31 2014
New Revision: 202403
URL: http://llvm.org/viewvc/llvm-project?rev=202403&view=rev
Log:
tsan: work around known bug in libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_tls_get_addr.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_tls_get_addr.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_tls_get_addr.cc?rev=202403&r1=202402&r2=202403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_tls_get_addr.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_tls_get_addr.cc Thu Feb 27 08:43:31 2014
@@ -75,21 +75,26 @@ void DTLS_on_tls_get_addr(void *arg_void
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 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;
}
More information about the llvm-commits
mailing list