Commit Graph

7103 Commits

Author SHA1 Message Date
Sean Feng
57ae506e8e Bug 1731778 - Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
Spec: https://html.spec.whatwg.org/multipage/#coep:coep-credentialless

Credentialless is a new cross-origin embedder policy which allows us
to not enforcing CORP when loading cross-origin resources while
providing SharedArrayBuffer.

There are two main things involved here:
  1. Fetching cross-origin no-CORS resources omits credentials
     - This is done by applying `LOAD_ANONYMOUS` flag to the request
  2. Other requests sent with credentials require the server's explicit
  permission through the CORS protocol or the CORS header
     - This is done by expanding `ProcessCrossOriginResourcePolicyHeader`
     function to apply the necessary checks.

Differential Revision: https://phabricator.services.mozilla.com/D147802
2022-06-22 13:13:39 +00:00
Manuel Bucher
ca3a2d7b60 no bug - Fix indentation of bullet list in ipdl document DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D149969
2022-06-22 09:52:06 +00:00
Narcis Beleuzu
c0460c4da1 Backed out 2 changesets (bug 1731778) for wpt failures on embedding.tentative.https.window.html . CLOSED TREE
Backed out changeset 2510b654e8f2 (bug 1731778)
Backed out changeset fea9b21d8efe (bug 1731778)
2022-06-21 19:13:32 +03:00
Sean Feng
9ea06e871f Bug 1731778 - Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
Spec: https://html.spec.whatwg.org/multipage/#coep:coep-credentialless

Credentialless is a new cross-origin embedder policy which allows us
to not enforcing CORP when loading cross-origin resources while
providing SharedArrayBuffer.

There are two main things involved here:
  1. Fetching cross-origin no-CORS resources omits credentials
     - This is done by applying `LOAD_ANONYMOUS` flag to the request
  2. Other requests sent with credentials require the server's explicit
  permission through the CORS protocol or the CORS header
     - This is done by expanding `ProcessCrossOriginResourcePolicyHeader`
     function to apply the necessary checks.

Differential Revision: https://phabricator.services.mozilla.com/D147802
2022-06-21 13:56:52 +00:00
Jens Stutte
e5b5f8d155 Bug 1775112 - Remove obsolete MessageChannel::Begin/StopPostponingSends feature. r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D149775
2022-06-21 06:18:31 +00:00
Jens Stutte
ea8c651c07 Bug 1775076 - Reduce shutdown log verbosity of IdleSchedulerChild r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D149752
2022-06-20 12:55:12 +00:00
Jed Davis
4db39d8f8d Bug 1770905 - Allow GeckoMediaPlugin processes on Linux to be profiled if memfd_create is available. r=gcp,mstange,media-playback-reviewers,padenot
There are two parts to this patch; both affect only Linux:

1. The GMP sandbox policy is adjusted to allow certain syscalls used in
   shared memory creation (ftruncate and fallocate).  However, the file
   broker is not used; the process still has no access to files in /dev/shm.

2. The profiler is not initialized for GMP processes unless memfd_create
   is available (so the process can create shared memory to send
   profiling data back, without filesystem access), or the GMP sandbox
   is disabled (either at runtime or build time).

As of this patch, profiling GMP processes on Linux should succeed on
distros with kernel >=3.17 (Oct. 2014), but native stack frames won't
have symbols (and may be incorrectly unwound, not that it matters much
without symbols); see the bug for more info.  Pseudo-stack frames and
markers should work, however.

Differential Revision: https://phabricator.services.mozilla.com/D148470
2022-06-15 20:55:24 +00:00
Sylvestre Ledru
9ffafce8cc Bug 1519636 - Reformat recent changes to the Google coding style r=andi,media-playback-reviewers,necko-reviewers,padenot,dragana
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D148375
2022-06-07 12:32:55 +00:00
Haik Aftandilian
5da4658fb1 Bug 1562756 - Code Injection in Firefox macOS desktop r=spohl
Drop the com.apple.security.cs.allow-dyld-environment-variables entitlement to disallow use of dyld environment variables in signed production builds.

Leave the entitlement in for signed developer builds.

Firefox gtests depend on the use of DYLD_LIBRARY_PATH. However, testing infrastructure does not run gtests on signed builds and therefore gtests are not impacted by this change. gtests could be run on signed developer builds in the future which will still allow dyld environment variables after this change.

browser.production.entitlements.xml and plugin-container.production.entitlements.xml are not used, but being kept up to date.

Differential Revision: https://phabricator.services.mozilla.com/D148324
2022-06-06 16:42:02 +00:00
Haik Aftandilian
3200a749a4 Bug 1770484 - Make Mac processes not depend on DYLD_LIBRARY_PATH to load libraries r=glandium,gsvelto,mac-reviewers,necko-reviewers,dragana,spohl
Change XUL and other dylibs to be built with an @rpath/<dylib> install name (LC_ID_DYLIB) instead of @executable_path/<dylib>.

Change executables to be built with an @rpath dyld search path set to @executable_path by default so that @rpath/<dylib> dylibs in the same directory can be resolved. For executables not in the same directory as @rpath dylibs, such as plugin-container, set a relative @rpath such as @executable_path/../../../.

Previously, dylib install names were set as @executable_path/<dylib> allowing them to be resolved by dyld for the loading executable if the executable resided in the same directory as the dylib. For executables not in the same directory as the dylibs, dyld resolved these dylibs using DYLD_LIBRARY_PATH set before launching the process by Firefox code. With this change, loading does not rely on DYLD environment variables. Instead, dylibs have an install name set as @rpath/<dylib> and each executable loading a dylib has its @rpath set at compile-time to refer to dylib directory.

Differential Revision: https://phabricator.services.mozilla.com/D147360
2022-06-03 21:14:01 +00:00
ssengupta
0663cb1cf9 Bug 1636050 - PCache protocol is now refcounted r=hsingh
Differential Revision: https://phabricator.services.mozilla.com/D85774
2022-06-03 08:58:30 +00:00
Nika Layzell
4f6a3e97bd Bug 1743020 - Part 4: Use MoveOnlyFunction in DataPipe, r=ipc-reviewers,mccr8
This is mostly a simple use-case for the type which I was aware of and
could use to ensure it builds correctly.

Differential Revision: https://phabricator.services.mozilla.com/D145692
2022-06-02 13:24:10 +00:00
Nika Layzell
1a428600f7 Bug 1771234 - Make it easier to use a specific serial event target when binding an actor, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D147381
2022-06-01 14:35:16 +00:00
James Teh
a5bbb3b053 Bug 1756728 part 3: Remove now unused PDocAccessible::URL. r=morgan,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D147718
2022-06-01 00:34:18 +00:00
Alexandre Lissy
27959fdf87 Bug 1771416 - Disable utility audio tests on Android Isolated Process r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D147491
2022-05-27 19:08:48 +00:00
Alexandre Lissy
ff97f05636 Bug 1767930 - Test for Utility AudioDecoder on Android r=alwu,jolin
Differential Revision: https://phabricator.services.mozilla.com/D145896
2022-05-26 23:00:08 +00:00
Alexandre Lissy
9c84555a47 Bug 1767930 - Enable Utility AudioDecoder for Android r=jolin
Differential Revision: https://phabricator.services.mozilla.com/D145785
2022-05-26 23:00:07 +00:00
Nika Layzell
ec95ab6312 Bug 1769593 - Part 2: Improve reporting of fatal DataPipe (de)serialization errors, r=jld
Depends on D146501

Differential Revision: https://phabricator.services.mozilla.com/D146502
2022-05-26 20:16:09 +00:00
Nika Layzell
7ef81981b6 Bug 1769593 - Part 1: Fail when serializing file handles in excess of MAX_DESCRIPTORS_PER_MESSAGE, r=jld
Differential Revision: https://phabricator.services.mozilla.com/D146501
2022-05-26 20:16:09 +00:00
Alexandre Lissy
a92475cb0a Bug 1770241 - Move SetThisProcessName() to avoid risky GetCurrentProcess() r=haik
Differential Revision: https://phabricator.services.mozilla.com/D146964
2022-05-25 20:59:32 +00:00
Nika Layzell
16a529b054 Bug 1767514 - Part 3: Retry sending fds if sendmsg fails, r=ipc-reviewers,jld
Before this change, we wouldn't re-try sending fds if the first attempt
to send them failed, meaning that some fds wouldn't arrive if there was
any error sending (e.g. because the send buffer was full, which
is more common on macOS).

This new approach ensures we don't record that we've sent the fds until
the message is marked as successful, and should avoid the macOS errors.

Depends on D145392

Differential Revision: https://phabricator.services.mozilla.com/D146621
2022-05-24 14:41:11 +00:00
Nika Layzell
1e44ed00b5 Bug 1767514 - Part 2: Increase the attached handle limit for IPC Messages, r=ipc-reviewers,jld
This is made possible by part 1, which made it possible to send more messages
using IPC::Channel. A limit is still in place, however it is now substantially
higher, hopefully making it effectively unlimited for practical purposes.

Differential Revision: https://phabricator.services.mozilla.com/D145392
2022-05-24 14:41:10 +00:00
Nika Layzell
26c9f005e8 Bug 1767514 - Part 1: Decouple the IPC::Message max handle count and the number of FDs supported by IPC::Channel, r=ipc-reviewers,jld
This is done by splitting messages with large numbers of handles into multiple
`sendmsg` calls, each of which contains less than the maximum number of
transferred handles per-message, and stitching the message back together on the
receiving side. Most of the work on the receiving side was already handled by
the IPC::Channel code, so the work required was only to ensure we could split
the handle list up when sending.

Differential Revision: https://phabricator.services.mozilla.com/D145391
2022-05-24 14:41:10 +00:00
Jan Varga
c7fef40065 Bug 1759993 - QM: Introduce QM_IPC_FAIL macro; r=ipc-reviewers,mccr8,hsingh
Differential Revision: https://phabricator.services.mozilla.com/D141336
2022-05-24 14:39:13 +00:00
Tim Huang
16ca4ac112 Bug 1768193 - Part 1: Use maybe to hold mIsThirdPartyContextToTopWindow in LoadInfo. r=anti-tracking-reviewers,necko-reviewers,bvandersloot,kershaw
In order to know if the mIsThirdPartyContextToTopWindow was set in the
loadInfo of the channel, we use maybe to hold the value. So, we can know
if it was set before.

This patch also addes two methods in LoadInfo to clear and know if the
value is set.

Differential Revision: https://phabricator.services.mozilla.com/D146491
2022-05-24 08:17:28 +00:00
Bob Owen
c16bb16f27 Bug 1769845 p1: Use command line to pass whether win32k is locked down in policy. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D146930
2022-05-23 07:53:41 +00:00
Chris Martin
7f062b4b16 Bug 1769807 - Ensure Win32k state initialized before content launch. r=nalexander
Win32k Lockdown state must be initialized on the main thread, but currently
a process launcher may be the first thing to read it on the IPC Thread

Initializing Win32k Lockdown state also relies on the gfxPlatform being
initialized, but that also isn't explicit anywhere.

This patch ensures both things are true: Always ensure that Win32k State is
initialized before queuing a process launch to the IPC Thread, and always
ensure that gfxPlatform is initialized before attempting to read the
gfx state.

Differential Revision: https://phabricator.services.mozilla.com/D146821
2022-05-20 20:55:05 +00:00
Cristian Tuns
f043eddc84 Backed out changeset 9dc2f0c648e4 (bug 1769807) for causing mochitest failures on browser_xpcom_graph_wait.js CLOSED TREE 2022-05-20 14:01:26 -04:00
Chris Martin
990cdac9ef Bug 1769807 - Ensure Win32k state initialized before content launch r=bobowen,nalexander
Win32k Lockdown state must be initialized on the main thread, but currently
a process launcher may be the first thing to read it on the IPC Thread

Initializing Win32k Lockdown state also relies on the gfxPlatform being
initialized, but that also isn't explicit anywhere.

This patch ensures both things are true: Always ensure that Win32k State is
initialized before queuing a process launch to the IPC Thread, and always
ensure that gfxPlatform is initialized before attempting to read the
gfx state.

Differential Revision: https://phabricator.services.mozilla.com/D146821
2022-05-20 17:12:36 +00:00
Alexandre Lissy
dd4a3b2004 Bug 1769033 - Add OpenBSD sandboxing support r=gaston
Differential Revision: https://phabricator.services.mozilla.com/D146568
2022-05-20 08:25:04 +00:00
Alexandre Lissy
909c945d73 Bug 1769624 - Verify shutdown status before asserting r=nika
Differential Revision: https://phabricator.services.mozilla.com/D146567
2022-05-19 23:50:57 +00:00
Marian-Vasile Laza
661e44b86f Backed out changeset 0afbb1e34fe3 (bug 1769807) for causing bc failures on browser_xpcom_graph_wait.js. CLOSED TREE 2022-05-19 22:41:30 +03:00
Jed Davis
d3ec8b1cb7 Bug 1769182 - Allow the RDD process to use EGL under X11 on Linux. r=gcp
This patch mostly turns on the features set up by the earlier patches:
allow connecting to the X server and reading various related things
(.Xauthority, GPU device info in sysfs, etc.).  It also turns off Mesa's
shader cache in the RDD process; that shouldn't be needed here, and
disabling it lets us avoid dealing with a few things in the sandbox
policy that we'd rather not (e.g., `getpwuid`).

Differential Revision: https://phabricator.services.mozilla.com/D146275
2022-05-19 17:02:33 +00:00
Chris Martin
5e82271c3e Bug 1769807 - Ensure Win32k state initialized before content launch r=bobowen
Win32k Lockdown state must be initialized on the main thread, but currently
a process launcher may be the first thing to read it on the IPC Thread

Initializing Win32k Lockdown state also relies on the gfxPlatform being
initialized, but that also isn't explicit anywhere.

This patch ensures both things are true: Always ensure that Win32k State is
initialized before queuing a process launch to the IPC Thread, and always
ensure that gfxPlatform is initialized before attempting to read the
gfx state.

Differential Revision: https://phabricator.services.mozilla.com/D146821
2022-05-19 15:51:12 +00:00
Butkovits Atila
e245d0f18b Backed out changeset 7b69c225f7c7 (bug 1769624) because the patch is not ready yet. CLOSED TREE 2022-05-18 01:40:17 +03:00
Alexandre Lissy
6d2d8b7128 Bug 1769624 - Verify shutdown status before asserting r=nika
Differential Revision: https://phabricator.services.mozilla.com/D146567
2022-05-17 20:44:24 +00:00
Andrew McCreight
9ebb07c91b Bug 1514936, part 2 - Drop the outer arguments from static components. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D146457
2022-05-17 20:24:19 +00:00
Alexandre Lissy
234c216198 Bug 1769547 - Do not MOZ_CRASH() on missing process r=nika
Differential Revision: https://phabricator.services.mozilla.com/D146462
2022-05-16 17:02:44 +00:00
Alexandre Lissy
41e2b5def7 Bug 1767582 - Enable Utility AudioDecoder on Nightly r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D145584
2022-05-16 11:07:26 +00:00
Molnar Sandor
fc72ff9ad5 Backed out 5 changesets (bug 1743020) for causing linux build bustages in function2.hpp CLOSED TREE
Backed out changeset cf237471cf75 (bug 1743020)
Backed out changeset 78eb51447ce5 (bug 1743020)
Backed out changeset c486f95d55ec (bug 1743020)
Backed out changeset c0abfda55404 (bug 1743020)
Backed out changeset 16be18ca73fb (bug 1743020)
2022-05-14 10:31:12 +03:00
Iulian Moraru
5ca17127ae Backed out 5 changesets (bug 1769182) for causing mochitest failures on browser_sandbox_test.js. CLOSED TREE
Backed out changeset f5b71a28f28b (bug 1769182)
Backed out changeset 7a64faec004f (bug 1769182)
Backed out changeset c7833370362a (bug 1769182)
Backed out changeset b91adae9bb59 (bug 1769182)
Backed out changeset cf7bb9b7414d (bug 1769182)
2022-05-14 05:20:37 +03:00
Jed Davis
ce67f060b8 Bug 1769182 - Allow the RDD process to use EGL under X11 on Linux. r=gcp
This patch mostly turns on the features set up by the earlier patches:
allow connecting to the X server and reading various related things
(.Xauthority, GPU device info in sysfs, etc.).  It also turns off Mesa's
shader cache in the RDD process; that shouldn't be needed here, and
disabling it lets us avoid dealing with a few things in the sandbox
policy that we'd rather not (e.g., `getpwuid`).

Differential Revision: https://phabricator.services.mozilla.com/D146275
2022-05-14 00:42:56 +00:00
Nika Layzell
da7fa3b872 Bug 1743020 - Part 4: Use MoveOnlyFunction in DataPipe, r=ipc-reviewers,mccr8
This is mostly a simple use-case for the type which I was aware of and
could use to ensure it builds correctly.

Differential Revision: https://phabricator.services.mozilla.com/D145692
2022-05-13 23:43:53 +00:00
Alexandre Lissy
6ec586fd3e Bug 1768411 - Test Utility AudioDecoder crash recovery r=alwu,nika
Differential Revision: https://phabricator.services.mozilla.com/D146100
2022-05-13 18:47:28 +00:00
Nika Layzell
3b6702b10f Bug 1754004 - Part 11: Simplify the IPCStream serialization API, r=asuth,necko-reviewers,kershaw
As serializing IPCStream no longer requires a manager or FileDescriptor array,
the arguments are no longer necessary, and can be removed. The AutoIPCStream
helper can also be removed, as managed actors are no longer used for
serialization, so a delayed start callback is not necessary.

The delayed start parameter is also removed from nsIIPCSerializableInputStream
instances, but is still present as `aAllowLazy` on the toplevel serialization
methods.

Differential Revision: https://phabricator.services.mozilla.com/D141048
2022-05-13 14:16:13 +00:00
Nika Layzell
6f56b5dcab Bug 1754004 - Part 6: Preserve MIME information when serializing a lazy stream, r=asuth,necko-reviewers,dragana
the nsIMIMEInputStream type contains extra metadata header information
which shouldn't be lost when serializing the type over IPC. This patch
changes the LazyStream serialization to take this into account and only
serialize the value within the nsMIMEInputStream when sending a lazy
stream over IPC.

This information is specifically used by HTTP channels in order to
populate POST request headers.

Differential Revision: https://phabricator.services.mozilla.com/D141043
2022-05-13 14:16:11 +00:00
Nika Layzell
1f4efe0c11 Bug 1754004 - Part 3: Move RemoteLazyInputStream to its own toplevel protocol, r=asuth,necko-reviewers,dragana
This is a complete rewrite of RemoteLazyInputStream to run off of its own
toplevel protocol, rather than being managed by other protocols like
PBackground or PContent. This should improve performance thanks to no longer
needing to operate on a main or worker thread, and due to no longer needing the
migration step for the stream actor.

This also acts as a step towards no longer requiring a manager actor to
serialize input streams, as the type is now actor-agnostic, and should support
being sent over IPC between any pair of processes.

Differential Revision: https://phabricator.services.mozilla.com/D141040
2022-05-13 14:16:10 +00:00
Nika Layzell
cf6d954531 Bug 1754004 - Part 2: Remove the PFileDescriptorSet interface, r=asuth,necko-reviewers,kershaw
This interface should no longer be required due to the changes in part 1
limiting the complexity of IPCStream instances and limiting the number of file
descriptors which a single stream can attach to a message.

Removing this interface is necessary to serialize nsIInputStream instances over
arbitrary toplevel protocols and non-protocol IPC in the future.

Differential Revision: https://phabricator.services.mozilla.com/D141039
2022-05-13 14:16:09 +00:00
Nika Layzell
d1b9f58acb Bug 1754004 - Part 1: Switch IPCStream to use DataPipe instead of P{ChildToParent,ParentToChild}Stream, r=asuth,necko-reviewers,kershaw
This gives us various positive benefits, such as using a shared memory ring
buffer for faster communication, not having data streaming being bound to the
thread which transferred the nsIInputStream (which is often the main thread),
and the ability for some backpressure to be applied to data streaming.

After this change, the "delayed start" parameter for IPCStream serialization is
less relevant, as backpressure will serve a similar purpose. It will still be
used to determine whether or not to use RemoteLazyInputStream when serializing
from the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D141038
2022-05-13 14:16:09 +00:00
Nika Layzell
14a97bf8b4 Bug 1759563 - Add SerializedComplexity to limit the complexity of serialized IPCStream instances, r=asuth,necko-reviewers,dragana
This will improve the efficiency of serializing large data pipes, which in bad
cases can end up serializing very small amounts of data in individual pipes
over IPC, and acts as a compliment to the existing logic for limiting
serialized message sizes. It is also necessary for the changes in bug 1754004,
which require the ability to include FileDescriptor inline in the message,
which could blow out our FileDescriptor count limits if pipe creation was
unlimited.

In some tests, this change reduces the number of pipes required to serialize a
nsIInputStream from over 5000 to 1.

Differential Revision: https://phabricator.services.mozilla.com/D141036
2022-05-13 14:16:08 +00:00