gecko-dev/ipc
Jed Davis b0a1468c01 Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj
This replaces some old Chromium code that tries to minimally disentangle
an arbitrary file descriptor mapping with simpler algorithm, for several
reasons:

1. Do something appropriate when a file descriptor is mapped to the same
fd number in the child; currently they're ignored, which means they'll
be closed if they were close-on-exec.  This implementation duplicates
the fd twice in that case, which seems to be uncommon in practice; this
isn't maximally efficient but avoids special-case code.

2. Make this more generally applicable; the previous design is
specialized for arbitrary code running between fork and exec, but we
also want to use this on OS X with posix_spawn, which exposes a very
limited set of operations.

3. Avoid the use of C++ standard library iterators in async signal safe
code; the Chromium developers mention that this is a potential problem in
some debugging implementations that take locks.

4. In general the algorithm is simpler and should be more "obviously
correct"; more concretely, it should get complete coverage just by being
run normally in a debug build.

As a convenient side benefit, CloseSuperfluousFds now takes an arbitrary
predicate for which fds to leave open, which means it can be used in
other code that needs it without creating a fake fd mapping.

MozReview-Commit-ID: EoiRttrbrKL

--HG--
extra : rebase_source : 336e0ba9f56dc80f7347dc62617b4ad1efea7e7e
2018-04-25 17:44:08 -06:00
..
app Backed out 3 changesets (bug 1430857) for breaking tests on Windows Code Coverage builds a=backout 2018-02-07 15:02:58 +02:00
chromium Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj 2018-04-25 17:44:08 -06:00
contentproc Bug 1330529 - Part 3: Protect DLL loads in wmain instead of waiting until PluginProcessChild::Init. r=jimm 2018-02-02 22:53:34 -08:00
glue Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj 2018-04-25 17:44:08 -06:00
ipdl Bug 1451859 - Part 2: Add sanitizer coverage to a handful of places relevant to IPC. r=posidron 2018-04-05 15:48:11 -04:00
mscom Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
testshell Bug 1466501 part 1 - Refactor ZoneSpecifier and add a sameCompartmentAs option to newGlobal in the shell. r=luke 2018-06-07 10:02:10 +02:00
moz.build Bug 1412258 - Get rid of ipc/dbus, r=smaug 2017-10-27 18:41:40 +02:00
pull-chromium.py