summaryrefslogtreecommitdiff
path: root/lib/msan
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-06-16 20:06:06 +0000
committerKostya Serebryany <kcc@google.com>2016-06-16 20:06:06 +0000
commit5bb1631a69eb8b8f3c7eca7476e320372c967454 (patch)
treef3df59dc858ce59bb2219a6f4eb5414d594569dd /lib/msan
parented4063874ac289bc42a04347853716bb8b74f9de (diff)
downloadcompiler-rt-5bb1631a69eb8b8f3c7eca7476e320372c967454.tar.gz
[sanitizers] introduce yet another API function: __sanitizer_install_malloc_and_free_hooks
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan')
-rw-r--r--lib/msan/msan.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/msan/msan.h b/lib/msan/msan.h
index be74f6ea1..1f2ff59ca 100644
--- a/lib/msan/msan.h
+++ b/lib/msan/msan.h
@@ -309,15 +309,21 @@ void MsanTSDDtor(void *tsd);
} // namespace __msan
-#define MSAN_MALLOC_HOOK(ptr, size) \
- if (&__sanitizer_malloc_hook) { \
- UnpoisonParam(2); \
- __sanitizer_malloc_hook(ptr, size); \
- }
-#define MSAN_FREE_HOOK(ptr) \
- if (&__sanitizer_free_hook) { \
- UnpoisonParam(1); \
- __sanitizer_free_hook(ptr); \
- }
+#define MSAN_MALLOC_HOOK(ptr, size) \
+ do { \
+ if (&__sanitizer_malloc_hook) { \
+ UnpoisonParam(2); \
+ __sanitizer_malloc_hook(ptr, size); \
+ } \
+ RunMallocHooks(ptr, size); \
+ } while (false)
+#define MSAN_FREE_HOOK(ptr) \
+ do { \
+ if (&__sanitizer_free_hook) { \
+ UnpoisonParam(1); \
+ __sanitizer_free_hook(ptr); \
+ } \
+ RunFreeHooks(ptr); \
+ } while (false)
#endif // MSAN_H