fix posix_spawn interaction with fork and abort by taking lock
authorRich Felker <dalias@aerifal.cx>
Thu, 1 Oct 2020 18:53:12 +0000 (14:53 -0400)
committerRich Felker <dalias@aerifal.cx>
Thu, 15 Oct 2020 00:27:12 +0000 (20:27 -0400)
commitb7bc966522d73e1dc420b5ee6fc7a2e78099a08c
tree56b9e575aba31d4d44f626c942641badb2dccefe
parent25ea9f712c30c32957de493d4711ee39d0bbb024
fix posix_spawn interaction with fork and abort by taking lock

this change prevents the child created concurrently with abort from
seeing the SIGABRT disposition change from SIG_IGN to SIG_DFL (other
changes are not visible anyway) and prevents leaking the write end of
the child pipe to children created by fork in another thread, which
may block return of posix_spawn indefinitely if the forked child does
not exit or exec.

along with other changes, this suggests that __abort_lock should
perhaps eventually be renamed to reflect that it's becoming a broader
lock on related "process lifetime" state.
src/process/posix_spawn.c