aboutsummaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-01-19 13:45:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-01-19 13:45:54 +0100
commite47294194f2f60fb7934c8203c4b5d59552919fb (patch)
treea089fe710732f033039c7c2feaee2d118fb5792f /libsanitizer
parent569efc34ebc4f0a01d435dc11c3146b5442132cd (diff)
downloadgcc-e47294194f2f60fb7934c8203c4b5d59552919fb.zip
gcc-e47294194f2f60fb7934c8203c4b5d59552919fb.tar.gz
gcc-e47294194f2f60fb7934c8203c4b5d59552919fb.tar.bz2
re PR sanitizer/68824 (libtsan is missing the __interceptor___tls_get_addr symbol without bumping the soname)
PR sanitizer/68824 * tsan/tsan_interceptors.cc (NEED_TLS_GET_ADDR, __tls_get_addr, InitializeInterceptors): Cherry pick upstream r258119. From-SVN: r232555
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog6
-rw-r--r--libsanitizer/tsan/tsan_interceptors.cc15
2 files changed, 21 insertions, 0 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 5d25590..c6cdc09 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,9 @@
+2016-01-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/68824
+ * tsan/tsan_interceptors.cc (NEED_TLS_GET_ADDR, __tls_get_addr,
+ InitializeInterceptors): Cherry pick upstream r258119.
+
2016-01-14 Andreas Tobler <andreast@gcc.gnu.org>
* configure.ac: Replace the hard-coded -ldl requirement for
diff --git a/libsanitizer/tsan/tsan_interceptors.cc b/libsanitizer/tsan/tsan_interceptors.cc
index 90c1d7b..0c71c00 100644
--- a/libsanitizer/tsan/tsan_interceptors.cc
+++ b/libsanitizer/tsan/tsan_interceptors.cc
@@ -2227,6 +2227,11 @@ static void HandleRecvmsg(ThreadState *thr, uptr pc,
// Since the interceptor only initializes memory for msan, the simplest solution
// is to disable the interceptor in tsan (other sanitizers do not call
// signal handlers from COMMON_INTERCEPTOR_ENTER).
+// As __tls_get_addr has been intercepted in the past, to avoid breaking
+// libtsan ABI, keep it around, but just call the real function.
+#if SANITIZER_INTERCEPT_TLS_GET_ADDR
+#define NEED_TLS_GET_ADDR
+#endif
#undef SANITIZER_INTERCEPT_TLS_GET_ADDR
#define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)
@@ -2446,6 +2451,12 @@ static void syscall_post_fork(uptr pc, int pid) {
#include "sanitizer_common/sanitizer_common_syscalls.inc"
+#ifdef NEED_TLS_GET_ADDR
+TSAN_INTERCEPTOR(void *, __tls_get_addr, void *arg) {
+ return REAL(__tls_get_addr)(arg);
+}
+#endif
+
namespace __tsan {
static void finalize(void *arg) {
@@ -2627,6 +2638,10 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(__cxa_atexit);
TSAN_INTERCEPT(_exit);
+#ifdef NEED_TLS_GET_ADDR
+ TSAN_INTERCEPT(__tls_get_addr);
+#endif
+
#if !SANITIZER_MAC
// Need to setup it, because interceptors check that the function is resolved.
// But atexit is emitted directly into the module, so can't be resolved.