[PATCH] D17479: [sanitizer] Move recvmsg and recv interceptors to sanitizer_common.

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 05:42:50 PST 2016


dvyukov added inline comments.

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5352
@@ +5351,3 @@
+  void *ctx;
+  COMMON_INTERCEPTOR_ENTER(ctx, recv, fd, buf, len, flags);
+  COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
----------------
this is copied from recv, needs to be updated

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5354
@@ +5353,3 @@
+  COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
+  SIZE_T srcaddr_sz;
+  if (srcaddr) srcaddr_sz = *addrlen;
----------------
this var is unused

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5357
@@ +5356,3 @@
+  SSIZE_T res = REAL(recvfrom)(fd, buf, len, flags, srcaddr, addrlen);
+  if (res) {
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len);
----------------
res > 0

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5359
@@ +5358,3 @@
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len);
+    COMMON_INTERCEPTOR_UNPOISON_PARAM(5);
+  }
----------------
this is different from what msan did
why?

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5361
@@ +5360,3 @@
+  }
+  if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
+  return res;
----------------
drop this
we add such synchronization lazily when somebody needs it, otherwise we will need to synchronize too much


Repository:
  rL LLVM

http://reviews.llvm.org/D17479





More information about the llvm-commits mailing list