Consider writing a mach_port_t IPC backend for OSX
Categories
(Core :: IPC, defect, P3)
Tracking
()
People
(Reporter: mattwoodrow, Assigned: nika, NeedInfo)
References
(Blocks 1 open bug)
Details
Attachments
(7 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Reporter | ||
Comment 1•7 years ago
|
||
![]() |
||
Updated•7 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 2•2 months ago
|
||
We have supported sending mach ports over IPC for many years (we've been using mach-based shared memory since bug 1161166, and have been brokering them in normal IPC messages since bug 1734735).
I'm re-purposing this bug to track actually switching the underlying IPC mechanism to use mach ports for IPC, similar to how Chrome and WebKit do. This will be important for Gecko on iOS, as the strategy we use for transferring mach ports on desktop will not work due to the sandbox on that platform.
Assignee | ||
Comment 3•2 months ago
|
||
This change to how IPC::Channel is declared will make it more feasible for the
specific channel implementation to be selected at runtime. This patch will use
this to allow selecting the IPC::Channel backend using a pref on macOS.
Assignee | ||
Comment 4•2 months ago
|
||
This adds a new message_pump implementation, MessagePumpKqueue. This new
implementation is compatible with the existing MessagePumpLibevent, but adds
support for also watching mach ports.
This also disables building libevent and MessagePumpLibevent on macOS, as it is
redundant.
Depends on D251392
Assignee | ||
Comment 5•2 months ago
|
||
This adds a new IPC::Channel implementation which can be selected at runtime by
a pref, which uses mach ports for sending and receiving messages.
Some additional complexity is required outside of the channel, as the
ChannelHandle type needs to handle multiple different underlying types now.
Depends on D251393
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Assignee | ||
Comment 6•2 months ago
|
||
The mode_ member on ChannelPosix and ChannelWin was completely unused before
this change, so this patch re-purposes it to replace the existing privileged_
and accept_handles_ flags, removing some platform-specific methods from the
Channel interface. This also removes the argument being passed around in
NodeChannel::Introduction arguments.
Depends on D251394
Assignee | ||
Comment 7•2 months ago
|
||
This is done by adding a new static ChannelKind vtable, which will be selected
as the IO thread is initialized, and used for all operations in NodeController
which care about the underlying channel implementation.
In addition to num_relayed_attachments
, create_raw_pipe
and a new
is_valid_handle
check were moved into the vtable as well, as they are
specific to a channel backend.
This required some changes to the NodeController interface to hide channel
creation better from callers.
Depends on D251640
Assignee | ||
Comment 8•2 months ago
|
||
This patch adds support to message_pump_kqueue for watching for SEND_POSSIBLE
and DEAD_NAME notifications for send rights from the kernel.
This is done in the message pump, rather than in the IPC::Channel directly, as
failing to process a queued DEAD_NAME notification from the kernel (e.g. due to
destroying a receive right with queued messages) can lead to a port leak. By
using a shared listener port in the message pump, this leak can be avoided.
Depends on D254419
Assignee | ||
Comment 9•28 days ago
|
||
Before this change, we would initialize IOThread much earlier during startup, before Preferences are available to read (which depends on the XPCOM component manager). After this change, starting the IOThread is done during XPCOM component startup, meaning preferences are available.
This will allow us to customize IPC configuration at startup based on Preferences in the parent process. Content processes still cannot depend on Prefs to be available.
Depends on D251640
Updated•28 days ago
|
Updated•28 days ago
|
Comment 10•13 days ago
|
||
Comment 11•13 days ago
|
||
Comment 12•13 days ago
|
||
Backed out for causing build bustages @ipc_channel_mach.cc.
Comment 13•8 days ago
|
||
(In reply to agoloman from comment #12)
Backed out for causing build bustages @ipc_channel_mach.cc.
Looks like a conflict with bug 1973598; see also this comment about argument-dependent lookup. Should be trivial to fix.
Description
•