diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-02-05 19:37:47 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-02-05 19:37:47 +0000 |
commit | 9b201f5d5e4ae2a3b15fc7ae974e808a0964a0c0 (patch) | |
tree | ce7ad5d8c7aa3f9cdb48dab34d7891e8931f0f57 /lib/asan/asan_malloc_linux.cc | |
parent | 3dfdcbdf6f1f1ecb2acd9c1fb600d5ebf11219e7 (diff) | |
download | src-9b201f5d5e4ae2a3b15fc7ae974e808a0964a0c0.tar.gz src-9b201f5d5e4ae2a3b15fc7ae974e808a0964a0c0.zip |
Vendor import of compiler-rt release_40 branch r294123:vendor/compiler-rt/compiler-rt-release_40-r294803vendor/compiler-rt/compiler-rt-release_40-r294123
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=313293
svn path=/vendor/compiler-rt/compiler-rt-release_40-r294803/; revision=313637; tag=vendor/compiler-rt/compiler-rt-release_40-r294803
Diffstat (limited to 'lib/asan/asan_malloc_linux.cc')
-rw-r--r-- | lib/asan/asan_malloc_linux.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/asan/asan_malloc_linux.cc b/lib/asan/asan_malloc_linux.cc index a78767c19f0f..8c99d3bc9257 100644 --- a/lib/asan/asan_malloc_linux.cc +++ b/lib/asan/asan_malloc_linux.cc @@ -50,12 +50,14 @@ INTERCEPTOR(void, free, void *ptr) { asan_free(ptr, &stack, FROM_MALLOC); } +#if SANITIZER_INTERCEPT_CFREE INTERCEPTOR(void, cfree, void *ptr) { GET_STACK_TRACE_FREE; if (UNLIKELY(IsInDlsymAllocPool(ptr))) return; asan_free(ptr, &stack, FROM_MALLOC); } +#endif // SANITIZER_INTERCEPT_CFREE INTERCEPTOR(void*, malloc, uptr size) { if (UNLIKELY(!asan_inited)) @@ -91,22 +93,24 @@ INTERCEPTOR(void*, realloc, void *ptr, uptr size) { return asan_realloc(ptr, size, &stack); } +#if SANITIZER_INTERCEPT_MEMALIGN INTERCEPTOR(void*, memalign, uptr boundary, uptr size) { GET_STACK_TRACE_MALLOC; return asan_memalign(boundary, size, &stack, FROM_MALLOC); } -INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_memalign(boundary, size, &stack, FROM_MALLOC); -} - 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); return res; } +#endif // SANITIZER_INTERCEPT_MEMALIGN + +INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) { + GET_STACK_TRACE_MALLOC; + return asan_memalign(boundary, size, &stack, FROM_MALLOC); +} INTERCEPTOR(uptr, malloc_usable_size, void *ptr) { GET_CURRENT_PC_BP_SP; @@ -114,6 +118,7 @@ INTERCEPTOR(uptr, malloc_usable_size, void *ptr) { return asan_malloc_usable_size(ptr, pc, bp); } +#if SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO // We avoid including malloc.h for portability reasons. // man mallinfo says the fields are "long", but the implementation uses int. // It doesn't matter much -- we just need to make sure that the libc's mallinfo @@ -131,6 +136,7 @@ INTERCEPTOR(struct fake_mallinfo, mallinfo, void) { INTERCEPTOR(int, mallopt, int cmd, int value) { return -1; } +#endif // SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO INTERCEPTOR(int, posix_memalign, void **memptr, uptr alignment, uptr size) { GET_STACK_TRACE_MALLOC; @@ -143,10 +149,12 @@ INTERCEPTOR(void*, valloc, uptr size) { return asan_valloc(size, &stack); } +#if SANITIZER_INTERCEPT_PVALLOC INTERCEPTOR(void*, pvalloc, uptr size) { GET_STACK_TRACE_MALLOC; return asan_pvalloc(size, &stack); } +#endif // SANITIZER_INTERCEPT_PVALLOC INTERCEPTOR(void, malloc_stats, void) { __asan_print_accumulated_stats(); |