gecko-dev/ipc/glue
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
..
BackgroundChild.h Bug 1462964: Remove obsolete nsIDOMBlob interface. r=bz 2018-05-21 17:32:44 -07:00
BackgroundChildImpl.cpp Bug 1201590 - WebMIDI Content implementation; r=baku,padenot 2017-11-15 11:18:58 -08:00
BackgroundChildImpl.h Bug 1201590 - WebMIDI Content implementation; r=baku,padenot 2017-11-15 11:18:58 -08:00
BackgroundImpl.cpp Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
BackgroundParent.h
BackgroundParentImpl.cpp Bug 1434553 - Implement nsIInputStreamLength and nsIAsyncInputStreamLength - part 2 - IPCBlobInputStream exposes nsIInputStreamLength, r=smaug 2018-05-23 07:12:35 +02:00
BackgroundParentImpl.h Bug 1252998 - StorageActivityService - part 1 - Introduce StorageActivityService to monitor origin activities, r=asuth 2018-04-18 18:19:10 +02:00
BackgroundUtils.cpp Bug 1468213 Propagate nsILoadInfo.serviceWorkerTaintingSynthesized and tainting values from parent process to child process. r=valentin 2018-06-11 12:54:22 -07:00
BackgroundUtils.h Bug 1441932 P3 Forward reserved client, initial client, and controller on Redirect2Verify message back to parent. r=mayhemer 2018-06-04 09:26:51 -07:00
BrowserProcessSubThread.cpp
BrowserProcessSubThread.h Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj 2017-11-05 19:37:28 -08:00
ByteBuf.h Bug 1379680. Add an ipc ByteBuf type. r=billm 2017-11-29 10:11:15 -05:00
CrashReporterClient.cpp Bug 1402519 - Remove MOZ_CRASHREPORTER directives from ipc; r=billm 2017-10-10 12:06:35 +02:00
CrashReporterClient.h Bug 1402519 - Remove MOZ_CRASHREPORTER directives from ipc; r=billm 2017-10-10 12:06:35 +02:00
CrashReporterHost.cpp Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
CrashReporterHost.h Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
CrashReporterMetadataShmem.cpp Bug 1402519 - Remove MOZ_CRASHREPORTER directives from ipc; r=billm 2017-10-10 12:06:35 +02:00
CrashReporterMetadataShmem.h Bug 1402519 - Remove MOZ_CRASHREPORTER directives from ipc; r=billm 2017-10-10 12:06:35 +02:00
CrossProcessMutex_posix.cpp
CrossProcessMutex_unimplemented.cpp
CrossProcessMutex_windows.cpp
CrossProcessMutex.h
CrossProcessSemaphore_posix.cpp Allocate TextureReadLock at TextureClient creation and drop file handles immediately after. (bug 1416726, r=aosmond) 2018-03-12 08:10:13 -05:00
CrossProcessSemaphore_unimplemented.cpp Allocate TextureReadLock at TextureClient creation and drop file handles immediately after. (bug 1416726, r=aosmond) 2018-03-12 08:10:13 -05:00
CrossProcessSemaphore_windows.cpp Allocate TextureReadLock at TextureClient creation and drop file handles immediately after. (bug 1416726, r=aosmond) 2018-03-12 08:10:13 -05:00
CrossProcessSemaphore.h Allocate TextureReadLock at TextureClient creation and drop file handles immediately after. (bug 1416726, r=aosmond) 2018-03-12 08:10:13 -05:00
EnvironmentMap.h Bug 1297740. r=jld 2018-01-08 10:07:16 +01:00
FileDescriptor.cpp Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
FileDescriptor.h Bug 1440511 - Part 4: Add an IPDLParamTraits implementation for FileDescriptor, r=froydnj 2018-03-05 16:00:02 -05:00
FileDescriptorSetChild.cpp
FileDescriptorSetChild.h
FileDescriptorSetParent.cpp
FileDescriptorSetParent.h
FileDescriptorShuffle.cpp Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj 2018-04-25 17:44:08 -06:00
FileDescriptorShuffle.h Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj 2018-04-25 17:44:08 -06:00
FileDescriptorUtils.cpp
FileDescriptorUtils.h
GeckoChildProcessHost.cpp Bug 1461459: Add nightly-only release asserts in GeckoChildProcessHost::PerformAsyncLaunchInternal to investigate failures to asynchronously launch content processes. r=jld 2018-06-05 21:12:20 -04:00
GeckoChildProcessHost.h Bug 1348361 - Part 3 - Do not block the thread when spawning a gecko child process; r=jld 2018-02-16 10:24:21 -05:00
InputStreamParams.ipdlh Bug 1464090 - Implement InputStreamLengthWrapper to make any stream nsIInputStreamLength and nsIAsyncInputStreamLength, r=froydnj 2018-05-31 18:12:25 +02:00
InputStreamUtils.cpp Bug 1464090 - Implement InputStreamLengthWrapper to make any stream nsIInputStreamLength and nsIAsyncInputStreamLength, r=froydnj 2018-05-31 18:12:25 +02:00
InputStreamUtils.h
IOThreadChild.h
IPCMessageUtils.cpp
IPCMessageUtils.h Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
IPCStream.ipdlh Bug 1464090 - Passing the length if known via IPCStream and use InputStreamLengthWrapper when deserialized, r=froydnj, r=mayhemer 2018-05-31 18:12:25 +02:00
IPCStreamAlloc.h
IPCStreamChild.cpp
IPCStreamDestination.cpp Bug 1464090 - Passing the length if known via IPCStream and use InputStreamLengthWrapper when deserialized, r=froydnj, r=mayhemer 2018-05-31 18:12:25 +02:00
IPCStreamDestination.h Bug 1464090 - Passing the length if known via IPCStream and use InputStreamLengthWrapper when deserialized, r=froydnj, r=mayhemer 2018-05-31 18:12:25 +02:00
IPCStreamParent.cpp
IPCStreamSource.cpp Bug 1456911 - Prelude: Fix unified build breakage exposed by the next patch. r=froydnj 2018-05-11 20:25:19 -06:00
IPCStreamSource.h Bug 1456911 - Prelude: Fix unified build breakage exposed by the next patch. r=froydnj 2018-05-11 20:25:19 -06:00
IPCStreamUtils.cpp Bug 1464090 - Passing the length if known via IPCStream and use InputStreamLengthWrapper when deserialized, r=froydnj, r=mayhemer 2018-05-31 18:12:25 +02:00
IPCStreamUtils.h Bug 1443954 - Part 3: Add support for RefCounted types to IPDL, r=bz,froydnj,baku 2018-04-10 17:49:48 -04:00
IPDLParamTraits.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
MessageChannel.cpp Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
MessageChannel.h Backed out 3 changesets (bug 1451859) for causing Spidermonkey bustages on Linux x64 opt. 2018-06-07 09:10:35 +03:00
MessageLink.cpp Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
MessageLink.h
MessagePump.cpp Bug 1404198: Part 2j - Switch to NS_NewTimer* everywhere else. r=njn 2017-09-24 19:57:48 -07:00
MessagePump.h Bug 1448022 - make MessagePumpForAndroidUI's constructor explicit; r=jld 2018-03-27 10:51:32 -04:00
moz.build Bug 1456911 - Rewrite the fd shuffling to be simpler & handle identity mappings correctly. r=froydnj 2018-04-25 17:44:08 -06:00
Neutering.h
nsIIPCSerializableInputStream.h
nsIIPCSerializableURI.h Bug 1441688 - Remove nsIIPCSerializableURI.Deserialize r=mayhemer 2018-03-05 04:14:44 +01:00
PBackground.ipdl Bug 1252998 - StorageActivityService - part 1 - Introduce StorageActivityService to monitor origin activities, r=asuth 2018-04-18 18:19:10 +02:00
PBackgroundSharedTypes.ipdlh Bug 1414755 - Get rid of ContentPrincipalInfoOriginNoSuffix, r=bz, r=bkelly 2017-11-15 11:19:26 +01:00
PBackgroundTest.ipdl
PChildToParentStream.ipdl
PFileDescriptorSet.ipdl
PParentToChildStream.ipdl
ProcessChild.cpp
ProcessChild.h
ProcessUtils_bsd.cpp
ProcessUtils_linux.cpp
ProcessUtils_mac.mm
ProcessUtils_none.cpp
ProcessUtils.h
ProtocolTypes.ipdlh
ProtocolUtils.cpp Backed out 3 changesets (bug 1451859) for causing Spidermonkey bustages on Linux x64 opt. 2018-06-07 09:10:35 +03:00
ProtocolUtils.h Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
ScopedXREEmbed.cpp Backed out changeset 582d112281f9 (bug 1403366) 2017-10-04 01:27:07 +02:00
ScopedXREEmbed.h
SharedMemory_posix.cpp
SharedMemory_windows.cpp
SharedMemory.cpp
SharedMemory.h
SharedMemoryBasic_android.cpp
SharedMemoryBasic_android.h
SharedMemoryBasic_chromium.h Bug 1440199 - Part 2: Remove named mode from IPC shared memory. r=froydnj 2018-02-20 13:07:32 -07:00
SharedMemoryBasic_mach.h
SharedMemoryBasic_mach.mm Bug 1465667 - Call mach_make_memory_entry_64 with MAP_MEM_NAMED_CREATE to exceed the 128mb limit on macOS r=jld 2018-06-01 19:43:54 +02:00
SharedMemoryBasic.h
Shmem.cpp Bug 1452657 - rename IPDL-private Shmem token struct to something more professional; r=mccr8 2018-04-17 10:05:30 -04:00
Shmem.h Bug 1452657 - rename IPDL-private Shmem token struct to something more professional; r=mccr8 2018-04-17 10:05:30 -04:00
StringUtil.cpp
TaskFactory.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
Transport_posix.cpp Bug 1278361 - Step 2: Search-and-replace HANDLE_EINTR(close(...)) to use IGNORE_EINTR. r=froydnj 2018-04-10 14:36:00 -06:00
Transport_posix.h
Transport_win.cpp
Transport_win.h
Transport.h
URIParams.ipdlh Bug 1448058 - Remove nsIMutable from URI implementations r=mayhemer 2018-05-09 18:21:24 +02:00
URIUtils.cpp Bug 1466023 - nsHostObjectURI renamed BlobURL, r=qdot 2018-06-02 15:51:42 +02:00
URIUtils.h Bug 1443956 - Part 1: Support serializing nsIURI directly over IPDL, r=froydnj 2018-04-10 17:49:48 -04:00
WindowsMessageLoop.cpp Bug 1437167 - Part 1: Stop using PRIntervalTime as the argument to CondVar::Wait and Monitor::Wait, r=mstange, r=froydnj 2018-04-10 17:49:47 -04:00
WindowsMessageLoop.h