Index: lib/sanitizer_common/sanitizer_linux.cc =================================================================== --- lib/sanitizer_common/sanitizer_linux.cc +++ lib/sanitizer_common/sanitizer_linux.cc @@ -793,6 +793,14 @@ #endif } +int internal_vfork() { +#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS + return internal_syscall(SYSCALL(clone), CLONE_VM | CLONE_VFORK | SIGCHLD, 0); +#else + return internal_syscall(SYSCALL(vfork)); +#endif +} + #if SANITIZER_LINUX #define SA_RESTORER 0x04000000 // Doesn't set sa_restorer if the caller did not set it, so use with caution Index: lib/sanitizer_common/sanitizer_mac.cc =================================================================== --- lib/sanitizer_common/sanitizer_mac.cc +++ lib/sanitizer_common/sanitizer_mac.cc @@ -207,6 +207,10 @@ return fork(); } +int internal_vfork() { + return vfork(); +} + int internal_forkpty(int *amaster) { int master, slave; if (openpty(&master, &slave, nullptr, nullptr, nullptr) == -1) return -1; Index: lib/sanitizer_common/sanitizer_posix.h =================================================================== --- lib/sanitizer_common/sanitizer_posix.h +++ lib/sanitizer_common/sanitizer_posix.h @@ -58,6 +58,7 @@ uptr internal_waitpid(int pid, int *status, int options); int internal_fork(); +int internal_vfork(); int internal_forkpty(int *amaster); // These functions call appropriate pthread_ functions directly, bypassing Index: lib/sanitizer_common/sanitizer_posix_libcdep.cc =================================================================== --- lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -448,12 +448,12 @@ } }); - int pid = internal_fork(); + int pid = internal_vfork(); if (pid < 0) { int rverrno; if (internal_iserror(pid, &rverrno)) { - Report("WARNING: failed to fork (errno %d)\n", rverrno); + Report("WARNING: failed to vfork (errno %d)\n", rverrno); } return pid; }