[PATCH] D44125: [sanitizer] Move mmap interceptors into sanitizer_common

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 14:42:21 PST 2018


morehouse added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:276
+    void *res = REAL(mmap)(addr, sz, prot, flags, fd, off);                \
+    if (0 && res != (void *)-1 && common_flags()->intercept_intrin)        \
+      COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, sz);                        \
----------------
morehouse wrote:
> Purpose of `if (0 && ... )`?
Does it make sense to condition this on `common_flags()->intercept_intrin`?  Isn't that flag intended to affect only memset/memcpy/memmove?


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:277
+    if (res != (void *)-1 && common_flags()->intercept_intrin)             \
+      COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, sz);                        \
+    return res;                                                            \
----------------
Does it make sense to call `COMMON_INTERCEPTOR_WRITE_RANGE` at all?  Doesn't `mmap` just create a mapping rather than writing to memory?


https://reviews.llvm.org/D44125





More information about the llvm-commits mailing list