[compiler-rt] r273204 - [msan] Allow uninitialized padding in struct msghdr.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 14:44:15 PDT 2016
Author: eugenis
Date: Mon Jun 20 16:44:14 2016
New Revision: 273204
URL: http://llvm.org/viewvc/llvm-project?rev=273204&view=rev
Log:
[msan] Allow uninitialized padding in struct msghdr.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/trunk/test/msan/Linux/sendmsg.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=273204&r1=273203&r2=273204&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Mon Jun 20 16:44:14 2016
@@ -2501,7 +2501,16 @@ INTERCEPTOR(SSIZE_T, recvmsg, int fd, st
#if SANITIZER_INTERCEPT_SENDMSG
static void read_msghdr(void *ctx, struct __sanitizer_msghdr *msg,
SSIZE_T maxlen) {
- COMMON_INTERCEPTOR_READ_RANGE(ctx, msg, sizeof(*msg));
+#define R(f) \
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, &msg->msg_##f, sizeof(msg->msg_##f))
+ R(name);
+ R(namelen);
+ R(iov);
+ R(iovlen);
+ R(control);
+ R(controllen);
+ R(flags);
+#undef R
if (msg->msg_name && msg->msg_namelen)
COMMON_INTERCEPTOR_READ_RANGE(ctx, msg->msg_name, msg->msg_namelen);
if (msg->msg_iov && msg->msg_iovlen)
Modified: compiler-rt/trunk/test/msan/Linux/sendmsg.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/Linux/sendmsg.cc?rev=273204&r1=273203&r2=273204&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/Linux/sendmsg.cc (original)
+++ compiler-rt/trunk/test/msan/Linux/sendmsg.cc Mon Jun 20 16:44:14 2016
@@ -59,11 +59,13 @@ int main() {
#if defined(SENDMSG)
struct iovec iov[2] = {{buf, 5}, {buf + 5, 5}};
struct msghdr msg;
- memset(&msg, 0, sizeof(msg));
msg.msg_name = &serveraddr;
msg.msg_namelen = addrlen;
msg.msg_iov = iov;
msg.msg_iovlen = 2;
+ msg.msg_control = 0;
+ msg.msg_controllen = 0;
+ msg.msg_flags = 0;
#endif
#if defined(SEND)
More information about the llvm-commits
mailing list