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

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 00:13:58 PST 2016


dvyukov added inline comments.

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5364
@@ +5363,3 @@
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len);
+    COMMON_INTERCEPTOR_UNPOISON_SRCADDR(srcaddr, addrlen, srcaddr_sz);
+  }
----------------
m.ostapenko wrote:
> dvyukov wrote:
> > I would just do:
> > 
> >   if (srcaddr)
> >       __msan_unpoison(srcaddr, Min(srcaddr_sz, *addrlen));
> > 
> > The macro makes code more convoluted without adding significant value. Every time I read this function I will need to go and check macro definition.
> > Every time I read this function I will need to go and check macro definition.
> 
> Agree here, but wouldn't this lead to **use of undeclared identifier '__msan_unpoison'** errors in {a, t}san_interceptors.cc? I used the macro just to avoid such issues. Perhaps I can avoid introducing a new macro and write something like this:
> ```
> if (srcaddr)
>   COMMON_INTERCEPTOR_INITIALIZE_RANGE(srcaddr, Min(srcaddr_sz, (SIZE_T)*addrlen));
> ```
Right.
Don't we already have it? I would expect that we should have something like this already. We already have COMMON_INTERCEPTOR_INITIALIZE_RANGE, maybe that's what you are looking for?
If we don't have it yet, then yes, introduce such macro.



Repository:
  rL LLVM

http://reviews.llvm.org/D17479





More information about the llvm-commits mailing list