[compiler-rt] r328600 - Revert "[asan] Replace vfork with fork."

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 26 17:31:16 PDT 2018


Author: eugenis
Date: Mon Mar 26 17:31:16 2018
New Revision: 328600

URL: http://llvm.org/viewvc/llvm-project?rev=328600&view=rev
Log:
Revert "[asan] Replace vfork with fork."

Replacing vfork with fork results in significant slowdown of certain
apps (in particular, memcached).

This reverts r327752.

Removed:
    compiler-rt/trunk/test/asan/TestCases/Posix/vfork.cc
Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.cc
    compiler-rt/trunk/lib/asan/asan_interceptors.h

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=328600&r1=328599&r2=328600&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Mon Mar 26 17:31:16 2018
@@ -572,13 +572,6 @@ INTERCEPTOR(int, __cxa_atexit, void (*fu
 }
 #endif  // ASAN_INTERCEPT___CXA_ATEXIT
 
-#if ASAN_INTERCEPT_VFORK
-extern "C" int fork(void);
-INTERCEPTOR(int, vfork, void) {
-  return fork();
-}
-#endif  // ASAN_INTERCEPT_VFORK
-
 // ---------------------- InitializeAsanInterceptors ---------------- {{{1
 namespace __asan {
 void InitializeAsanInterceptors() {
@@ -656,10 +649,6 @@ void InitializeAsanInterceptors() {
   ASAN_INTERCEPT_FUNC(__cxa_atexit);
 #endif
 
-#if ASAN_INTERCEPT_VFORK
-  ASAN_INTERCEPT_FUNC(vfork);
-#endif
-
   InitializePlatformInterceptors();
 
   VReport(1, "AddressSanitizer: libc interceptors initialized\n");

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=328600&r1=328599&r2=328600&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h Mon Mar 26 17:31:16 2018
@@ -46,13 +46,11 @@ void InitializePlatformInterceptors();
 # define ASAN_INTERCEPT__LONGJMP 1
 # define ASAN_INTERCEPT_INDEX 1
 # define ASAN_INTERCEPT_PTHREAD_CREATE 1
-# define ASAN_INTERCEPT_VFORK 1
 #else
 # define ASAN_INTERCEPT_ATOLL_AND_STRTOLL 0
 # define ASAN_INTERCEPT__LONGJMP 0
 # define ASAN_INTERCEPT_INDEX 0
 # define ASAN_INTERCEPT_PTHREAD_CREATE 0
-# define ASAN_INTERCEPT_VFORK 0
 #endif
 
 #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \

Removed: compiler-rt/trunk/test/asan/TestCases/Posix/vfork.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/vfork.cc?rev=328599&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/vfork.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/vfork.cc (removed)
@@ -1,30 +0,0 @@
-// Test that vfork() is fork().
-// https://github.com/google/sanitizers/issues/925
-
-// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1
-
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-int volatile global;
-
-int main(int argc, char **argv) {
-  pid_t pid = vfork();
-  if (pid) {
-    // parent
-    int status;
-    int res;
-    do {
-      res = waitpid(pid, &status, 0);
-    } while (res >= 0 && !WIFEXITED(status) && !WIFSIGNALED(status));
-    assert(global == 0);
-  } else {
-    // child
-    global = 42;
-    _exit(0);
-  }
-
-  return 0;
-}




More information about the llvm-commits mailing list