summaryrefslogtreecommitdiff
path: root/lib/tsan
diff options
context:
space:
mode:
authorAlex Shlyapnikov <alekseys@google.com>2018-03-12 21:59:06 +0000
committerAlex Shlyapnikov <alekseys@google.com>2018-03-12 21:59:06 +0000
commit4c895bfe35adea9996ffe603d7ca215fb7e6d1ef (patch)
tree2e153cf78b4d9f5c59f751d4cb617069cf9ca9be /lib/tsan
parent39ded27815df4a8cb76ad0b55461111ab35378e6 (diff)
[Sanitizers] Add more standard compliant posix_memalign implementation for LSan.
Summary: Add more standard compliant posix_memalign implementation for LSan and use corresponding sanitizer's posix_memalign implenetations in allocation wrappers on Mac. Reviewers: eugenis, fjricci Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44335 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan')
-rw-r--r--lib/tsan/rtl/tsan_malloc_mac.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/tsan/rtl/tsan_malloc_mac.cc b/lib/tsan/rtl/tsan_malloc_mac.cc
index 455c95df6..3cc30724d 100644
--- a/lib/tsan/rtl/tsan_malloc_mac.cc
+++ b/lib/tsan/rtl/tsan_malloc_mac.cc
@@ -15,6 +15,7 @@
#include "sanitizer_common/sanitizer_platform.h"
#if SANITIZER_MAC
+#include "sanitizer_common/sanitizer_errno.h"
#include "tsan_interceptors.h"
#include "tsan_stack_trace.h"
@@ -39,6 +40,15 @@ using namespace __tsan;
if (cur_thread()->in_symbolizer) return InternalCalloc(count, size); \
SCOPED_INTERCEPTOR_RAW(calloc, size, count); \
void *p = user_calloc(thr, pc, size, count)
+#define COMMON_MALLOC_POSIX_MEMALIGN(memptr, alignment, size) \
+ if (cur_thread()->in_symbolizer) { \
+ void *p = InternalAlloc(size, nullptr, alignment); \
+ if (!p) return errno_ENOMEM; \
+ *memptr = p; \
+ return 0; \
+ } \
+ SCOPED_INTERCEPTOR_RAW(posix_memalign, memptr, alignment, size); \
+ int res = user_posix_memalign(thr, pc, memptr, alignment, size);
#define COMMON_MALLOC_VALLOC(size) \
if (cur_thread()->in_symbolizer) \
return InternalAlloc(size, nullptr, GetPageSizeCached()); \