From 48296ebf8bbb9667d40bb94677152cb299137b90 Mon Sep 17 00:00:00 2001 From: Alex Shlyapnikov Date: Thu, 15 Feb 2018 18:58:31 +0000 Subject: [PATCH] [TSan] Fix static TLS boundaries calculations in __tls_get_addr interceptor. Summary: DTLS_on_tls_get_addr expects (tls_addr + tls_size) as the last parameter, static_tls_end. Reviewers: dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43325 llvm-svn: 325276 --- compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index b287ca8f03df..16a725e61965 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -2535,7 +2535,8 @@ TSAN_INTERCEPTOR(void *, __tls_get_addr, void *arg) { ThreadState *thr = cur_thread(); if (!thr) return res; - DTLS::DTV *dtv = DTLS_on_tls_get_addr(arg, res, thr->tls_addr, thr->tls_size); + DTLS::DTV *dtv = DTLS_on_tls_get_addr(arg, res, thr->tls_addr, + thr->tls_addr + thr->tls_size); if (!dtv) return res; // New DTLS block has been allocated.