[PATCH] D61204: [Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macro

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 11:01:15 PDT 2019


yln created this revision.
yln added a reviewer: vitalybuka.
Herald added subscribers: llvm-commits, Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.

Note that this change is not strictly NFC since we add the
`(&(name) != &WRAP(name)` part to the conditional for the `_VER` variant
of the macro.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61204

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


Index: compiler-rt/lib/msan/msan_interceptors.cc
===================================================================
--- compiler-rt/lib/msan/msan_interceptors.cc
+++ compiler-rt/lib/msan/msan_interceptors.cc
@@ -1244,8 +1244,7 @@
 #define MSAN_INTERCEPT_FUNC(name)                                       \
   do {                                                                  \
     INTERCEPT_FUNCTION(name);                                           \
-    bool same = (& (name) == & WRAP(name));                             \
-    if ((!same || !REAL(name)))                                         \
+    if (&(name) != &WRAP(name) || !REAL(name))                          \
       VReport(1, "MemorySanitizer: failed to intercept '" #name "'\n"); \
   } while (0)
 
@@ -1253,7 +1252,7 @@
   do {                                                                        \
     INTERCEPT_FUNCTION_VER(name, ver);                                        \
     name##_type ptr = (::__interception::real_##name);                        \
-    if ((!ptr || !REAL(name)))                                                \
+    if (&(name) != &WRAP(name) || !REAL(name))                                \
       VReport(                                                                \
           1, "MemorySanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
   } while (0)
Index: compiler-rt/lib/asan/asan_interceptors.h
===================================================================
--- compiler-rt/lib/asan/asan_interceptors.h
+++ compiler-rt/lib/asan/asan_interceptors.h
@@ -123,15 +123,13 @@
 #define ASAN_INTERCEPT_FUNC(name)                                        \
   do {                                                                   \
     INTERCEPT_FUNCTION(name);                                            \
-    bool same = (& (name) == & WRAP(name));                              \
-    if ((!same || !REAL(name)))                                          \
+    if (&(name) != &WRAP(name) || !REAL(name))                           \
       VReport(1, "AddressSanitizer: failed to intercept '" #name "'\n"); \
   } while (0)
 #define ASAN_INTERCEPT_FUNC_VER(name, ver)                                     \
   do {                                                                         \
     INTERCEPT_FUNCTION_VER(name, ver);                                         \
-    name##_type ptr = (::__interception::real_##name);                         \
-    if ((!ptr || !REAL(name)))                                                 \
+    if (&(name) != &WRAP(name) || !REAL(name))                                 \
       VReport(                                                                 \
           1, "AddressSanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
   } while (0)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61204.196887.patch
Type: text/x-patch
Size: 2823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190426/cfdbf108/attachment.bin>


More information about the llvm-commits mailing list