[PATCH] D43325: [TSan] Fix static TLS boundaries calculations in __tls_get_addr interceptor.

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 16:30:21 PST 2018

alekseyshl created this revision.
alekseyshl added a reviewer: dvyukov.
Herald added subscribers: Sanitizers, delcypher, kubamracek.

DTLS_on_tls_get_addr expects (tls_addr + tls_size) as the last
parameter, static_tls_end.

  rCRT Compiler Runtime



Index: lib/tsan/rtl/tsan_interceptors.cc
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -2534,7 +2534,8 @@
   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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43325.134339.patch
Type: text/x-patch
Size: 565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180215/6ee451fc/attachment.bin>

More information about the llvm-commits mailing list