Runtime.exec : vfork() concerns and a fix proposal

Martin Buchholz martinrb at
Wed Sep 12 15:55:55 UTC 2018

On Wed, Sep 12, 2018 at 7:33 AM, David Lloyd <david.lloyd at> wrote:
>> The child process is created using vfork(2) instead of fork(2) when [...] file_actions is NULL and the spawn-flags element of the attributes object pointed to by attrp does not contain POSIX_SPAWN_SETSIGMASK, POSIX_SPAWN_SETSIGDEF, POSIX_SPAWN_SETSCHEDPARAM, POSIX_SPAWN_SETSCHEDULER, POSIX_SPAWN_SETPGROUP, or POSIX_SPAWN_RESETIDS.

Yes, the posix_spawn man page says that, but

/* The Linux implementation of posix_spawn{p} uses the clone syscall directly
with CLONE_VM and CLONE_VFORK flags and an allocated stack. The new stack
and start function solves most the vfork limitation (possible parent
clobber due stack spilling).

More information about the core-libs-dev mailing list