From 38b3130c7aa8e4f40949cd3001a75b4d2fcda540 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Thu, 14 Jan 2016 00:04:37 +0000 Subject: [PATCH] [Sanitizer] Pass proper values to DTLS_on_libc_memalign. Fix a surprising typo: the old code used to think that dynamic TLS segments were several times larger than they actually are. llvm-svn: 257722 --- compiler-rt/lib/asan/asan_malloc_linux.cc | 2 +- compiler-rt/lib/msan/msan_interceptors.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cc b/compiler-rt/lib/asan/asan_malloc_linux.cc index d5089f9f7b36..a81f19ffe7fa 100644 --- a/compiler-rt/lib/asan/asan_malloc_linux.cc +++ b/compiler-rt/lib/asan/asan_malloc_linux.cc @@ -92,7 +92,7 @@ INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) { INTERCEPTOR(void*, __libc_memalign, uptr boundary, uptr size) { GET_STACK_TRACE_MALLOC; void *res = asan_memalign(boundary, size, &stack, FROM_MALLOC); - DTLS_on_libc_memalign(res, size * boundary); + DTLS_on_libc_memalign(res, size); return res; } diff --git a/compiler-rt/lib/msan/msan_interceptors.cc b/compiler-rt/lib/msan/msan_interceptors.cc index fc28e080f262..65671eebefee 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cc +++ b/compiler-rt/lib/msan/msan_interceptors.cc @@ -195,7 +195,7 @@ INTERCEPTOR(void *, __libc_memalign, SIZE_T boundary, SIZE_T size) { GET_MALLOC_STACK_TRACE; CHECK_EQ(boundary & (boundary - 1), 0); void *ptr = MsanReallocate(&stack, nullptr, size, boundary, false); - DTLS_on_libc_memalign(ptr, size * boundary); + DTLS_on_libc_memalign(ptr, size); return ptr; }