On Wednesday 30 July 2014 14:28:22 Richard W.M. Jones wrote:
This refactors existing code to close file descriptors in the recovery process, and also adds code to close file descriptors between the fork() and exec() of QEMU or User-Mode Linux.
The reason is to avoid leaking main process file descriptors where the main process (or other libraries in the main process) are not setting O_CLOEXEC at all or not setting it atomically. Python is a particular culprit.
See also this OpenStack Nova bug report: https://bugs.launchpad.net/nova/+bug/1313477
Thanks: Qin Zhao for identifying and characterizing the problem in Nova.
This is version 2 of this commit. This commit is identical to the reverted commit 115fcc34325f965ac3723683e4462fc667dcd254 except that we don't close stderr.
LGTM. -- Pino Toscano