From 71107c138e2ac4a0365d1b48871488b8d941fb3a Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Tue, 3 May 2016 21:49:56 +0000 Subject: 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 --- lib/msan/msan_interceptors.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/msan/msan_interceptors.cc') diff --git a/lib/msan/msan_interceptors.cc b/lib/msan/msan_interceptors.cc index d4ec590c5..e51fd17de 100644 --- a/lib/msan/msan_interceptors.cc +++ b/lib/msan/msan_interceptors.cc @@ -742,6 +742,26 @@ INTERCEPTOR(int, __fxstatat64, int magic, int fd, char *pathname, void *buf, #define MSAN_MAYBE_INTERCEPT___FXSTATAT64 #endif +#if SANITIZER_FREEBSD +INTERCEPTOR(int, stat, char *path, void *buf) { + ENSURE_MSAN_INITED(); + int res = REAL(stat)(path, buf); + if (!res) + __msan_unpoison(buf, __sanitizer::struct_stat_sz); + return res; +} +# define MSAN_INTERCEPT_STAT INTERCEPT_FUNCTION(stat) +#else +INTERCEPTOR(int, __xstat, int magic, char *path, void *buf) { + ENSURE_MSAN_INITED(); + int res = REAL(__xstat)(magic, path, buf); + if (!res) + __msan_unpoison(buf, __sanitizer::struct_stat_sz); + return res; +} +# define MSAN_INTERCEPT_STAT INTERCEPT_FUNCTION(__xstat) +#endif + #if !SANITIZER_FREEBSD INTERCEPTOR(int, __xstat64, int magic, char *path, void *buf) { ENSURE_MSAN_INITED(); @@ -1590,6 +1610,7 @@ void InitializeInterceptors() { INTERCEPT_FUNCTION(fcvt); MSAN_MAYBE_INTERCEPT___FXSTAT; MSAN_INTERCEPT_FSTATAT; + MSAN_INTERCEPT_STAT; MSAN_MAYBE_INTERCEPT___LXSTAT; MSAN_MAYBE_INTERCEPT___FXSTAT64; MSAN_MAYBE_INTERCEPT___FXSTATAT64; -- cgit v1.2.3