[compiler-rt] r211162 - [msan] Intercept __getdelim.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Wed Jun 18 06:35:13 PDT 2014
Author: eugenis
Date: Wed Jun 18 08:35:13 2014
New Revision: 211162
URL: http://llvm.org/viewvc/llvm-project?rev=211162&view=rev
Log:
[msan] Intercept __getdelim.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/trunk/test/msan/getline.cc
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=211162&r1=211161&r2=211162&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Jun 18 08:35:13 2014
@@ -3647,14 +3647,14 @@ INTERCEPTOR(SSIZE_T, getline, char **lin
}
return res;
}
-INTERCEPTOR(SSIZE_T, getdelim, char **lineptr, SIZE_T *n, int delim,
+INTERCEPTOR(SSIZE_T, __getdelim, char **lineptr, SIZE_T *n, int delim,
void *stream) {
void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, getdelim, lineptr, n, delim, stream);
+ COMMON_INTERCEPTOR_ENTER(ctx, __getdelim, lineptr, n, delim, stream);
// FIXME: under ASan the call below may write to freed memory and corrupt
// its metadata. See
// https://code.google.com/p/address-sanitizer/issues/detail?id=321.
- SSIZE_T res = REAL(getdelim)(lineptr, n, delim, stream);
+ SSIZE_T res = REAL(__getdelim)(lineptr, n, delim, stream);
if (res > 0) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lineptr, sizeof(*lineptr));
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, n, sizeof(*n));
@@ -3662,8 +3662,13 @@ INTERCEPTOR(SSIZE_T, getdelim, char **li
}
return res;
}
-#define INIT_GETLINE \
- COMMON_INTERCEPT_FUNCTION(getline); \
+INTERCEPTOR(SSIZE_T, getdelim, char **lineptr, SIZE_T *n, int delim,
+ void *stream) {
+ return __getdelim(lineptr, n, delim, stream);
+}
+#define INIT_GETLINE \
+ COMMON_INTERCEPT_FUNCTION(getline); \
+ COMMON_INTERCEPT_FUNCTION(__getdelim); \
COMMON_INTERCEPT_FUNCTION(getdelim);
#else
#define INIT_GETLINE
Modified: compiler-rt/trunk/test/msan/getline.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/getline.cc?rev=211162&r1=211161&r2=211162&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/getline.cc (original)
+++ compiler-rt/trunk/test/msan/getline.cc Wed Jun 18 08:35:13 2014
@@ -1,4 +1,9 @@
// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O2 %s -o %t && %run %t %p
+// RUN: %clang_msan -O0 -xc %s -o %t && %run %t %p
+// RUN: %clang_msan -O2 -xc %s -o %t && %run %t %p
+// RUN: %clang_msan -O0 -xc -D_GNU_SOURCE=1 %s -o %t && %run %t %p
+// RUN: %clang_msan -O2 -xc -D_GNU_SOURCE=1 %s -o %t && %run %t %p
#include <assert.h>
#include <stdio.h>
More information about the llvm-commits
mailing list