PATCH [perl #106212] Add PL_perlio_mutex to atfork_lock/unlock
authorPatrik Hägglund <patrik.h.hagglund@ericsson.com>
Sat, 2 Feb 2013 19:21:05 +0000 (20:21 +0100)
committerKarl Williamson <public@khwilliamson.com>
Thu, 21 Mar 2013 18:11:18 +0000 (12:11 -0600)
commit4da80956418bbe1fdc23cad0b1cbb24cd7b87609
tree732a95c492ad5d982fdc710b26bfbadf0b0ef3c4
parentbe33f499c408bf256e1893d4bd68dd679a35eaac
PATCH [perl #106212] Add PL_perlio_mutex to atfork_lock/unlock

Using threads + fork() on Linux, and IO operations in the threads, the
PL_perlio_mutex may be left in a locked state at the call of fork(),
potentially leading to deadlock in the child process at subsequent IO
operations. (Threads are pre-empted and not continued in the child
process after the fork.)

Therefore, ensure that the PL_perlio_mutex is unlocked in the child
process, right after fork(), by using atfork_lock/unlock.

(The RT text gives ways to reproduce the problem, but are not easily
added to Perl's test suite)
util.c