summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-06-09 10:41:22 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-06-09 10:41:22 +0000
commit7080a0e243ec7cdb2a8f0adf691482561fbbcc7e (patch)
tree4913a9ea5c214f841fc2219ea11a1eca8f1b0fa2
parenta5819cb1bd07809cb1ea2f4ec0ff594ea2d942b8 (diff)
downloadcompiler-rt-7080a0e243ec7cdb2a8f0adf691482561fbbcc7e.tar.gz
[msan] Intercept __strto*_internal.
This should fix strtoimax/strtoumax on newer glibc. https://code.google.com/p/memory-sanitizer/issues/detail?id=36 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@210463 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/msan/msan_interceptors.cc62
-rw-r--r--lib/msan/tests/msan_test.cc6
2 files changed, 44 insertions, 24 deletions
diff --git a/lib/msan/msan_interceptors.cc b/lib/msan/msan_interceptors.cc
index e260ec35b..854c20534 100644
--- a/lib/msan/msan_interceptors.cc
+++ b/lib/msan/msan_interceptors.cc
@@ -362,23 +362,34 @@ INTERCEPTOR(char *, strncat, char *dest, const char *src, SIZE_T n) { // NOLINT
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);
diff --git a/lib/msan/tests/msan_test.cc b/lib/msan/tests/msan_test.cc
index 341687864..f1fca19c9 100644
--- a/lib/msan/tests/msan_test.cc
+++ b/lib/msan/tests/msan_test.cc
@@ -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);