diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-06-28 11:02:43 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-06-28 11:02:43 +0000 |
commit | 341b9e63f63a8eacf1b699d4c79edee55241ebe6 (patch) | |
tree | c952c914c352024f0e8d9485e6cc0f5da8046bf7 /lib/msan/msan_interceptors.cc | |
parent | 6b233edfdb741fa75faec815ff3940724e8126a5 (diff) | |
download | compiler-rt-341b9e63f63a8eacf1b699d4c79edee55241ebe6.tar.gz compiler-rt-341b9e63f63a8eacf1b699d4c79edee55241ebe6.tar.bz2 compiler-rt-341b9e63f63a8eacf1b699d4c79edee55241ebe6.tar.xz |
[sanitizer] Intercept ptrace.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185142 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_interceptors.cc')
-rw-r--r-- | lib/msan/msan_interceptors.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/msan/msan_interceptors.cc b/lib/msan/msan_interceptors.cc index 2c1963d0..7f298dce 100644 --- a/lib/msan/msan_interceptors.cc +++ b/lib/msan/msan_interceptors.cc @@ -70,8 +70,10 @@ bool IsInInterceptorScope() { // Check that [x, x+n) range is unpoisoned unless we are in a nested // interceptor. -#define CHECK_UNPOISONED(x, n) \ - if (!IsInInterceptorScope()) CHECK_UNPOISONED_0(x, n); +#define CHECK_UNPOISONED(x, n) \ + do { \ + if (!IsInInterceptorScope()) CHECK_UNPOISONED_0(x, n); \ + } while (0); static void *fast_memset(void *ptr, int c, SIZE_T n); static void *fast_memcpy(void *dst, const void *src, SIZE_T n); @@ -969,14 +971,16 @@ struct MSanInterceptorContext { // A version of CHECK_UNPOISED using a saved scope value. Used in common // interceptors. -#define CHECK_UNPOISONED_CTX(ctx, x, n) \ - if (!((MSanInterceptorContext *) ctx)->in_interceptor_scope) \ - CHECK_UNPOISONED_0(x, n); +#define CHECK_UNPOISONED_CTX(ctx, x, n) \ + do { \ + if (!((MSanInterceptorContext *)ctx)->in_interceptor_scope) \ + CHECK_UNPOISONED_0(x, n); \ + } while (0) #define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \ __msan_unpoison(ptr, size) #define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) \ - CHECK_UNPOISONED_CTX(ctx, ptr, size); + CHECK_UNPOISONED_CTX(ctx, ptr, size) #define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \ if (msan_init_is_running) return REAL(func)(__VA_ARGS__); \ MSanInterceptorContext msan_ctx = {IsInInterceptorScope()}; \ |