gecko-dev/ipc/chromium
Jed Davis f81f999eeb Bug 1858272 - Change fork server protocol to send args/env directly to child processes. r=ipc-reviewers,nika
The argument and environment strings for a child process are now sent
directly to that process after it's forked, in a separate IPC message,
rather than to the fork server.  The initial message sent to the fork
server carries an attached socket used only for that request, which is
used to construct an additional `MiniTransceiver` instance for this new
message.

This ensures that those strings aren't present in the fork server's
address space and can't accidentally leak into other child processes;
currently there's some code that attempts to overwrite all copies of the
data in memory but this could be defeated by compiler optimizations,
library code making extra copies while resizing buffers, or other
mistakes.  It's safer to follow the principle of least privilege.

This patch also lays the groundwork for future changes to the fork
server protocol: if the per-request socket also carried the reply to
the fork request, the main channel could carry other messages in both
directions.  (This patch does not do that, yet; the main protocol still
contains the equivalent of exactly one sync message type.)

Note that file descriptors to be passed to the child process are still
sent to the fork server rather than directly to the child; this isn't
ideal, but it's harmless for security (we can be relatively sure that
fds are `close`d as intended and there are no accidental duplicates) and
it made the patches less complicated (this one and also bug 1858279).

Differential Revision: https://phabricator.services.mozilla.com/D205782
2024-09-10 19:05:28 +00:00
..
gtest Bug 1837550 - Re-enable tests. r=nika 2024-06-06 02:15:18 +00:00
src Bug 1858272 - Change fork server protocol to send args/env directly to child processes. r=ipc-reviewers,nika 2024-09-10 19:05:28 +00:00
chromium-config.mozbuild
moz.build