[PATCH] D61145: [NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION to void

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 10:29:28 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359325: [NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION to void (authored by yln, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D61145?vs=196717&id=196879#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61145/new/

https://reviews.llvm.org/D61145

Files:
  compiler-rt/trunk/lib/asan/asan_interceptors.h
  compiler-rt/trunk/lib/interception/interception_linux.h
  compiler-rt/trunk/lib/msan/msan_interceptors.cc


Index: compiler-rt/trunk/lib/interception/interception_linux.h
===================================================================
--- compiler-rt/trunk/lib/interception/interception_linux.h
+++ compiler-rt/trunk/lib/interception/interception_linux.h
@@ -30,16 +30,18 @@
 }  // namespace __interception
 
 #define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)                          \
-  ::__interception::GetRealFunctionAddress(                                \
+  do { ::__interception::GetRealFunctionAddress(                           \
       #func, (::__interception::uptr *)&__interception::PTR_TO_REAL(func), \
       (::__interception::uptr) & (func),                                   \
-      (::__interception::uptr) & WRAP(func))
+      (::__interception::uptr) & WRAP(func));                              \
+  } while (0)  // TODO(yln): temporarily make macro void.
 
 // Android,  Solaris and OpenBSD do not have dlvsym
 #if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD
 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
-  (::__interception::real_##func = (func##_type)(                \
-       unsigned long)::__interception::GetFuncAddrVer(#func, symver))
+  do { (::__interception::real_##func = (func##_type)(                \
+       unsigned long)::__interception::GetFuncAddrVer(#func, symver)); \
+  } while (0)
 #else
 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
   INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
Index: compiler-rt/trunk/lib/msan/msan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc
@@ -1243,13 +1243,17 @@
 
 #define MSAN_INTERCEPT_FUNC(name)                                       \
   do {                                                                  \
-    if ((!INTERCEPT_FUNCTION(name) || !REAL(name)))                     \
+    INTERCEPT_FUNCTION(name);                                           \
+    bool same = (& (name) == & WRAP(name));                             \
+    if ((!same || !REAL(name)))                                         \
       VReport(1, "MemorySanitizer: failed to intercept '" #name "'\n"); \
   } while (0)
 
 #define MSAN_INTERCEPT_FUNC_VER(name, ver)                                    \
   do {                                                                        \
-    if ((!INTERCEPT_FUNCTION_VER(name, ver) || !REAL(name)))                  \
+    INTERCEPT_FUNCTION_VER(name, ver);                                        \
+    name##_type ptr = (::__interception::real_##name);                        \
+    if ((!ptr || !REAL(name)))                                                \
       VReport(                                                                \
           1, "MemorySanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
   } while (0)
Index: compiler-rt/trunk/lib/asan/asan_interceptors.h
===================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h
@@ -122,12 +122,16 @@
 #if !SANITIZER_MAC
 #define ASAN_INTERCEPT_FUNC(name)                                        \
   do {                                                                   \
-    if ((!INTERCEPT_FUNCTION(name) || !REAL(name)))                      \
+    INTERCEPT_FUNCTION(name);                                            \
+    bool same = (& (name) == & WRAP(name));                              \
+    if ((!same || !REAL(name)))                                          \
       VReport(1, "AddressSanitizer: failed to intercept '" #name "'\n"); \
   } while (0)
 #define ASAN_INTERCEPT_FUNC_VER(name, ver)                                     \
   do {                                                                         \
-    if ((!INTERCEPT_FUNCTION_VER(name, ver) || !REAL(name)))                   \
+    INTERCEPT_FUNCTION_VER(name, ver);                                         \
+    name##_type ptr = (::__interception::real_##name);                         \
+    if ((!ptr || !REAL(name)))                                                 \
       VReport(                                                                 \
           1, "AddressSanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
   } while (0)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61145.196879.patch
Type: text/x-patch
Size: 4426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190426/22f33e72/attachment.bin>


More information about the llvm-commits mailing list