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

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 00:05:30 PST 2016


m.ostapenko 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);
+  }
----------------
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));
```


Repository:
  rL LLVM

http://reviews.llvm.org/D17479





More information about the llvm-commits mailing list