[PATCH] D54739: [Sanitizer] intercept setvbuf on other platforms where it is supported

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 20 13:35:01 PST 2018


devnexen updated this revision to Diff 174831.
devnexen added a comment.

unpoison the file.


https://reviews.llvm.org/D54739

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc
  lib/sanitizer_common/sanitizer_platform_interceptors.h
  test/sanitizer_common/TestCases/NetBSD/setvbuf.cc
  test/sanitizer_common/TestCases/Posix/setvbuf.cc


Index: test/sanitizer_common/TestCases/Posix/setvbuf.cc
===================================================================
--- test/sanitizer_common/TestCases/Posix/setvbuf.cc
+++ test/sanitizer_common/TestCases/Posix/setvbuf.cc
@@ -1,5 +1,7 @@
 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
 
+// UNSUPPORTED: solaris
+
 #include <stdio.h>
 
 void print_something() {
Index: lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -516,7 +516,8 @@
 #define SANITIZER_INTERCEPT_TTYENT SI_NETBSD
 #define SANITIZER_INTERCEPT_PROTOENT SI_NETBSD
 #define SANITIZER_INTERCEPT_NETENT SI_NETBSD
-#define SANITIZER_INTERCEPT_SETVBUF SI_NETBSD
+#define SANITIZER_INTERCEPT_SETVBUF (SI_NETBSD || SI_FREEBSD || \
+  SI_LINUX || SI_MAC)
 #define SANITIZER_INTERCEPT_GETMNTINFO SI_NETBSD
 #define SANITIZER_INTERCEPT_MI_VECTOR_HASH SI_NETBSD
 
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -7306,6 +7306,8 @@
   int ret = REAL(setvbuf)(stream, buf, mode, size);
   if (buf)
     COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, size);
+  if (ret == 0)
+    unpoison_file(stream);
   return ret;
 }
 #define INIT_SETVBUF COMMON_INTERCEPT_FUNCTION(setvbuf)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54739.174831.patch
Type: text/x-patch
Size: 1547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181120/5c343b6b/attachment.bin>


More information about the llvm-commits mailing list