[libc-commits] [libc] [libc] More unpoison for recvmsg (PR #117347)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Fri Nov 22 11:11:07 PST 2024


================
@@ -41,6 +41,7 @@ LLVM_LIBC_FUNCTION(ssize_t, recvmsg, (int sockfd, msghdr *msg, int flags)) {
   // Unpoison the msghdr, as well as all its components.
   MSAN_UNPOISON(msg, sizeof(msghdr));
   MSAN_UNPOISON(msg->msg_name, msg->msg_namelen);
+  MSAN_UNPOISON(msg->msg_iov, msg->msg_iovlen * sizeof(struct iovec));
----------------
michaelrj-google wrote:

I think we can assume that if the length is non-zero, then the pointer is non-null. I poked around in the sanitizer and I found this which seems to be doing basically the same thing: https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/dfsan/dfsan_custom.cpp#L1907

It's actually unpoisoning a bit less, and doesn't unpoison the iovec itself. I'll look into this a bit more.

https://github.com/llvm/llvm-project/pull/117347


More information about the libc-commits mailing list