gecko-dev/security
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
..
apps Bug 1464869 - Run autopep8 on security/ r=fkiefer 2018-05-26 06:47:27 -07:00
certverifier Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj 2018-06-01 17:59:07 +02:00
manager Bug 1463936 - Set default security.pki.name_matching_mode to enforce (3) for all builds. r=jcj 2018-06-11 14:52:07 -07:00
nss Bug 1460617, land NSS 30a4b03cd9d1 UPGRADE_NSS_RELEASE, r=me 2018-06-11 20:12:02 +02:00
pkix Bug 1464869 - Run autopep8 on security/ r=fkiefer 2018-05-26 06:47:27 -07:00
sandbox Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj 2018-04-25 17:44:08 -06:00
.eslintrc.js
generate_certdata.py Bug 1464869 - Run autopep8 on security/ r=fkiefer 2018-05-26 06:47:27 -07:00
generate_mapfile.py
moz.build Bug 1445763 - Update moz.build meta data with "Firefox Build System". r=froydnj 2018-03-14 21:44:46 +01:00
nss.symbols Bug 1429148 - Add nsIPK11Token.isInternalKeyToken. r=keeler,MattN 2018-02-20 20:43:41 -03:00