Described in , signal handlers running in a vfork child have opportunities to corrupt the parent's state. posix_spawn should handle this by blocking all signals before vfork(2) then resetting all signal handlers in the child before restoring the old signal mask.
Some level of tracking signals that might have handlers has been added to sigaction; this isn't expected to be completely accurate, just a heuristic that we use to reduce the number of syscalls required to reset non-default signal handlers.
Addressing this has been identified as a prerequisite to using posix_spawn in subprocess on FreeBSD .
I contemplated pushing the signal reset bits further down into the vfork child and doing them as we're processing spawnattr (and something similar to the current approach if sa == NULL), but I wasn't sure if the added complexity was worth the trade-off.