[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 13:35:56 PST 2018


morehouse added inline comments.


================
Comment at: compiler-rt/lib/hwasan/hwasan_interceptors.cc:272
+    return real_mmap(addr, length, prot, flags, fd, offset);
   ENSURE_HWASAN_INITED();
   if (addr && !MEM_IS_APP(addr)) {
----------------
Aren't the above 3 lines handled by `COMMON_INTERCEPTOR_ENTER`?


================
Comment at: compiler-rt/lib/hwasan/hwasan_interceptors.cc:472
 
   INTERCEPT_FUNCTION(mmap);
-  HWASAN_MAYBE_INTERCEPT_MMAP64;
----------------
Why does `INTERCEPT_FUNCTION(mmap)` stay here but not for other sanitizers?


================
Comment at: compiler-rt/lib/msan/msan_interceptors.cc:979
+    return real_mmap(addr, length, prot, flags, fd, offset);
   ENSURE_MSAN_INITED();
   if (addr && !MEM_IS_APP(addr)) {
----------------
Above 3 lines handled by `COMMON_INTERCEPTOR_ENTER`?


================
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);                        \
----------------
Purpose of `if (0 && ... )`?


================
Comment at: compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:2292
+  {                                                                         \
+    SCOPED_TSAN_INTERCEPTOR(mmap, addr, sz, prot, flags, fd, off);          \
+    return mmap_interceptor(thr, pc, REAL(mmap), addr, sz, prot, flags, fd, \
----------------
Looks like this is already called by `COMMON_INTERCEPTOR_ENTER`.


https://reviews.llvm.org/D44125





More information about the llvm-commits mailing list