Closed Bug 1400042 Opened 4 years ago Closed 3 years ago

Remove base::SetAllFDsToCloseOnExec

Categories

(Core :: IPC, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: jld, Assigned: jld)

References

Details

Attachments

(1 file)

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.
Priority: -- → P3
Assignee: nobody → jld
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 jedavis@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/991ffc61729e
Remove SetAllFDsToCloseOnExec r=mccr8
https://hg.mozilla.org/mozilla-central/rev/991ffc61729e
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.