Commit Graph

29 Commits

Author SHA1 Message Date
Sylvestre Ledru
893cfb7019 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D28329
2019-04-22 16:35:03 +00:00
Aaron Klotz
b37a3edd71 Bug 1503538: Part 4 - Add injected static import blocking to launcher process; r=mhowell
Depends on D27145

Differential Revision: https://phabricator.services.mozilla.com/D27146
2019-04-11 22:32:29 +00:00
Carl Corcoran
0ea7e2ff9d Bug 1503538 Part 2/5: Move AutoVirtualProtect to a shared header r=aklotz
AutoVirtualProtect will be useful for following patches. This moves it out of
DllBlocklistWin.cpp and into WinHeaderOnlyUtils.h so it can be shared.

Differential Revision: https://phabricator.services.mozilla.com/D13197
2019-03-06 00:40:55 +00:00
Ehsan Akhgari
498e2df734 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset
2019-01-18 10:16:18 +01:00
Aaron Klotz
1a7144b467 Bug 1511078: Add LauncherRegistryInfo as a temporary mechanism for runtime disabling of launcher process; r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D15756
2019-01-15 23:10:00 +00:00
Coroiu Cristina
832d2700d8 Backed out 2 changesets (bug 1511078) for build bustages at Unified_cpp_toolkit_xre0.obj
Backed out changeset 61a47d6d5e26 (bug 1511078)
Backed out changeset 006df494925a (bug 1511078)
2019-01-15 23:15:50 +02:00
Aaron Klotz
baf8c98ef9 Bug 1511078: Add LauncherRegistryInfo as a temporary mechanism for runtime disabling of launcher process; r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D15756
2019-01-15 20:19:46 +00:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Aaron Klotz
53a66df21a Bug 1508848: Remove operator bool from WindowsError and replace with IsSuccess and IsFailure methods; r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D12485
2018-11-20 22:59:51 +00:00
Aaron Klotz
af72b2e29c Bug 1508468: Convert launcher process to use mozilla::Result for error propagation; r=mhowell
This patch does a couple of things:

* I added a new class, |WindowsError| to WinHeaderOnlyUtils. The idea here is
  to encapsulate as much of the Windows error gamut as possible into one class.
  Since Win32 errors and NTSTATUS codes may both be encoded as HRESULTs, I
  used the latter type to store the error. It also contains functions for
  converting between the various error code formats, as well as stringification
  via FormatMessage.

* I added |LauncherError| which also includes file and line number information,
  which I believe will be important for launcher process failure diagnostics.
  (Instantiation of LauncherErrors obviously must be done via macros to capture
  __FILE__ and __LINE__).

* I then converted all of the launcher process code (and its few depenencies) to
  utilize this new functionality via the new |LauncherResult| type.

* If we detect an error in one of the top-level launcher process functions, we
  pass it to |HandleLauncherError| for processing. This function currently just
  throws up a |MessageBox| like the previous code did, with the intention of
  enhancing that further in the future.

Differential Revision: https://phabricator.services.mozilla.com/D12365
2018-11-20 23:49:36 +00:00
Narcis Beleuzu
0f5db4593c Backed out changeset be8383028bc0 (bug 1508468) for windows build bustage 2018-11-21 01:30:52 +02:00
Aaron Klotz
6edd67ddb4 Bug 1508468: Convert launcher process to use mozilla::Result for error propagation; r=mhowell
This patch does a couple of things:

* I added a new class, |WindowsError| to WinHeaderOnlyUtils. The idea here is
  to encapsulate as much of the Windows error gamut as possible into one class.
  Since Win32 errors and NTSTATUS codes may both be encoded as HRESULTs, I
  used the latter type to store the error. It also contains functions for
  converting between the various error code formats, as well as stringification
  via FormatMessage.

* I added |LauncherError| which also includes file and line number information,
  which I believe will be important for launcher process failure diagnostics.
  (Instantiation of LauncherErrors obviously must be done via macros to capture
  __FILE__ and __LINE__).

* I then converted all of the launcher process code (and its few depenencies) to
  utilize this new functionality via the new |LauncherResult| type.

* If we detect an error in one of the top-level launcher process functions, we
  pass it to |HandleLauncherError| for processing. This function currently just
  throws up a |MessageBox| like the previous code did, with the intention of
  enhancing that further in the future.

Differential Revision: https://phabricator.services.mozilla.com/D12365
2018-11-20 22:12:53 +00:00
Brindusan Cristian
9cce90b68c Backed out changeset 0ff2e89a1819 (bug 1508468) for windows build bustages on ntstatus.h. CLOSED TREE 2018-11-20 23:08:11 +02:00
Aaron Klotz
36d1760997 Bug 1508468: Convert launcher process to use mozilla::Result for error propagation; r=mhowell
This patch does a couple of things:

* I added a new class, |WindowsError| to WinHeaderOnlyUtils. The idea here is
  to encapsulate as much of the Windows error gamut as possible into one class.
  Since Win32 errors and NTSTATUS codes may both be encoded as HRESULTs, I
  used the latter type to store the error. It also contains functions for
  converting between the various error code formats, as well as stringification
  via FormatMessage.

* I added |LauncherError| which also includes file and line number information,
  which I believe will be important for launcher process failure diagnostics.
  (Instantiation of LauncherErrors obviously must be done via macros to capture
  __FILE__ and __LINE__).

* I then converted all of the launcher process code (and its few depenencies) to
  utilize this new functionality via the new |LauncherResult| type.

* If we detect an error in one of the top-level launcher process functions, we
  pass it to |HandleLauncherError| for processing. This function currently just
  throws up a |MessageBox| like the previous code did, with the intention of
  enhancing that further in the future.

Differential Revision: https://phabricator.services.mozilla.com/D12365
2018-11-20 20:27:06 +00:00
Narcis Beleuzu
77a314394a Backed out changeset 5660a1cd0e25 (bug 1508468) for Windows MinGW bustages. CLOSED TREE 2018-11-20 21:39:10 +02:00
Aaron Klotz
f2e73a939f Bug 1508468: Convert launcher process to use mozilla::Result for error propagation; r=mhowell
This patch does a couple of things:

* I added a new class, |WindowsError| to WinHeaderOnlyUtils. The idea here is
  to encapsulate as much of the Windows error gamut as possible into one class.
  Since Win32 errors and NTSTATUS codes may both be encoded as HRESULTs, I
  used the latter type to store the error. It also contains functions for
  converting between the various error code formats, as well as stringification
  via FormatMessage.

* I added |LauncherError| which also includes file and line number information,
  which I believe will be important for launcher process failure diagnostics.
  (Instantiation of LauncherErrors obviously must be done via macros to capture
  __FILE__ and __LINE__).

* I then converted all of the launcher process code (and its few depenencies) to
  utilize this new functionality via the new |LauncherResult| type.

* If we detect an error in one of the top-level launcher process functions, we
  pass it to |HandleLauncherError| for processing. This function currently just
  throws up a |MessageBox| like the previous code did, with the intention of
  enhancing that further in the future.

Differential Revision: https://phabricator.services.mozilla.com/D12365
2018-11-20 18:06:23 +00:00
Aaron Klotz
f0da5e3006 Bug 1477790: Add ability for firefox.exe to use launcher process by default when the build is configured to do so; r=mhowell
Since we don't want to inadvertently expose some way for malware to disable the
launcher via command-line/environment, I opted to query Windows for the PID of
the process that launched us, and then compare its executable path against ours.

Strictly speaking, the PROCESS_BASIC_INFORMATION::InheritedFromUniqueProcessId
field is not necessarily the parent pid, but it will match any process that was
created via the normal CreateProcess machinery.
2018-07-16 16:41:55 -06:00
Aaron Klotz
c353c9f20a Bug 1475067: Faster handling of UNICODE_STRINGs in bootstrap blocklist; r=mhowell 2018-07-06 18:11:48 -06:00
Aaron Klotz
ee938e1ff5 Bug 1473371: Create a separate function hook type for use with cross-process DLL interceptors; r=handyman 2018-07-04 14:14:18 -06:00
Ciure Andrei
9f7840ea51 Backed out 1 changesets (bug 1473371)for windows-specific changes and fails on windows CLOSED TREE
Backed out changeset f86b10b13521 (bug 1473371)
2018-07-06 22:22:05 +03:00
Aaron Klotz
ea55003cd7 Bug 1473371: Create a separate function hook type for use with cross-process DLL interceptors; r=handyman 2018-07-04 14:14:18 -06:00
Aaron Klotz
7894fa6da8 Bug 1460022: Part 5 - Update launcher process to work with new DLL interceptor interface; r=mhowell 2018-06-27 11:49:30 -06:00
shindli
3ffa44b530 Backed out 13 changesets (bug 1460022) for bustages in :/build/build/src/mozglue/tests/interceptor/TestDllInterceptor.cpp(113) on a CLOSED TREE
Backed out changeset b798c3689bbf (bug 1460022)
Backed out changeset c3b3b854affd (bug 1460022)
Backed out changeset ecb1b6fd3134 (bug 1460022)
Backed out changeset 91fed649dd5a (bug 1460022)
Backed out changeset be7032cddad2 (bug 1460022)
Backed out changeset d4a036b976e6 (bug 1460022)
Backed out changeset 5f3dfde41e38 (bug 1460022)
Backed out changeset a16486a6f685 (bug 1460022)
Backed out changeset 69eacc5c3ab8 (bug 1460022)
Backed out changeset 34aa7c29b31e (bug 1460022)
Backed out changeset 00b20c0a7637 (bug 1460022)
Backed out changeset b8e8aea4a01f (bug 1460022)
Backed out changeset 15822d9848d8 (bug 1460022)
2018-07-04 03:37:11 +03:00
Aaron Klotz
c772ab17a2 Bug 1460022: Part 5 - Update launcher process to work with new DLL interceptor interface; r=mhowell 2018-06-27 11:49:30 -06:00
shindli
3c15ba6c22 Backed out 13 changesets (bug 1460022) for bustages in builds/worker/workspace/build/src/dom/plugins/ipc/FunctionHook.h💯24 on a CLOSED TREE
Backed out changeset 0734142a3f35 (bug 1460022)
Backed out changeset 18fbfa7ca685 (bug 1460022)
Backed out changeset 2df129bd5692 (bug 1460022)
Backed out changeset 02a7ed68933f (bug 1460022)
Backed out changeset 221137d1c2de (bug 1460022)
Backed out changeset 9cb0b7a15402 (bug 1460022)
Backed out changeset 18f8f85c0307 (bug 1460022)
Backed out changeset 867a1351efff (bug 1460022)
Backed out changeset 933e0b698f8e (bug 1460022)
Backed out changeset 09da660071e1 (bug 1460022)
Backed out changeset 8bb5142d3f53 (bug 1460022)
Backed out changeset 0ddf581bdaac (bug 1460022)
Backed out changeset 1cd5f9b4a6af (bug 1460022)
2018-07-04 02:49:24 +03:00
Aaron Klotz
4de78ecd10 Bug 1460022: Part 5 - Update launcher process to work with new DLL interceptor interface; r=mhowell 2018-06-27 11:49:30 -06:00
Aaron Klotz
9be4491e72 Bug 1445025: Part 5 - Implement a Native NT version of the DLL blocklist; r=mhowell
This version of the blocklist should be functionally comparable to the mozglue
based blocklist, except:

* We hook NtMapViewOfSection instead of LdrLoadDll: The former allows us to
  easily obtain the module file name being used for the load. The latter
  requires us to essentially emulate the loader's path searching, which is
  a perf hit, potentially a correctness issue, and more work to do given the
  limited native NT API set.

* Since the paths in native NT land are all unicode, and since this code is
  critical to startup performance, this version of the blocklist uses unicode
  strings instead of ASCII strings. My thoughts here are that we don't want to
  be wasting time on every DLL load doing ASCII-to-unicode conversion every
  time we want to do a blocklist string comparison.

* I am completely aware that this leaves us in a bizarre situation where we have
  two copies of the blocklist in our binaries: one unicode version in firefox.exe,
  and one ASCII version in mozglue.dll. Once we (hopefully) move to using the
  launcher process by default, the ASCII copy can go away. In the meantime, we
  need to be able to use either one depending on how Firefox was started. I am
  happy to make the Native NT blocklist Nightly-only to assuage these concerns.
2018-06-05 15:21:19 -06:00
Cosmin Sabou
3910fc311b Backed out 6 changesets (bug 1445025) for browser chrome failures on browser_checkdllblockliststate.js. CLOSED TREE
Backed out changeset a1203eb4cee9 (bug 1445025)
Backed out changeset 64b003dceafb (bug 1445025)
Backed out changeset a6cff2b478da (bug 1445025)
Backed out changeset 4dbc7fbb3361 (bug 1445025)
Backed out changeset 1ad82650ca1c (bug 1445025)
Backed out changeset 5c63001e1ce6 (bug 1445025)
2018-06-07 12:09:22 +03:00
Aaron Klotz
cfa1561fbb Bug 1445025: Part 5 - Implement a Native NT version of the DLL blocklist; r=mhowell
This version of the blocklist should be functionally comparable to the mozglue
based blocklist, except:

* We hook NtMapViewOfSection instead of LdrLoadDll: The former allows us to
  easily obtain the module file name being used for the load. The latter
  requires us to essentially emulate the loader's path searching, which is
  a perf hit, potentially a correctness issue, and more work to do given the
  limited native NT API set.

* Since the paths in native NT land are all unicode, and since this code is
  critical to startup performance, this version of the blocklist uses unicode
  strings instead of ASCII strings. My thoughts here are that we don't want to
  be wasting time on every DLL load doing ASCII-to-unicode conversion every
  time we want to do a blocklist string comparison.

* I am completely aware that this leaves us in a bizarre situation where we have
  two copies of the blocklist in our binaries: one unicode version in firefox.exe,
  and one ASCII version in mozglue.dll. Once we (hopefully) move to using the
  launcher process by default, the ASCII copy can go away. In the meantime, we
  need to be able to use either one depending on how Firefox was started. I am
  happy to make the Native NT blocklist Nightly-only to assuage these concerns.
2018-06-05 15:21:19 -06:00