[llvm-commits] [compiler-rt] r171071 - in /compiler-rt/trunk/lib/msan: msan_interceptors.cc msan_platform_limits_posix.cc msan_platform_limits_posix.h
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Dec 25 08:51:57 PST 2012
Author: eugenis
Date: Tue Dec 25 10:51:57 2012
New Revision: 171071
URL: http://llvm.org/viewvc/llvm-project?rev=171071&view=rev
Log:
[msan] Improve recvfrom interceptor.
Modified:
compiler-rt/trunk/lib/msan/msan_interceptors.cc
compiler-rt/trunk/lib/msan/msan_platform_limits_posix.cc
compiler-rt/trunk/lib/msan/msan_platform_limits_posix.h
Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=171071&r1=171070&r2=171071&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Tue Dec 25 10:51:57 2012
@@ -634,9 +634,17 @@
INTERCEPTOR(SSIZE_T, recvfrom, int fd, void *buf, SIZE_T len, int flags,
void *srcaddr, void *addrlen) {
ENSURE_MSAN_INITED();
+ SIZE_T srcaddr_sz;
+ if (srcaddr)
+ srcaddr_sz = __msan_get_socklen_t(addrlen);
SSIZE_T res = REAL(recvfrom)(fd, buf, len, flags, srcaddr, addrlen);
- if (res > 0)
+ if (res > 0) {
__msan_unpoison(buf, res);
+ if (srcaddr) {
+ SIZE_T sz = __msan_get_socklen_t(addrlen);
+ __msan_unpoison(srcaddr, (sz < srcaddr_sz) ? sz : srcaddr_sz);
+ }
+ }
return res;
}
Modified: compiler-rt/trunk/lib/msan/msan_platform_limits_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_platform_limits_posix.cc?rev=171071&r1=171070&r2=171071&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_platform_limits_posix.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_platform_limits_posix.cc Tue Dec 25 10:51:57 2012
@@ -48,6 +48,10 @@
uptr __msan_get_msghdr_iovlen(void* msg) {
return ((struct msghdr *)msg)->msg_iovlen;
}
+
+ uptr __msan_get_socklen_t(void* socklen_ptr) {
+ return *(socklen_t*)socklen_ptr;
+ }
}
#endif // __linux__
Modified: compiler-rt/trunk/lib/msan/msan_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_platform_limits_posix.h?rev=171071&r1=171070&r2=171071&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_platform_limits_posix.h (original)
+++ compiler-rt/trunk/lib/msan/msan_platform_limits_posix.h Tue Dec 25 10:51:57 2012
@@ -29,6 +29,7 @@
void* __msan_get_msghdr_iov_iov_base(void* msg, int idx);
uptr __msan_get_msghdr_iov_iov_len(void* msg, int idx);
uptr __msan_get_msghdr_iovlen(void* msg);
+ uptr __msan_get_socklen_t(void* socklen_ptr);
} // namespace __msan
#endif
More information about the llvm-commits
mailing list