Commit graph

285 commits

Author SHA1 Message Date
Cristian Tuns
3d54211109 Backed out 2 changesets (bug 1837907) for causing xpcshell failures in marSuccessPartialWhileBackgroundTaskRunning.js CLOSED TREE
Backed out changeset 1035a42c6a86 (bug 1837907)
Backed out changeset f7551ea88778 (bug 1837907)
2023-11-29 07:56:52 -05:00
stransky
ff8cc581ed Bug 1837907 [Linux] Enable AppShell SIGTERM signal handler for Firefox r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D194183
2023-11-29 12:08:15 +00:00
stransky
e7b8ab5258 Bug 1820896 [Linux/X11] Reserve the lower positions of the file descriptors to avoid reuse of stdin/stdout/stderr r=emilio
Reserve the lower positions of the file descriptors to make sure
we don't reuse stdin/stdout/stderr in case they we closed
before launch.

Differential Revision: https://phabricator.services.mozilla.com/D175337
2023-04-13 11:26:43 +00:00
Bob Owen
8ceb9087eb Bug 1826878: Move call to SetWin32kLockedDownInPolicy before DllBlocklist_Initialize. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D175148
2023-04-13 06:39:18 +00:00
Cosmin Sabou
d8ac128a8d Backed out changeset 78e7281703a2 (bug 1788004) for causing SM failures. CLOSED TREE 2023-02-24 19:13:47 +02:00
Yannis Juglaret
45cce5b7c0 Bug 1788004 - Implement a hook-based fallback for BCryptGenRandom to mitigate Rust panics. r=cmartin
BCryptGenRandom can be broken, but the Rust stdlib and the getrandom
crate rely on it, and this is a source of crashes which are Rust
panics. This happens the most on Windows 7 after bcryptprimitives.dll
fails to load (see bug 1788004).

To mitigate these crashes, we hook BCryptGenRandom if we detect that it
is broken, and install a fallback based on RtlGenRandom. We only protect
calls that use BCRYPT_USE_SYSTEM_PREFERRED_RNG; so code that relies on
using BCryptOpenAlgorithmProvider and doesn't have its own fallback can
still fail.

We will hopefully remove this hook when the Rust stdlib and the
getrandom crate both have their own RtlGenRandom-based fallback.

Differential Revision: https://phabricator.services.mozilla.com/D170662
2023-02-24 15:47:14 +00:00
Greg Stoll
62e5d740ae Bug 1804023 - Part 2: add ability to blocklist DLLs in just the GPU process r=gsvelto
As with the socket process, we can't automated test that the block works in the GPU process, but I manually verified this. I did add an automated test that ensures blocking something in the GPU process doesn't block it in other processes.

Differential Revision: https://phabricator.services.mozilla.com/D167399
2023-01-20 19:21:39 +00:00
Cosmin Sabou
af47c3669b Backed out 3 changesets (bug 1804023) for causing DllBlocklistInit.cpp related bustages. CLOSED TREE
Backed out changeset 8ac7bb069839 (bug 1804023)
Backed out changeset 9d2766a3d506 (bug 1804023)
Backed out changeset b5b4be5f7502 (bug 1804023)
2023-01-20 20:44:28 +02:00
Greg Stoll
8cb4d0d627 Bug 1804023 - Part 2: add ability to blocklist DLLs in just the GPU process r=gsvelto
As with the socket process, we can't automated test that the block works in the GPU process, but I manually verified this. I did add an automated test that ensures blocking something in the GPU process doesn't block it in other processes.

Differential Revision: https://phabricator.services.mozilla.com/D167399
2023-01-20 18:00:45 +00:00
Toshihito Kikuchi
c96ab58894 Bug 1744362 - Part 4: Move mState from Kernel32ExportsSolver to Layout r=handyman
This is a refactoring that makes SharedSection::Reset() do the resolving of Kernel32ExportsSolver. This will allow us in a future patch to let the SharedSection attempt to resolve Kernel32ExportsSolver multiple times, as it will fail if kernel32.dll isn't loaded in the process yet, but we still want to initialize the dynamic blocklist in that case.

Differential Revision: https://phabricator.services.mozilla.com/D164486
2022-12-30 20:10:03 +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
Toshihito Kikuchi
437e404d20 Bug 1744362 - Part 4: Move mState from Kernel32ExportsSolver to Layout r=handyman
This is a refactoring that makes SharedSection::Reset() do the resolving of Kernel32ExportsSolver. This will allow us in a future patch to let the SharedSection attempt to resolve Kernel32ExportsSolver multiple times, as it will fail if kernel32.dll isn't loaded in the process yet, but we still want to initialize the dynamic blocklist in that case.

Differential Revision: https://phabricator.services.mozilla.com/D164486
2022-12-27 20:06:40 +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
Toshihito Kikuchi
7f7af2303a Bug 1744362 - Part 4: Move mState from Kernel32ExportsSolver to Layout r=handyman
This is a refactoring that makes SharedSection::Reset() do the resolving of Kernel32ExportsSolver. This will allow us in a future patch to let the SharedSection attempt to resolve Kernel32ExportsSolver multiple times, as it will fail if kernel32.dll isn't loaded in the process yet, but we still want to initialize the dynamic blocklist in that case.

Differential Revision: https://phabricator.services.mozilla.com/D164486
2022-12-27 12:59:08 +00:00
Greg Stoll
d44f201e8f Bug 1760668 - part 1: add ability to blocklist DLLs in socket process. r=gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D160586
2022-11-04 18:12:59 +00:00
Greg Stoll
7950aa0894 Bug 1783304 - Simplify DLL blocklist init r=handyman
Now that SetGeckoProcessType() is called earlier, we can use that to determine if we are a utility process instead of parsing command-line arguments

Differential Revision: https://phabricator.services.mozilla.com/D158811
2022-10-07 19:22:45 +00:00
Bob Owen
3d2f6719a8 Bug 1788233: Remove PermissionsService from process Windows sandboxing code. r=handyman
Depends on D156069

Differential Revision: https://phabricator.services.mozilla.com/D156087
2022-09-07 09:42:04 +00:00
Bob Owen
3dd8f8e969 Bug 1782199: Unregister the WER runtime module before returning from main. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D153728
2022-08-08 12:05:00 +00:00
Ray Kraesig
aae42034c9 Bug 1733821 - [3.5/9] Unify Firefox arguments to EnsureCommandlineSafe r=mhowell,nalexander
Eliminate the need to keep Firefox's required-argument set in sync
across files by defining it only in a new header file.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D152543
2022-08-02 21:02:03 +00:00
Ray Kraesig
590e9c4f38 Bug 1733821 - [3/9] Heavily specialize strimatch() r=mhowell,Gijs
`strimatch` attempts to perform a generic case-insensitive match.
However, it doesn't handle edge cases very well -- and, for deep Unicode
reasons, it can't reasonably do so without being far more complicated.

However, we also don't need it to. The `lowerstr` input of `strimatch`
is only ever a constant string naming a command-line option. These are
(and probably always should be) strictly composed of lowercase ASCII,
numerals, and hyphens. _That_ character set is one that a simple
function can properly handle.

Restricting `lowerstr` to be `const char *`, regardless of `CharT`, also
obviates the macro-machinery of `GetLiteral` and `DECLARE_FLAG_LITERAL`.
Strip it all out.

Additionally and relatedly:
  * Add tests confirming that `strimatch` only matches things that it
    should be testing against at all.
  * Add a minor fix for a test which was discovered to crash rather than
    report failure.

----

Although this commit involves significant internal functional changes,
most users will see no differences. (Some users operating in Turkish or
Azerbaijani locales may notice that "-PRİVATE-WINDOW" is no longer a
recognized command-line option.)

Differential Revision: https://phabricator.services.mozilla.com/D152321
2022-08-02 21:02:02 +00:00
Bob Owen
f29f23d58b Bug 1682520 p2: Register the WER Runtime Exception Module very early in process start up. r=gsvelto,glandium
Depends on D152198

Differential Revision: https://phabricator.services.mozilla.com/D152199
2022-08-02 10:41:14 +00:00
Bob Owen
d6333678d8 Bug 1682520 p1: Move GeckoProcessType and implementation of get and set into mozglue. r=glandium
This means we can set and use the process type earlier in process startup.

Differential Revision: https://phabricator.services.mozilla.com/D152198
2022-08-02 10:41:14 +00:00
Cristian Tuns
85e845a6dc Backed out 2 changesets (bug 1682520) for causing build bustages on ProcessType.h CLOSED TREE
Backed out changeset 679e19334225 (bug 1682520)
Backed out changeset dad72c7e0d7b (bug 1682520)
2022-07-29 17:04:49 -04:00
Bob Owen
edb40ba976 Bug 1682520 p2: Register the WER Runtime Exception Module very early in process start up. r=gsvelto,glandium
Depends on D152198

Differential Revision: https://phabricator.services.mozilla.com/D152199
2022-07-29 18:10:54 +00:00
Bob Owen
cf59d0973b Bug 1682520 p1: Move GeckoProcessType and implementation of get and set into separate files. r=glandium
This means we can include these files in other binaries when we need earlier
access to the process type and use consistent code.

Differential Revision: https://phabricator.services.mozilla.com/D152198
2022-07-29 18:10:53 +00:00
Alexandre Lissy
9c3474ae19 Bug 1775263 - Block cyinjct.dll from being injected in Utility r=haik,handyman
Differential Revision: https://phabricator.services.mozilla.com/D150595
2022-07-22 13:47:58 +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
Bob Owen
f2a9df286a Bug 1768014 p2: Default to policy win32k lockdown status if in process check fails. r=gcp,cmartin
Depends on D145872

Differential Revision: https://phabricator.services.mozilla.com/D145873
2022-05-10 06:07:17 +00:00
Ben Hearsum
21d677e73d Bug 1751002: Update command line parsing code to allow -private-window to be accepted with -osint launches. r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D137672
2022-02-02 21:21:37 +00:00
Doug Thayer
5784aaf6e3 Bug 1731501 - Use setActivationPolicy to hide dock icon on OSX r=mstange
This could be a bit risky to enable in any widespread fashion, but the
goal here is just to land it behind an undocumented command line flag
so that we can do a bit of experimentation and dogfooding. The API
seems to work exactly as desired: firefox opens in the background
without a window or dock icon. Upon trying to launch firefox again, we
simply send a remote command to the existing instance to open a window,
and it does so and gets a dock icon.

Differential Revision: https://phabricator.services.mozilla.com/D126054
2021-10-17 19:00:12 +00:00
Doug Thayer
7ddd9de745 Bug 1733444 - Persist an "allow windowless" mode after restarts from -silentmode r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D127150
2021-10-01 01:26:25 +00:00
Csoregi Natalia
d7366e9cbd Backed out changeset c486787cd9a2 (bug 1733444) for causing build bustage on nsAppStartup.cpp.CLOSED TREE 2021-10-01 00:38:34 +03:00
Doug Thayer
a91484d045 Bug 1733444 - Persist an "allow windowless" mode after restarts from -silentmode r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D127150
2021-09-30 20:43:26 +00:00
Doug Thayer
ef2740f793 Bug 1728653 - Allow a silent start mode r=bytesized,nalexander,application-update-reviewers,mossop
This will allow starting Firefox in the background, and on Windows will allow
closing the last browser window without killing the main process. There is no
plan for actually using this by default in Firefox proper, but it's needed for
some explorations.

There's more to this work that we'll need - this is just the first step. For
instance, we'll need a real way to actually kill firefox on Windows other than
through the task manager (we'll be putting something in the system tray to
allow this.)

The patch wasn't particularly large, so I didn't split out the rename of
MOZ_APP_SILENT_START to MOZ_APP_SILENT_RESTART - let me know if you'd like me
to do that though and I can.

Differential Revision: https://phabricator.services.mozilla.com/D124249
2021-09-09 18:09:25 +00:00
Doug Thayer
b5f7314e3e Bug 1714212 - Ensure COM initialized prior to showing skeleton UI r=Jamie,aklotz,tkikuchi
This implements Jamie's suggested fixes for a screenreader issue when the
skeleton UI is enabled. Most of the work here is just pulling out pieces from the
files we needed to include in mozglue so that any references to, say, nsString
or other pieces from libxul either no longer exist or are only included when
building libxul. In a few cases this meant creating whole files to house single
functions, which isn't so pretty, but it was the best I could come up with to
get the job done.

Differential Revision: https://phabricator.services.mozilla.com/D117663
2021-07-07 22:37:14 +00:00
Narcis Beleuzu
1ff027d763 Backed out changeset acf2d74efbbc (bug 1714212) for SM bustages on NativeNt.h 2021-07-07 23:13:42 +03:00
Doug Thayer
dc9c284076 Bug 1714212 - Ensure COM initialized prior to showing skeleton UI r=Jamie,aklotz,tkikuchi
This implements Jamie's suggested fixes for a screenreader issue when the
skeleton UI is enabled. Most of the work here is just pulling out pieces from the
files we needed to include in mozglue so that any references to, say, nsString
or other pieces from libxul either no longer exist or are only included when
building libxul. In a few cases this meant creating whole files to house single
functions, which isn't so pretty, but it was the best I could come up with to
get the job done.

Differential Revision: https://phabricator.services.mozilla.com/D117663
2021-07-07 18:17:36 +00:00
Dorel Luca
bc6f2486e2 Backed out changeset 11d1710e481f (bug 1714212) for Browser-chrome failures in toolkit/xre/test/browser_checkdllblockliststate.js. CLOSED TREE 2021-06-26 09:45:29 +03:00
Doug Thayer
c3702a9447 Bug 1714212 - Ensure COM initialized prior to showing skeleton UI r=Jamie,aklotz,tkikuchi
This implements Jamie's suggested fixes for a screenreader issue when the
skeleton UI is enabled. Most of the work here is just pulling out pieces from the
files we needed to include in mozglue so that any references to, say, nsString
or other pieces from libxul either no longer exist or are only included when
building libxul. In a few cases this meant creating whole files to house single
functions, which isn't so pretty, but it was the best I could come up with to
get the job done.

Differential Revision: https://phabricator.services.mozilla.com/D117663
2021-06-26 04:10:50 +00:00
Chris Martin
38d538c966 Bug 1701770 - Defer Windows DPI Awareness from load time to run time r=bobowen,aklotz
Currently, we set DPI awareness in the manifest files for firefox.exe.

Unfortunately, that causes DPI-related Win32k calls when user32.dll
is loaded.

This changes things to wait until we are sure we're not running in a
Win32k Lockdown Content Process before we attempt to initialize DPI scaling.

Differential Revision: https://phabricator.services.mozilla.com/D116433
2021-06-21 13:50:31 +00:00
Narcis Beleuzu
192a45a34e Backed out 2 changesets (bug 1701770) for causing tp5n crashes.
Backed out changeset 2351f158ef88 (bug 1701770)
Backed out changeset 4af044ed9208 (bug 1701770)
2021-06-19 07:06:41 +03:00
Chris Martin
59f6230bef Bug 1701770 - Defer Windows DPI Awareness from load time to run time r=bobowen,aklotz
Currently, we set DPI awareness in the manifest files for firefox.exe.

Unfortunately, that causes DPI-related Win32k calls when user32.dll
is loaded.

This changes things to wait until we are sure we're not running in a
Win32k Lockdown Content Process before we attempt to initialize DPI scaling.

Differential Revision: https://phabricator.services.mozilla.com/D116433
2021-06-17 15:53:23 +00:00
Noemi Erli
6fcc995a0a Backed out 2 changesets (bug 1701770) for causing failures in browser_checkdllblockliststate.js CLOSED TREE
Backed out changeset a6f46b0a30e9 (bug 1701770)
Backed out changeset 263591537722 (bug 1701770)
2021-06-15 04:09:49 +03:00
Chris Martin
d909ca765f Bug 1701770 - Defer Windows DPI Awareness from load time to run time r=bobowen,aklotz
Currently, we set DPI awareness in the manifest files for firefox.exe.

Unfortunately, that causes DPI-related Win32k calls when user32.dll
is loaded.

This changes things to wait until we are sure we're not running in a
Win32k Lockdown Content Process before we attempt to initialize DPI scaling.

Differential Revision: https://phabricator.services.mozilla.com/D116433
2021-06-14 20:55:33 +00:00
Jesse Schwartzentruber
24ef473acb Bug 1708409 - Include libFuzzer in xpcshell r=decoder
libFuzzer is already included in the firefox binary, so including it in
libxul is problematic.

Differential Revision: https://phabricator.services.mozilla.com/D113899
2021-04-30 17:46:15 +00:00
Aaron Klotz
004362bf3e Bug 1690384: Propagate error information up through XPCOMGlueLoad and GetBootstrap; r=glandium
We know that some GV installations (particularly but not exlcusively Focus) are
failing to load `libxul.so` during early Gecko bootstrapping. Unfortunately
a boolean pass/fail result is not giving us sufficient information to be able to
properly troubleshoot this problem.

This patch adds `mozilla::Result`-based return values to `XPCOMGlueLoad` and
`GetBootstrap` in an effort to produce more actionable information about these
failures.

We include either a `nsresult` or, if the failure is rooted in a dynamic linker
failure, appropriate platform-specific error information:

* On Unix-based platforms, a `UniqueFreePtr<char>` containing the string from `dlerror(3)`;
* On Windows, the Win32 `DWORD` error code from `GetLastError()`.

For non-Android platforms, I updated them to handle the new return type, but
otherwise did not make any further changes.

For Android, we include the error information in the message string that we pass
into the Java `Exception` that is subsequently thrown.

Differential Revision: https://phabricator.services.mozilla.com/D104263
2021-02-23 23:25:22 +00:00
Toshihito Kikuchi
7545ed9378 Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell
This patch is to improve the way to detect an injected dependent module for
automatic DLL blocking (bug 1659438).

In the previous version, we created a list of dependent modules in the launcher
process and shared it with other processes via the shared section.  However, it
was not compatible with third-party applications who tamper the Import Table and
revert it in the injected module's DllMain (bug 1682834) because we parsed the
Import Table in the launcher process after it was reverted.

With this patch, we check the Import Table in `patched_NtMapViewOfSection`,
so we can see tampering before it's reverted.  More specifically, we create
a list of dependent modules in the browser process as below.

1. The launcher process creates a section object and initializes
   the kernel32.dll's functions in it.

2. The launcher process transfers a writable handle of the shared
   section to the browser process.

3. In the browser process, if an injected dependent module is being
   mapped by `NtMapViewOfSection`, we add its NT path to the shared
   section and block it with `REDIRECT_TO_NOOP_ENTRYPOINT`.

4. The `main` function of the browser process converts the writable
   handle of the shared section into a readonly handle.

5. The browser process transfers a readonly handle of the shared
   section to a sandbox process.

Since automatic DLL blocking may still cause a compat issue like bug 1682304,
we activate it only in Nightly for now.

Differential Revision: https://phabricator.services.mozilla.com/D101460
2021-01-13 15:13:18 +00:00
smolnar
0b57365558 Backed out changeset 48a0fcaf46b8 (bug 1684532) for causing gtest perma failure. CLOSED TREE 2021-01-13 11:49:37 +02:00
Toshihito Kikuchi
b27dd298e9 Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell
This patch is to improve the way to detect an injected dependent module for
automatic DLL blocking (bug 1659438).

In the previous version, we created a list of dependent modules in the launcher
process and shared it with other processes via the shared section.  However, it
was not compatible with third-party applications who tamper the Import Table and
revert it in the injected module's DllMain (bug 1682834) because we parsed the
Import Table in the launcher process after it was reverted.

With this patch, we check the Import Table in `patched_NtMapViewOfSection`,
so we can see tampering before it's reverted.  More specifically, we create
a list of dependent modules in the browser process as below.

1. The launcher process creates a section object and initializes
   the kernel32.dll's functions in it.

2. The launcher process transfers a writable handle of the shared
   section to the browser process.

3. In the browser process, if an injected dependent module is being
   mapped by `NtMapViewOfSection`, we add its NT path to the shared
   section and block it with `REDIRECT_TO_NOOP_ENTRYPOINT`.

4. The `main` function of the browser process converts the writable
   handle of the shared section into a readonly handle.

5. The browser process transfers a readonly handle of the shared
   section to a sandbox process.

Since automatic DLL blocking may still cause a compat issue like bug 1682304,
we activate it only in Nightly for now.

Differential Revision: https://phabricator.services.mozilla.com/D101460
2021-01-13 08:38:16 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00