Closed Bug 1400042 Opened 4 years ago Closed 3 years ago
All FDs To Close On Exec
As the comments around it point out, base::SetAllFDsToCloseOnExec is inherently racy: another thread can create a non-close-on-exec fd after that function is called and before the spawn, which would then leak a copy into the child. APIs to create fds with the close-on-exec bit already set aren't always portable, and in practice aren't used consistently even when there is a standard. Currently, SetAllFDsToCloseOnExec is used by process_util_bsd and process_util_mac, because they use posix_spawn rather than fork and can't ru code to iterate open file descriptors in the forked child; I'll file platform-specific bugs for them.
As the comments indicate, it has unavoidable race conditions in a multithreaded program, and its call sites have all been removed.
Comment on attachment 9011169 [details] Bug 1400042 - Remove SetAllFDsToCloseOnExec Andrew McCreight [:mccr8] has approved the revision.
Attachment #9011169 - Flags: review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/991ffc61729e Remove SetAllFDsToCloseOnExec r=mccr8
You need to log in before you can comment on or make changes to this bug.