[llvm-commits] [compiler-rt] r170189 - in /compiler-rt/trunk/lib: msan/msan_interceptors.cc sanitizer_common/sanitizer_common_interceptors.h

Alexey Samsonov samsonov at google.com
Fri Dec 14 03:52:02 PST 2012


Author: samsonov
Date: Fri Dec 14 05:52:02 2012
New Revision: 170189

URL: http://llvm.org/viewvc/llvm-project?rev=170189&view=rev
Log:
[Sanitizer] use INTERCEPT_FUNCTION(foo) instead of CHECK(INTERCEPT_FUNCTION(foo)) - this check may fail on Linux if user program defines its own version of library function foo

Modified:
    compiler-rt/trunk/lib/msan/msan_interceptors.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.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=170189&r1=170188&r2=170189&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Fri Dec 14 05:52:02 2012
@@ -28,7 +28,7 @@
 using namespace __msan;
 
 #define ENSURE_MSAN_INITED() do { \
-    CHECK(!msan_init_is_running);       \
+  CHECK(!msan_init_is_running); \
   if (!msan_inited) { \
     __msan_init(); \
   } \
@@ -804,80 +804,80 @@
 void InitializeInterceptors() {
   static int inited = 0;
   CHECK_EQ(inited, 0);
-  CHECK(INTERCEPT_FUNCTION(mmap));
-  CHECK(INTERCEPT_FUNCTION(mmap64));
-  CHECK(INTERCEPT_FUNCTION(posix_memalign));
-  CHECK(INTERCEPT_FUNCTION(malloc));
-  CHECK(INTERCEPT_FUNCTION(calloc));
-  CHECK(INTERCEPT_FUNCTION(realloc));
-  CHECK(INTERCEPT_FUNCTION(free));
-  CHECK(INTERCEPT_FUNCTION(fread));
-  CHECK(INTERCEPT_FUNCTION(fread_unlocked));
-  CHECK(INTERCEPT_FUNCTION(read));
-  CHECK(INTERCEPT_FUNCTION(pread));
-  CHECK(INTERCEPT_FUNCTION(pread64));
-  CHECK(INTERCEPT_FUNCTION(readlink));
-  CHECK(INTERCEPT_FUNCTION(readdir));
-  CHECK(INTERCEPT_FUNCTION(memcpy));
-  CHECK(INTERCEPT_FUNCTION(memset));
-  CHECK(INTERCEPT_FUNCTION(memmove));
-  CHECK(INTERCEPT_FUNCTION(wmemset));
-  CHECK(INTERCEPT_FUNCTION(wmemcpy));
-  CHECK(INTERCEPT_FUNCTION(wmemmove));
-  CHECK(INTERCEPT_FUNCTION(strcpy));  // NOLINT
-  CHECK(INTERCEPT_FUNCTION(strdup));
-  CHECK(INTERCEPT_FUNCTION(strncpy));  // NOLINT
-  CHECK(INTERCEPT_FUNCTION(strlen));
-  CHECK(INTERCEPT_FUNCTION(strnlen));
-  CHECK(INTERCEPT_FUNCTION(gcvt));
-  CHECK(INTERCEPT_FUNCTION(strcat));  // NOLINT
-  CHECK(INTERCEPT_FUNCTION(strncat));  // NOLINT
-  CHECK(INTERCEPT_FUNCTION(strtol));
-  CHECK(INTERCEPT_FUNCTION(strtoll));
-  CHECK(INTERCEPT_FUNCTION(strtoul));
-  CHECK(INTERCEPT_FUNCTION(strtoull));
-  CHECK(INTERCEPT_FUNCTION(vsprintf));
-  CHECK(INTERCEPT_FUNCTION(vsnprintf));
-  CHECK(INTERCEPT_FUNCTION(vswprintf));
-  CHECK(INTERCEPT_FUNCTION(sprintf));  // NOLINT
-  CHECK(INTERCEPT_FUNCTION(snprintf));
-  CHECK(INTERCEPT_FUNCTION(swprintf));
-  CHECK(INTERCEPT_FUNCTION(strftime));
-  CHECK(INTERCEPT_FUNCTION(wcstombs));
-  CHECK(INTERCEPT_FUNCTION(mbstowcs));
-  CHECK(INTERCEPT_FUNCTION(wcslen));
-  CHECK(INTERCEPT_FUNCTION(wcschr));
-  CHECK(INTERCEPT_FUNCTION(wcscpy));
-  CHECK(INTERCEPT_FUNCTION(wcscmp));
-  CHECK(INTERCEPT_FUNCTION(wcstod));
-  CHECK(INTERCEPT_FUNCTION(getenv));
-  CHECK(INTERCEPT_FUNCTION(gettimeofday));
-  CHECK(INTERCEPT_FUNCTION(fcvt));
-  CHECK(INTERCEPT_FUNCTION(__fxstat));
-  CHECK(INTERCEPT_FUNCTION(__xstat));
-  CHECK(INTERCEPT_FUNCTION(__lxstat));
-  CHECK(INTERCEPT_FUNCTION(__fxstat64));
-  CHECK(INTERCEPT_FUNCTION(__xstat64));
-  CHECK(INTERCEPT_FUNCTION(__lxstat64));
-  CHECK(INTERCEPT_FUNCTION(pipe));
-  CHECK(INTERCEPT_FUNCTION(wait));
-  CHECK(INTERCEPT_FUNCTION(waitpid));
-  CHECK(INTERCEPT_FUNCTION(fgets));
-  CHECK(INTERCEPT_FUNCTION(fgets_unlocked));
-  CHECK(INTERCEPT_FUNCTION(getcwd));
-  CHECK(INTERCEPT_FUNCTION(realpath));
-  CHECK(INTERCEPT_FUNCTION(getrlimit));
-  CHECK(INTERCEPT_FUNCTION(getrlimit64));
-  CHECK(INTERCEPT_FUNCTION(statfs));
-  CHECK(INTERCEPT_FUNCTION(fstatfs));
-  CHECK(INTERCEPT_FUNCTION(statfs64));
-  CHECK(INTERCEPT_FUNCTION(fstatfs64));
-  CHECK(INTERCEPT_FUNCTION(uname));
-  CHECK(INTERCEPT_FUNCTION(epoll_wait));
-  CHECK(INTERCEPT_FUNCTION(epoll_pwait));
-  CHECK(INTERCEPT_FUNCTION(recv));
-  CHECK(INTERCEPT_FUNCTION(recvfrom));
-  CHECK(INTERCEPT_FUNCTION(recvmsg));
+  INTERCEPT_FUNCTION(mmap);
+  INTERCEPT_FUNCTION(mmap64);
+  INTERCEPT_FUNCTION(posix_memalign);
+  INTERCEPT_FUNCTION(malloc);
+  INTERCEPT_FUNCTION(calloc);
+  INTERCEPT_FUNCTION(realloc);
+  INTERCEPT_FUNCTION(free);
+  INTERCEPT_FUNCTION(fread);
+  INTERCEPT_FUNCTION(fread_unlocked);
+  INTERCEPT_FUNCTION(read);
+  INTERCEPT_FUNCTION(pread);
+  INTERCEPT_FUNCTION(pread64);
+  INTERCEPT_FUNCTION(readlink);
+  INTERCEPT_FUNCTION(readdir);
+  INTERCEPT_FUNCTION(memcpy);
+  INTERCEPT_FUNCTION(memset);
+  INTERCEPT_FUNCTION(memmove);
+  INTERCEPT_FUNCTION(wmemset);
+  INTERCEPT_FUNCTION(wmemcpy);
+  INTERCEPT_FUNCTION(wmemmove);
+  INTERCEPT_FUNCTION(strcpy);  // NOLINT
+  INTERCEPT_FUNCTION(strdup);
+  INTERCEPT_FUNCTION(strncpy);  // NOLINT
+  INTERCEPT_FUNCTION(strlen);
+  INTERCEPT_FUNCTION(strnlen);
+  INTERCEPT_FUNCTION(gcvt);
+  INTERCEPT_FUNCTION(strcat);  // NOLINT
+  INTERCEPT_FUNCTION(strncat);  // NOLINT
+  INTERCEPT_FUNCTION(strtol);
+  INTERCEPT_FUNCTION(strtoll);
+  INTERCEPT_FUNCTION(strtoul);
+  INTERCEPT_FUNCTION(strtoull);
+  INTERCEPT_FUNCTION(vsprintf);
+  INTERCEPT_FUNCTION(vsnprintf);
+  INTERCEPT_FUNCTION(vswprintf);
+  INTERCEPT_FUNCTION(sprintf);  // NOLINT
+  INTERCEPT_FUNCTION(snprintf);
+  INTERCEPT_FUNCTION(swprintf);
+  INTERCEPT_FUNCTION(strftime);
+  INTERCEPT_FUNCTION(wcstombs);
+  INTERCEPT_FUNCTION(mbstowcs);
+  INTERCEPT_FUNCTION(wcslen);
+  INTERCEPT_FUNCTION(wcschr);
+  INTERCEPT_FUNCTION(wcscpy);
+  INTERCEPT_FUNCTION(wcscmp);
+  INTERCEPT_FUNCTION(wcstod);
+  INTERCEPT_FUNCTION(getenv);
+  INTERCEPT_FUNCTION(gettimeofday);
+  INTERCEPT_FUNCTION(fcvt);
+  INTERCEPT_FUNCTION(__fxstat);
+  INTERCEPT_FUNCTION(__xstat);
+  INTERCEPT_FUNCTION(__lxstat);
+  INTERCEPT_FUNCTION(__fxstat64);
+  INTERCEPT_FUNCTION(__xstat64);
+  INTERCEPT_FUNCTION(__lxstat64);
+  INTERCEPT_FUNCTION(pipe);
+  INTERCEPT_FUNCTION(wait);
+  INTERCEPT_FUNCTION(waitpid);
+  INTERCEPT_FUNCTION(fgets);
+  INTERCEPT_FUNCTION(fgets_unlocked);
+  INTERCEPT_FUNCTION(getcwd);
+  INTERCEPT_FUNCTION(realpath);
+  INTERCEPT_FUNCTION(getrlimit);
+  INTERCEPT_FUNCTION(getrlimit64);
+  INTERCEPT_FUNCTION(statfs);
+  INTERCEPT_FUNCTION(fstatfs);
+  INTERCEPT_FUNCTION(statfs64);
+  INTERCEPT_FUNCTION(fstatfs64);
+  INTERCEPT_FUNCTION(uname);
+  INTERCEPT_FUNCTION(epoll_wait);
+  INTERCEPT_FUNCTION(epoll_pwait);
+  INTERCEPT_FUNCTION(recv);
+  INTERCEPT_FUNCTION(recvfrom);
+  INTERCEPT_FUNCTION(recvmsg);
   inited = 1;
 }
 }  // namespace __msan

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h?rev=170189&r1=170188&r2=170189&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h Fri Dec 14 05:52:02 2012
@@ -54,19 +54,19 @@
 #endif
 
 #if SANITIZER_INTERCEPT_READ
-# define INIT_READ CHECK(INTERCEPT_FUNCTION(read))
+# define INIT_READ INTERCEPT_FUNCTION(read)
 #else
 # define INIT_READ
 #endif
 
 #if SANITIZER_INTERCEPT_PREAD
-# define INIT_PREAD CHECK(INTERCEPT_FUNCTION(pread))
+# define INIT_PREAD INTERCEPT_FUNCTION(pread)
 #else
 # define INIT_PREAD
 #endif
 
 #if SANITIZER_INTERCEPT_PREAD64
-# define INIT_PREAD64 CHECK(INTERCEPT_FUNCTION(pread64))
+# define INIT_PREAD64 INTERCEPT_FUNCTION(pread64)
 #else
 # define INIT_PREAD64
 #endif





More information about the llvm-commits mailing list