[PATCH] D48451: [sanitizers_common] when spawning a subprocess for symbolizers, use posix_spawn instead of fork()

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 08:28:11 PDT 2018


eugenis added a comment.

In https://reviews.llvm.org/D48451#1140698, @alex wrote:

> Simply using `vfork` instead of `fork` is probably a no-go: the `vfork`'s man page (on macOS, I haven't verified the panoply of other BSDs) says that `EINVAL` is returned when "A system call other than `_exit()` or `execve()` (or libc functions that make no system calls other than those) is called following calling a `vfork()` call." That is, on platforms with this constraint using `vfork` where we currently use `fork` will fail, because we use other syscalls to do things like setup the file descriptor table.


Really? Is that actually the case in practice, or is the man page too cautious?  Cloning file descriptor tables should not make vfork any more expensive, and without that it is kinda useless. That's a pity.

I'd prefer to go with the smallest diff for now.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D48451





More information about the llvm-commits mailing list