[PATCH] D42070: [msan] Put send/recvmmsg behind check for mmsghdr

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 06:52:12 PST 2018


mcrosier created this revision.
mcrosier added reviewers: eugenis, vitalybuka.
Herald added subscribers: krytarowski, mgorny, kubamracek, srhines.

Internally, we started running into a build failure after r321774 with the following error: "use of undeclared identifier 'mmsghdr'."  The underlying issue is that we have machines that are using an older version of glibc, glibc 2.11.3, which don't define mssghdr.  I would love to upgrade these machines, but unfortunately that's currently not an option.

This patch just checks for the mmsghdr feature prior to trying to intercept sendmmsg/recvmmsg.  Feedback is very much welcome as this is not my area of expertise.


Repository:
  rL LLVM

https://reviews.llvm.org/D42070

Files:
  cmake/config-ix.cmake
  lib/sanitizer_common/CMakeLists.txt
  lib/sanitizer_common/sanitizer_platform_interceptors.h
  lib/sanitizer_common/sanitizer_platform_limits_posix.cc


Index: lib/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1026,7 +1026,7 @@
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
 
-#if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21)
+#if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21) && COMPILER_RT_HAS_mmsghdr
 CHECK_TYPE_SIZE(mmsghdr);
 CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
 CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
Index: lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -221,8 +221,10 @@
 #define SANITIZER_INTERCEPT_MODF SI_POSIX
 #define SANITIZER_INTERCEPT_RECVMSG SI_POSIX
 #define SANITIZER_INTERCEPT_SENDMSG SI_POSIX
+#if COMPILER_RT_HAS_mmsghdr
 #define SANITIZER_INTERCEPT_RECVMMSG SI_LINUX
 #define SANITIZER_INTERCEPT_SENDMMSG SI_LINUX
+#endif
 #define SANITIZER_INTERCEPT_GETPEERNAME SI_POSIX
 #define SANITIZER_INTERCEPT_IOCTL SI_POSIX
 #define SANITIZER_INTERCEPT_INET_ATON SI_POSIX
Index: lib/sanitizer_common/CMakeLists.txt
===================================================================
--- lib/sanitizer_common/CMakeLists.txt
+++ lib/sanitizer_common/CMakeLists.txt
@@ -180,6 +180,10 @@
   set(OS_OPTION OS ${SANITIZER_COMMON_SUPPORTED_OS})
 endif()
 
+if(COMPILER_RT_HAS_mmsghdr)
+  add_definitions(-DCOMPILER_RT_HAS_mmsghdr)
+endif()
+
 add_compiler_rt_object_libraries(RTSanitizerCommon
   ${OS_OPTION}
   ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -98,6 +98,7 @@
 
 # Symbols.
 check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
+check_symbol_exists(mmsghdr sys/socket.h COMPILER_RT_HAS_mmsghdr)
 
 # Libraries.
 check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42070.129856.patch
Type: text/x-patch
Size: 2184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180115/db2ad135/attachment.bin>


More information about the llvm-commits mailing list