[compiler-rt] r179054 - Revert r179012: "[msan] Intercept glob()."

Chandler Carruth chandlerc at gmail.com
Mon Apr 8 13:59:45 PDT 2013


Author: chandlerc
Date: Mon Apr  8 15:59:44 2013
New Revision: 179054

URL: http://llvm.org/viewvc/llvm-project?rev=179054&view=rev
Log:
Revert r179012: "[msan] Intercept glob()."

This was committed without tests and contains obvious bugs. That's not
acceptable. It broke address sanitizer for most programs using glob(3).

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=179054&r1=179053&r2=179054&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Mon Apr  8 15:59:44 2013
@@ -549,53 +549,6 @@ INTERCEPTOR(int, setitimer, int which, c
 #endif
 
 
-#if SANITIZER_INTERCEPT_GLOB
-struct sanitizer_glob_t {
-  SIZE_T gl_pathc;
-  char **gl_pathv;
-};
-
-static void unpoison_glob_t(void *ctx, sanitizer_glob_t *pglob) {
-  COMMON_INTERCEPTOR_WRITE_RANGE(ctx, pglob, sizeof(*pglob));
-  // +1 for NULL pointer at the end.
-  COMMON_INTERCEPTOR_WRITE_RANGE(
-      ctx, pglob->gl_pathv,
-      (sizeof(pglob->gl_pathc) + 1) * sizeof(*pglob->gl_pathv));
-  for (SIZE_T i = 0; i < pglob->gl_pathc; ++i) {
-    char *p = pglob->gl_pathv[i];
-    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, p, REAL(strlen)(p) + 1);
-  }
-}
-
-INTERCEPTOR(int, glob, const char *pattern, int flags,
-            int (*errfunc)(const char *epath, int eerrno),
-            sanitizer_glob_t *pglob) {
-  void *ctx;
-  COMMON_INTERCEPTOR_ENTER(ctx, glob, pattern, flags, errfunc, pglob);
-  int res = REAL(glob)(pattern, flags, errfunc, pglob);
-  if (res == 0)
-    unpoison_glob_t(ctx, pglob);
-  return res;
-}
-
-INTERCEPTOR(int, glob64, const char *pattern, int flags,
-            int (*errfunc)(const char *epath, int eerrno),
-            sanitizer_glob_t *pglob) {
-  void *ctx;
-  COMMON_INTERCEPTOR_ENTER(ctx, glob64, pattern, flags, errfunc, pglob);
-  int res = REAL(glob64)(pattern, flags, errfunc, pglob);
-  if (res == 0)
-    unpoison_glob_t(ctx, pglob);
-  return res;
-}
-#define INIT_GLOB                               \
-  INTERCEPT_FUNCTION(glob);                     \
-  INTERCEPT_FUNCTION(glob64);
-#else // SANITIZER_INTERCEPT_GLOB
-#define INIT_GLOB
-#endif // SANITIZER_INTERCEPT_GLOB
-
-
 #define SANITIZER_COMMON_INTERCEPTORS_INIT                                     \
   INIT_STRCASECMP;                                                             \
   INIT_STRNCASECMP;                                                            \
@@ -614,5 +567,4 @@ INTERCEPTOR(int, glob64, const char *pat
   INIT_GETPWNAM_R_GETPWUID_R;                                                  \
   INIT_CLOCK_GETTIME;                                                          \
   INIT_GETITIMER;                                                              \
-  INIT_TIME;                                                                   \
-  INIT_GLOB;
+  INIT_TIME;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=179054&r1=179053&r2=179054&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Mon Apr  8 15:59:44 2013
@@ -64,4 +64,3 @@
 # define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_LINUX
 # define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS
 # define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS
-# define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc?rev=179054&r1=179053&r2=179054&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc Mon Apr  8 15:59:44 2013
@@ -297,8 +297,6 @@ void StatOutput(u64 *stat) {
   name[StatInt_getitimer]                = "  getitimer                       ";
   name[StatInt_setitimer]                = "  setitimer                       ";
   name[StatInt_time]                     = "  time                            ";
-  name[StatInt_glob]                     = "  glob                            ";
-  name[StatInt_glob64]                   = "  glob64                          ";
 
   name[StatAnnotation]                   = "Dynamic annotations               ";
   name[StatAnnotateHappensBefore]        = "  HappensBefore                   ";

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h?rev=179054&r1=179053&r2=179054&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h Mon Apr  8 15:59:44 2013
@@ -292,8 +292,6 @@ enum StatType {
   StatInt_getitimer,
   StatInt_setitimer,
   StatInt_time,
-  StatInt_glob,
-  StatInt_glob64,
 
   // Dynamic annotations.
   StatAnnotation,





More information about the llvm-commits mailing list