[compiler-rt] r347358 - Revert "[Sanitizer] intercept setvbuf on other platforms where it is supported"

David Carlier via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 20 14:50:31 PST 2018


Author: devnexen
Date: Tue Nov 20 14:50:31 2018
New Revision: 347358

URL: http://llvm.org/viewvc/llvm-project?rev=347358&view=rev
Log:
Revert "[Sanitizer] intercept setvbuf on other platforms where it is supported"

Added:
    compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/setvbuf.cc
Removed:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/setvbuf.cc
Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h

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=347358&r1=347357&r2=347358&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Tue Nov 20 14:50:31 2018
@@ -7306,8 +7306,6 @@ INTERCEPTOR(int, setvbuf, __sanitizer_FI
   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)

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=347358&r1=347357&r2=347358&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Tue Nov 20 14:50:31 2018
@@ -516,8 +516,7 @@
 #define SANITIZER_INTERCEPT_TTYENT SI_NETBSD
 #define SANITIZER_INTERCEPT_PROTOENT SI_NETBSD
 #define SANITIZER_INTERCEPT_NETENT SI_NETBSD
-#define SANITIZER_INTERCEPT_SETVBUF (SI_NETBSD || SI_FREEBSD || \
-  SI_LINUX || SI_MAC)
+#define SANITIZER_INTERCEPT_SETVBUF SI_NETBSD
 #define SANITIZER_INTERCEPT_GETMNTINFO SI_NETBSD
 #define SANITIZER_INTERCEPT_MI_VECTOR_HASH SI_NETBSD
 

Added: compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/setvbuf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/setvbuf.cc?rev=347358&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/setvbuf.cc (added)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/setvbuf.cc Tue Nov 20 14:50:31 2018
@@ -0,0 +1,67 @@
+// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
+
+#include <stdio.h>
+
+void print_something() {
+  for (size_t i = 0; i < 10 * BUFSIZ; i++)
+    printf("Hello world %zu\n", i);
+}
+
+void test_setbuf() {
+  char buf[BUFSIZ];
+
+  setbuf(stdout, NULL);
+
+  print_something();
+
+  setbuf(stdout, buf);
+
+  print_something();
+}
+
+void test_setbuffer() {
+  char buf[BUFSIZ];
+
+  setbuffer(stdout, NULL, 0);
+
+  print_something();
+
+  setbuffer(stdout, buf, BUFSIZ);
+
+  print_something();
+}
+
+void test_setlinebuf() {
+  setlinebuf(stdout);
+
+  print_something();
+}
+
+void test_setvbuf() {
+  char buf[BUFSIZ];
+
+  setvbuf(stdout, NULL, _IONBF, 0);
+
+  print_something();
+
+  setvbuf(stdout, buf, _IOLBF, BUFSIZ);
+
+  print_something();
+
+  setvbuf(stdout, buf, _IOFBF, BUFSIZ);
+
+  print_something();
+}
+
+int main(void) {
+  printf("setvbuf\n");
+
+  test_setbuf();
+  test_setbuffer();
+  test_setlinebuf();
+  test_setvbuf();
+
+  // CHECK: setvbuf
+
+  return 0;
+}

Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/setvbuf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/setvbuf.cc?rev=347357&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/setvbuf.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/setvbuf.cc (removed)
@@ -1,75 +0,0 @@
-// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
-
-// UNSUPPORTED: solaris
-
-#include <stdio.h>
-
-void print_something() {
-  for (size_t i = 0; i < 10 * BUFSIZ; i++)
-    printf("Hello world %zu\n", i);
-}
-
-// setbuffer/setlinebuf/setbuf uses setvbuf
-// internally on NetBSD
-#if defined(__NetBSD__)
-void test_setbuf() {
-  char buf[BUFSIZ];
-
-  setbuf(stdout, NULL);
-
-  print_something();
-
-  setbuf(stdout, buf);
-
-  print_something();
-}
-
-void test_setbuffer() {
-  char buf[BUFSIZ];
-
-  setbuffer(stdout, NULL, 0);
-
-  print_something();
-
-  setbuffer(stdout, buf, BUFSIZ);
-
-  print_something();
-}
-
-void test_setlinebuf() {
-  setlinebuf(stdout);
-
-  print_something();
-}
-#endif
-
-void test_setvbuf() {
-  char buf[BUFSIZ];
-
-  setvbuf(stdout, NULL, _IONBF, 0);
-
-  print_something();
-
-  setvbuf(stdout, buf, _IOLBF, BUFSIZ);
-
-  print_something();
-
-  setvbuf(stdout, buf, _IOFBF, BUFSIZ);
-
-  print_something();
-}
-
-int main(void) {
-  printf("setvbuf\n");
-
-#if defined(__NetBSD__)
-  test_setbuf();
-  test_setbuffer();
-  test_setlinebuf();
-#endif
-  test_setvbuf();
-
-  // CHECK: setvbuf
-
-  return 0;
-}




More information about the llvm-commits mailing list