diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2016-01-20 19:56:04 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2016-01-20 19:56:04 +0000 |
commit | 25f5913ddf5c4f6f343e6112f6bf360d71243098 (patch) | |
tree | 57dd45134a56f541fff995dc674a208325cc7f92 /compiler-rt | |
parent | a34ce95b60f14f5c53d3f01a4c90d225477bd5e0 (diff) | |
download | bcm5719-llvm-25f5913ddf5c4f6f343e6112f6bf360d71243098.tar.gz bcm5719-llvm-25f5913ddf5c4f6f343e6112f6bf360d71243098.zip |
[MSan] Clear parameters shadow before invoking malloc/free hooks.
MSan runtime is not itself instrumented, so we need to explicitly
clear shadow for function arguments before calling user-provided
functions from runtime (e.g. we already do this for several
interceptors).
I'm still crafting a test case that would demonstrate this issue
reliably, and will commit it later today.
llvm-svn: 258339
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/msan/msan.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler-rt/lib/msan/msan.h b/compiler-rt/lib/msan/msan.h index 2079a592b7b..b41d097a5f0 100644 --- a/compiler-rt/lib/msan/msan.h +++ b/compiler-rt/lib/msan/msan.h @@ -309,9 +309,15 @@ void MsanTSDDtor(void *tsd); } // namespace __msan -#define MSAN_MALLOC_HOOK(ptr, size) \ - if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size) -#define MSAN_FREE_HOOK(ptr) \ - if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr) +#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); \ + } #endif // MSAN_H |