Commit graph

572 commits

Author SHA1 Message Date
Jed Davis
583d256da7 Bug 1840515 - Step 2: Preload the omnijars in the fork server. r=nika
This extends the previous support for `-greomni` and `-appomni` to the
fork server, so that it can pre-open the jar files and thus continue
using the correct versions in forked child processes even if the files on
disk are replaced by an update or deleted.

Differential Revision: https://phabricator.services.mozilla.com/D185331
2023-08-09 21:35:50 +00:00
Jed Davis
2ad421aaf8 Bug 1840515 - Step 1: Use -greomni/-appomni for content processes. r=nika,mhowell
Currently, each content process re-derives the path(s) of the omnijar
file(s).  We used to pass it down as a command-line argument, but
those args were also accepted by the parent process and there were
issues with that (CVE-2020-6799) such that they were completely removed
(bug 1531475).  However, content processes can generally trust their
arguments; note that they currently accept `-appDir`.

We were already using `-gredir` for this on Android (it has a unified
omnijar, so there's no `-appdir` in that case); this patch subsumes the
content-process case of that, but not the parent process (which consumes
basically a fake argv constructed in Java code).

Note that only the parent process and content processes use the
omnijars; every other process type uses either minimal XPCOM, which
doesn't include them, or no XPCOM at all (e.g., GMP before bug 1845946).

The end goal of this patch series is to use those flags with the fork
server (so that it can preload the files without needing any XPCOM), but
this patch changes only the case of content processes.

Differential Revision: https://phabricator.services.mozilla.com/D182510
2023-08-09 21:35:49 +00:00
Jed Davis
c9012150fb Bug 1840515 - Step 0: Use GeckoArgs for the -greomni and -appomni flags. r=nika
The `-appomni` flag isn't currently used, but the next patch will bring
it back and change how both flags are processed in child processes.

Differential Revision: https://phabricator.services.mozilla.com/D185330
2023-08-09 21:35:49 +00:00
Nika Layzell
bf04b0d8de Bug 1840974 - Part 3: Make sure otherpid is set if known on IPC::Channel, r=ipc-reviewers,jld
This improves the quality of the logging from IPC::Channel, and also
adds extra assertions to ensure that it's aligned with the values
sent/received in the HELLO message.

This patch also makes the other_pid type more consistent, using
base::ProcessId instead of int32_t in IPC::Channel.

Differential Revision: https://phabricator.services.mozilla.com/D183410
2023-07-17 20:32:09 +00:00
Nika Layzell
4e0633ce16 Bug 1838906 - Part 4: Don't require a listener in IPC::Channel until Connect, r=ipc-reviewers,jld
Depends on D181803

Differential Revision: https://phabricator.services.mozilla.com/D182225
2023-06-27 19:59:47 +00:00
Nika Layzell
4a72a442c0 Bug 1838906 - Part 2: Simplify the types for IPC::Channel::Listener, r=ipc-reviewers,necko-reviewers,kershaw,jld
Now that we've simplified the startup process somewhat, it is easier to clean
up IPC channel creation for NodeChannel connections. This stops having
GeckoChildProcessHost inherit from IPC::Channel::Listener, as it would never
receive most of the relevant callbacks, and instead implements the one callback
it would receive directly as a method on that type.

Differential Revision: https://phabricator.services.mozilla.com/D181282
2023-06-27 19:59:47 +00:00
Nika Layzell
18d0bf2094 Bug 1838906 - Part 1: Inherit the initial process pipe on Windows, r=bobowen,ipc-reviewers,jld
This allows simplifying how IPC::Channel is created and passed between
processes, as all platforms now inherit the initial handle/fd into the content
process in a similar way. To keep things simple for now, I've continued to use
the base::CommandLine class to pass the HANDLE's identity on Windows, however
we may want to change this to make it a bit easier to follow, perhaps treating
it more like how we handle the IPC fd on Android.

Differential Revision: https://phabricator.services.mozilla.com/D181281
2023-06-27 19:59:46 +00:00
Alexandre Lissy
a9ee883ccf Bug 1839834 - Allow per-sandbox disabling on Utility r=jld
Differential Revision: https://phabricator.services.mozilla.com/D181782
2023-06-27 13:10:14 +00:00
Norisz Fay
53d9f9072c Backed out changeset 38a62f7736e9 (bug 1839834) for causing sandboxing related Gtest failures CLOSED TREE 2023-06-26 20:04:59 +03:00
Alexandre Lissy
be3bdb474b Bug 1839834 - Allow per-sandbox disabling on Utility r=jld
Differential Revision: https://phabricator.services.mozilla.com/D181782
2023-06-26 14:47:33 +00:00
Gabriele Svelto
4b039f20f2 Bug 1776197 - Remove the old IPC channel used for retrieving annotations and all related machinery r=geckoview-reviewers,afranchuk,owlish
Depends on D173699

Differential Revision: https://phabricator.services.mozilla.com/D173700
2023-06-07 12:34:31 +00:00
Mike Hommey
c72ed0e448 Bug 1835185 - Adjust preprocessor conditions knowing that XP_WIN and XP_UNIX are mutually exclusive. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180137
2023-06-06 21:05:37 +00:00
Mike Hommey
6195df0b79 Bug 1835185 - Replace OS_*BSD with equivalent macros in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180049
2023-06-06 21:05:34 +00:00
Mike Hommey
55ec63d832 Bug 1835185 - Replace OS_SOLARIS with XP_SOLARIS in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180048
2023-06-06 21:05:33 +00:00
Mike Hommey
177e38422c Bug 1835185 - Replace OS_LINUX with XP_LINUX in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180046
2023-06-06 21:05:32 +00:00
Mike Hommey
1a1da788c7 Bug 1835185 - Replace OS_MACOSX with XP_DARWIN in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180045
2023-06-06 21:05:32 +00:00
Mike Hommey
30c664bf9c Bug 1835185 - Replace OS_WIN with XP_WIN in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180044
2023-06-06 21:05:31 +00:00
Mike Hommey
eb02cb32ad Bug 1835185 - Replace OS_POSIX with XP_UNIX in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180043
2023-06-06 21:05:31 +00:00
Haik Aftandilian
91fff12722 Bug 1827747 - Use a new executable for the macOS GMP process r=nika,glandium
Use a new executable for the GMP process named "<App Name> Media Plugin Helper" so that the content processes (using the plugin-container executable) and the GMP process can be signed with different entitlements allowing for the use of more secure entitlements.

In order for the new executable to load the Widevine plugin, a change is needed in the codesigning infrastructure repo to generate the .sig file for the new executable.

To get the security benefits of using a new executable for GMP, additional changes are needed in the codesigning infrastructure repo to enable signing plugin-container and the new executable with a reduced set of entitlements.

The executable is a copy of plugin-container renamed as "<App Name> Media Plugin Helper" so it appears with a user friendly name in Activity Monitor. For example, "Firefox Media Plugin Helper". (The GMP process runs with limited privileges preventing it from setting its own "nice" process name.)

Pref off the change until the .sig file change lands and media playback has been validated on production builds.

Differential Revision: https://phabricator.services.mozilla.com/D175796
2023-06-05 20:40:10 +00:00
Narcis Beleuzu
7e5789cdf8 Backed out 2 changesets (bug 1834172, bug 1827747) for breaking local artifacts . a=backout
Backed out changeset 0ceb457743b4 (bug 1834172)
Backed out changeset 7ad6a3ad9db7 (bug 1827747)
2023-05-22 12:42:00 +03:00
Haik Aftandilian
a34208222c Bug 1827747 - Use a new executable for the macOS GMP process r=nika,glandium
Use a new executable for the GMP process named "<App Name> Media Plugin Helper" so that the content processes (using the plugin-container executable) and the GMP process can be signed with different entitlements allowing for the use of more secure entitlements.

To get the benefits of using a new executable for GMP, additional changes are needed in the codesigning infrastructure repo to enable signing plugin-container and the new executable with a reduced set of entitlements.

The executable is built as media-plugin-helper and then renamed to "<App Name> Media Plugin Helper" so it appears with a user friendly name in Activity Monitor. For example, "Firefox Media Plugin Helper". (The GMP process runs with limited privileges preventing it from setting its own "nice" process name.)

Limit the change to Nightly at this time to allow validation of using a new executable and then enabling the strong entitlements.

Differential Revision: https://phabricator.services.mozilla.com/D175796
2023-05-19 16:47:28 +00:00
Alexandre Lissy
32a6eaf06f Bug 1819311 - Collect errors on process launch r=nika,geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D171226
2023-04-13 08:35:24 +00:00
Jed Davis
3219af97cc Bug 1763625 - Refactor how we access child process handles. r=nika,media-playback-reviewers,karlt
Differential Revision: https://phabricator.services.mozilla.com/D169777
2023-02-28 03:41:51 +00:00
Csoregi Natalia
43c5854833 Backed out changeset dc92467cea22 (bug 1763625) for causing memory-related crashes and failures. CLOSED TREE 2023-02-28 00:52:22 +02:00
Jed Davis
1015aea40b Bug 1763625 - Refactor how we access child process handles. r=nika,media-playback-reviewers,karlt
Differential Revision: https://phabricator.services.mozilla.com/D169777
2023-02-27 20:32:51 +00:00
Bob Owen
c952d27eac Bug 1772089 p5: Remove content temp dir from Windows and masOS. r=jld,haik,glandium
This defines MOZ_CONTENT_TEMP_DIR to make it easier to track this in the code.
It also uses this to guard some Linux specific uses.

Differential Revision: https://phabricator.services.mozilla.com/D168596
2023-02-24 08:44:41 +00:00
Andrew Osmond
b87e7bad97 Bug 1811981 - Add ability to run both x86 and ARM Widevine plugins on Windows ARM. r=jld
This patch adds the ability for Windows on ARM to launch either x86 or
ARM Widevine plugins. It also adds the ability for Windows on x86 to
refuse ARM binaries in case, for example, a profile is transferred
between machines.

Overall this should be a non-functional change for users at the time of
landing. It does however allow us to ship the ARM Widevine plugin to
Windows ARM users to workaround a plugin crash with the x86 Widevine
plugin. This only affects Windows 10 users (Windows 11 works fine).

Differential Revision: https://phabricator.services.mozilla.com/D167634
2023-01-31 20:57:11 +00:00
Chris Martin
15c5b22789 Bug 1799470 - Retighten GPU Process File Access r=nika,handyman
Differential Revision: https://phabricator.services.mozilla.com/D165419
2023-01-23 23:05:03 +00:00
Greg Stoll
2b461b0360 Bug 1744362 - Part 7: support code for about:third-party r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D164489
2022-12-30 20:10:04 +00:00
Greg Stoll
ae13a56ab0 Bug 1744362 - Part 6: use dynamic blocklist file to block third-party DLLs r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D164488
2022-12-30 20:10:04 +00:00
Butkovits Atila
5e31c1c2cf Backed out 12 changesets (bug 1744362) for causing build bustages.
Backed out changeset 3f63f21115e2 (bug 1744362)
Backed out changeset 0df403e8f6ba (bug 1744362)
Backed out changeset 34f51e6aee96 (bug 1744362)
Backed out changeset 39ff51df4a45 (bug 1744362)
Backed out changeset da9133df4cd4 (bug 1744362)
Backed out changeset 315c57948afa (bug 1744362)
Backed out changeset a2d8f526e0ff (bug 1744362)
Backed out changeset 401ebbc0159d (bug 1744362)
Backed out changeset 2911fe484cc3 (bug 1744362)
Backed out changeset d1f4b99f352b (bug 1744362)
Backed out changeset 0a3ce8ea039e (bug 1744362)
Backed out changeset ab1292118c00 (bug 1744362)
2022-12-27 22:54:30 +02:00
Greg Stoll
78bf088bb7 Bug 1744362 - Part 7: support code for about:third-party r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D164489
2022-12-27 20:06:41 +00:00
Greg Stoll
acc64a126e Bug 1744362 - Part 6: use dynamic blocklist file to block third-party DLLs r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D164488
2022-12-27 20:06:41 +00:00
Stanca Serban
822be63b67 Backed out 11 changesets (bug 1744362) for causing multiple failures and build bustages. CLOSED TREE
Backed out changeset 4b2e3689cea0 (bug 1744362)
Backed out changeset cf1db931c466 (bug 1744362)
Backed out changeset 8c87571dbb3e (bug 1744362)
Backed out changeset 8b50446f91e5 (bug 1744362)
Backed out changeset 848632184f56 (bug 1744362)
Backed out changeset acfdb2bcaa9f (bug 1744362)
Backed out changeset 80b67f7ea109 (bug 1744362)
Backed out changeset c88902b60d1f (bug 1744362)
Backed out changeset 438f74bb5b7c (bug 1744362)
Backed out changeset 704a4150d210 (bug 1744362)
Backed out changeset 1dd7e7c111da (bug 1744362)
2022-12-27 16:25:04 +02:00
Greg Stoll
934ea325f6 Bug 1744362 - Part 7: support code for about:third-party r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D164489
2022-12-27 12:59:09 +00:00
Greg Stoll
8578b985f6 Bug 1744362 - Part 6: use dynamic blocklist file to block third-party DLLs r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D164488
2022-12-27 12:59:09 +00:00
Jed Davis
45d35caf61 Bug 1797391 - Avoid process handle use-after-close in GeckoChildProcessHost dtor. r=nika
ProcessWatcher takes ownership of the handle and may close it
immediately if the process has already exited, so that needs to
happen last; currently, because GetProcessId returns 0 for errors,
DeregisterChildCrashAnnotationFileDescriptor will be passed 0 in that
case, and will silently fail and leak resources.

Differential Revision: https://phabricator.services.mozilla.com/D160295
2022-10-27 22:26:07 +00:00
Nika Layzell
f51f359297 Bug 1792474 - Part 3: Stop using IPC::Channel to create the pipe for ForkServer, r=ipc-reviewers,jld
Previously the channel used by the ForkServer would be created using
IPC::Channel, and then stolen after the launch was successful. Unfortunately,
this required invoking IPC::Channel methods (such as `Close()`) from the wrong
thread, and so would be racy and hit assertions with the new checks being
added. This patch instead skips creating the IPC::Channel for the fork server,
and allows it to create and configure its own pipe as needed.

This may be used in the future to change out the IPC strategy for the fork
server to something more appropriate, which supports features like async
replies as forked processes die.

Differential Revision: https://phabricator.services.mozilla.com/D158161
2022-10-07 01:51:29 +00:00
Nika Layzell
96d76af151 Bug 1779792 - Part 5: Add a unique nsID field to each MessageChannel pair, r=ipc-reviewers,mccr8
This won't be used for any security or routing purposes, but can be useful for
debugging. It will be used in the future by the profiler to correlate sent and
received message events across processes.

Differential Revision: https://phabricator.services.mozilla.com/D153621
2022-08-10 14:55:23 +00:00
Nika Layzell
263b5e445b Bug 1779792 - Part 1: Use cached value for log ID generation, r=mccr8
Previously this code read the atomic rather than the cached value (which
was unused). This is inherently racy as the atomic is updated on a
different thread than the read happened on.

Differential Revision: https://phabricator.services.mozilla.com/D153617
2022-08-10 14:55:21 +00:00
Fabrice Desré
c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel
3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Andreea Pavel
89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré
0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Jed Davis
501b8ffcd7 Bug 1780312 - Turn off the Linux nvidia driver's shader cache in the RDD process. r=gcp
We were already turning off Mesa's shader cache in the RDD process,
because it's not useful given that we're only using video codec
acceleration and moving images around, and it does a few things related
to trying to access the cache that the sandbox would have to accomodate.

This patch does the equivalent thing for the nvidia proprietary driver;
we don't support it for media codec acceleration, but it can still be
loaded in that process (e.g., on multi-GPU systems) and it's trying to
call `statfs` on startup which may be related.

Differential Revision: https://phabricator.services.mozilla.com/D152932
2022-07-28 19:07:30 +00:00
Jed Davis
54cd467d65 Bug 1777910 - Adjust Mesa environment variables for change/deprecation in 22.1. r=gcp
Mesa 22.1.0 changed the env var name MESA_GLSL_CACHE_DISABLE to
MESA_SHADER_CACHE_DISABLE; it still accepts the old name, but prints a
deprecation warning.  If we set both env vars, then we can support both
old and new Mesas correctly (the warning won't be printed if the new env
var is also set).

Differential Revision: https://phabricator.services.mozilla.com/D151094
2022-07-06 21:20:06 +00:00
Haik Aftandilian
94ba599969 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
4591ba72b4 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
Bob Owen
b48aea26d9 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