[compiler-rt] r210463 - [msan] Intercept __strto*_internal.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Mon Jun 9 03:41:22 PDT 2014


Author: eugenis
Date: Mon Jun  9 05:41:22 2014
New Revision: 210463

URL: http://llvm.org/viewvc/llvm-project?rev=210463&view=rev
Log:
[msan] Intercept __strto*_internal.

This should fix strtoimax/strtoumax on newer glibc.
https://code.google.com/p/memory-sanitizer/issues/detail?id=36

Modified:
    compiler-rt/trunk/lib/msan/msan_interceptors.cc
    compiler-rt/trunk/lib/msan/tests/msan_test.cc

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=210463&r1=210462&r2=210463&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Mon Jun  9 05:41:22 2014
@@ -362,23 +362,34 @@ INTERCEPTOR(char *, strncat, char *dest,
     INTERCEPTOR_STRTO_BODY(ret_type, func, nptr, endptr, base, loc);     \
   }
 
-INTERCEPTOR_STRTO(double, strtod)                           // NOLINT
-INTERCEPTOR_STRTO(float, strtof)                            // NOLINT
-INTERCEPTOR_STRTO(long double, strtold)                     // NOLINT
-INTERCEPTOR_STRTO_BASE(long, strtol)                        // NOLINT
-INTERCEPTOR_STRTO_BASE(long long, strtoll)                  // NOLINT
-INTERCEPTOR_STRTO_BASE(unsigned long, strtoul)              // NOLINT
-INTERCEPTOR_STRTO_BASE(unsigned long long, strtoull)        // NOLINT
-INTERCEPTOR_STRTO_LOC(double, strtod_l)                     // NOLINT
-INTERCEPTOR_STRTO_LOC(double, __strtod_l)                   // NOLINT
-INTERCEPTOR_STRTO_LOC(float, strtof_l)                      // NOLINT
-INTERCEPTOR_STRTO_LOC(float, __strtof_l)                    // NOLINT
-INTERCEPTOR_STRTO_LOC(long double, strtold_l)               // NOLINT
-INTERCEPTOR_STRTO_LOC(long double, __strtold_l)             // NOLINT
-INTERCEPTOR_STRTO_BASE_LOC(long, strtol_l)                  // NOLINT
-INTERCEPTOR_STRTO_BASE_LOC(long long, strtoll_l)            // NOLINT
-INTERCEPTOR_STRTO_BASE_LOC(unsigned long, strtoul_l)        // NOLINT
-INTERCEPTOR_STRTO_BASE_LOC(unsigned long long, strtoull_l)  // NOLINT
+INTERCEPTOR_STRTO(double, strtod)                                    // NOLINT
+INTERCEPTOR_STRTO(float, strtof)                                     // NOLINT
+INTERCEPTOR_STRTO(long double, strtold)                              // NOLINT
+INTERCEPTOR_STRTO_BASE(long, strtol)                                 // NOLINT
+INTERCEPTOR_STRTO_BASE(long long, strtoll)                           // NOLINT
+INTERCEPTOR_STRTO_BASE(unsigned long, strtoul)                       // NOLINT
+INTERCEPTOR_STRTO_BASE(unsigned long long, strtoull)                 // NOLINT
+INTERCEPTOR_STRTO_LOC(double, strtod_l)                              // NOLINT
+INTERCEPTOR_STRTO_LOC(double, __strtod_l)                            // NOLINT
+INTERCEPTOR_STRTO_LOC(double, __strtod_internal)                     // NOLINT
+INTERCEPTOR_STRTO_LOC(float, strtof_l)                               // NOLINT
+INTERCEPTOR_STRTO_LOC(float, __strtof_l)                             // NOLINT
+INTERCEPTOR_STRTO_LOC(float, __strtof_internal)                      // NOLINT
+INTERCEPTOR_STRTO_LOC(long double, strtold_l)                        // NOLINT
+INTERCEPTOR_STRTO_LOC(long double, __strtold_l)                      // NOLINT
+INTERCEPTOR_STRTO_LOC(long double, __strtold_internal)               // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(long, strtol_l)                           // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(long, __strtol_l)                         // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(long, __strtol_internal)                  // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(long long, strtoll_l)                     // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(long long, __strtoll_l)                   // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(long long, __strtoll_internal)            // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(unsigned long, strtoul_l)                 // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(unsigned long, __strtoul_l)               // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(unsigned long, __strtoul_internal)        // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(unsigned long long, strtoull_l)           // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(unsigned long long, __strtoull_l)         // NOLINT
+INTERCEPTOR_STRTO_BASE_LOC(unsigned long long, __strtoull_internal)  // NOLINT
 
 // FIXME: support *wprintf in common format interceptors.
 INTERCEPTOR(int, vswprintf, void *str, uptr size, void *format, va_list ap) {
@@ -1485,23 +1496,34 @@ void InitializeInterceptors() {
   INTERCEPT_FUNCTION(gcvt);
   INTERCEPT_FUNCTION(strcat);  // NOLINT
   INTERCEPT_FUNCTION(strncat);  // NOLINT
+  INTERCEPT_FUNCTION(strtod);
+  INTERCEPT_FUNCTION(strtof);
+  INTERCEPT_FUNCTION(strtold);
   INTERCEPT_FUNCTION(strtol);
   INTERCEPT_FUNCTION(strtoll);
   INTERCEPT_FUNCTION(strtoul);
   INTERCEPT_FUNCTION(strtoull);
-  INTERCEPT_FUNCTION(strtod);
   INTERCEPT_FUNCTION(strtod_l);
   INTERCEPT_FUNCTION(__strtod_l);
-  INTERCEPT_FUNCTION(strtof);
+  INTERCEPT_FUNCTION(__strtod_internal);
   INTERCEPT_FUNCTION(strtof_l);
   INTERCEPT_FUNCTION(__strtof_l);
-  INTERCEPT_FUNCTION(strtold);
+  INTERCEPT_FUNCTION(__strtof_internal);
   INTERCEPT_FUNCTION(strtold_l);
   INTERCEPT_FUNCTION(__strtold_l);
+  INTERCEPT_FUNCTION(__strtold_internal);
   INTERCEPT_FUNCTION(strtol_l);
+  INTERCEPT_FUNCTION(__strtol_l);
+  INTERCEPT_FUNCTION(__strtol_internal);
   INTERCEPT_FUNCTION(strtoll_l);
+  INTERCEPT_FUNCTION(__strtoll_l);
+  INTERCEPT_FUNCTION(__strtoll_internal);
   INTERCEPT_FUNCTION(strtoul_l);
+  INTERCEPT_FUNCTION(__strtoul_l);
+  INTERCEPT_FUNCTION(__strtoul_internal);
   INTERCEPT_FUNCTION(strtoull_l);
+  INTERCEPT_FUNCTION(__strtoull_l);
+  INTERCEPT_FUNCTION(__strtoull_internal);
   INTERCEPT_FUNCTION(vswprintf);
   INTERCEPT_FUNCTION(swprintf);
   INTERCEPT_FUNCTION(strxfrm);

Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=210463&r1=210462&r2=210463&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Mon Jun  9 05:41:22 2014
@@ -1571,15 +1571,13 @@ TEST_STRTO_INT_LOC(strtoll_l)
 TEST_STRTO_INT_LOC(strtoul_l)
 TEST_STRTO_INT_LOC(strtoull_l)
 
-// https://code.google.com/p/memory-sanitizer/issues/detail?id=36
-TEST(MemorySanitizer, DISABLED_strtoimax) {
+TEST(MemorySanitizer, strtoimax) {
   char *e;
   ASSERT_EQ(1, strtoimax("1", &e, 10));
   EXPECT_NOT_POISONED((S8) e);
 }
 
-// https://code.google.com/p/memory-sanitizer/issues/detail?id=36
-TEST(MemorySanitizer, DISABLED_strtoumax) {
+TEST(MemorySanitizer, strtoumax) {
   char *e;
   ASSERT_EQ(1U, strtoumax("1", &e, 10));
   EXPECT_NOT_POISONED((S8) e);





More information about the llvm-commits mailing list