summaryrefslogtreecommitdiff
path: root/lib/esan/esan_interceptors.cpp
diff options
context:
space:
mode:
authorMike Aizatsky <aizatsky@chromium.org>2016-05-03 21:49:56 +0000
committerMike Aizatsky <aizatsky@chromium.org>2016-05-03 21:49:56 +0000
commit71107c138e2ac4a0365d1b48871488b8d941fb3a (patch)
tree2215369bb14f6832b24cc6b642d8f01ceeffe8f9 /lib/esan/esan_interceptors.cpp
parente32b2d7aa482778cf6656a3090025b8c6ea1668f (diff)
Revert "[sanitizer] Move stat/__xstat to the common interceptors"
This reverts commit 268440 because it breaks the windows bot. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21425/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/esan/esan_interceptors.cpp')
-rw-r--r--lib/esan/esan_interceptors.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/esan/esan_interceptors.cpp b/lib/esan/esan_interceptors.cpp
index be40032f5..479fde994 100644
--- a/lib/esan/esan_interceptors.cpp
+++ b/lib/esan/esan_interceptors.cpp
@@ -249,6 +249,23 @@ INTERCEPTOR(char *, strncpy, char *dst, char *src, uptr n) {
return REAL(strncpy)(dst, src, n);
}
+#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID
+INTERCEPTOR(int, stat, const char *path, void *buf) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, stat, path, buf);
+ COMMON_INTERCEPTOR_READ_STRING(ctx, path, 0);
+ return REAL(stat)(path, buf);
+#define ESAN_INTERCEPT_STAT INTERCEPT_FUNCTION(stat)
+#else
+INTERCEPTOR(int, __xstat, int version, const char *path, void *buf) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, __xstat, version, path, buf);
+ COMMON_INTERCEPTOR_READ_STRING(ctx, path, 0);
+ return REAL(__xstat)(version, path, buf);
+}
+#define ESAN_INTERCEPT_STAT INTERCEPT_FUNCTION(__xstat)
+#endif
+
#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_FREEBSD
INTERCEPTOR(int, __xstat64, int version, const char *path, void *buf) {
void *ctx;
@@ -396,6 +413,7 @@ void initializeInterceptors() {
INTERCEPT_FUNCTION(strcpy); // NOLINT
INTERCEPT_FUNCTION(strncpy);
+ ESAN_INTERCEPT_STAT;
ESAN_MAYBE_INTERCEPT_STAT64;
ESAN_MAYBE_INTERCEPT___XSTAT64;
ESAN_INTERCEPT_LSTAT;