[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
This commit is contained in:
Alex Shlyapnikov 2018-02-15 18:58:31 +00:00
parent 2061ad2f83
commit 48296ebf8b
1 changed files with 2 additions and 1 deletions

View File

@ -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.