Commit Graph

1593 Commits

Author SHA1 Message Date
Toshihito Kikuchi
ae5caf8f80 Bug 1603974 - Part 7: Introduce a new blocklist type RedirectToNoOpEntryPoint. r=mhowell
This patch introduces a new DLL blocklist type `RedirectToNoOpEntryPoint`
which hooks a DLL's entrypoint into a no-op function.  With this technique,
we give the injected DLL no chance to run its code though we allow it to be
loaded into the process.

This new blocklist type is intended to block a DLL which is injected by IAT
patching which was planted by a kernel callback routine for LoadImage.  It's
because blocking such a DLL makes a new process fail to launch.

Differential Revision: https://phabricator.services.mozilla.com/D68348

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:03 +00:00
Toshihito Kikuchi
a77f260120 Bug 1603974 - Part 6: Introduce Kernel32ExportsSolver. r=mhowell
This patch introduces `Kernel32ExportsSolver` which calculates RVAs of
kernel32's functions and transfers them to a target process, where the
transferred RVAs are resolved into function addresses.

Depends on D68346

Differential Revision: https://phabricator.services.mozilla.com/D68347

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:02 +00:00
Toshihito Kikuchi
c0c91e1726 Bug 1603974 - Part 5: Introduce WindowsDllEntryPointInterceptor. r=mhowell
This patch introduces a new DLL interceptor `WindowsDllEntryPointInterceptor`
which applies a hook to a target function without backing up the original
function code.

Depends on D68345

Differential Revision: https://phabricator.services.mozilla.com/D68346

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:02 +00:00
Toshihito Kikuchi
b01c4ba875 Bug 1603974 - Part 4: Introduce MMPolicyInProcessEarlyStage. r=mhowell
This patch introduces a new policy `MMPolicyInProcessEarlyStage` which does
not consume any functions imported from kernel32.dll so that we can use it
in a process's early stage i.e. before IAT is resolved.

Depends on D68344

Differential Revision: https://phabricator.services.mozilla.com/D68345

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:02 +00:00
Toshihito Kikuchi
2337ab0265 Bug 1603974 - Part 3: Extract a patching operation from CreateTrampoline. r=mhowell
`WindowsDllDetourPatcher::CreateTrampoline` does not only create a trampoline
region but also applies a patch on an original function.  This patch extracts
the patching part as separate functions.

Differential Revision: https://phabricator.services.mozilla.com/D68344

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:02 +00:00
Toshihito Kikuchi
f7cddafed0 Bug 1603974 - Part 2: Move PEHeaders from CheckBlockInfo to IsDllAllowed. r=mhowell
This patch moves the instantiation of `PEHeaders` from `CheckBlockInfo` to
`IsDllAllowed` so that `IsDllAllowed` can use an instance of `PEHeaders`.

Depends on D68342

Differential Revision: https://phabricator.services.mozilla.com/D68343

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:01 +00:00
Toshihito Kikuchi
8bb38652d4 Bug 1603974 - Part 1: Implement nt::VirtualQuery consuming only ntdll.dll. r=mhowell
This patch introduces `nt::VirtualQuery` which consumes only ntdll's functions
to reduce dependency in `MMPolicy` on kernel32.dll.  With this, `MMPolicy` still
depends on kernel32.dll, that will be solved by a coming patch.

Differential Revision: https://phabricator.services.mozilla.com/D68342

--HG--
extra : moz-landing-system : lando
2020-04-08 14:27:01 +00:00
Andreas Farre
36eaf82163 Bug 1620594 - Part 2: Use SchedulerGroup::Dispatch instead of SystemGroup::Dispatch. r=nika
Depends on D67631

Differential Revision: https://phabricator.services.mozilla.com/D67632

--HG--
extra : moz-landing-system : lando
2020-04-07 15:16:33 +00:00
Daniel Varga
2617f15d0c Backed out 8 changesets (bug 1603974) for causing build bustage
CLOSED TREE

Backed out changeset ee3fb8271709 (bug 1603974)
Backed out changeset 28ef741f8f65 (bug 1603974)
Backed out changeset 631725404fb8 (bug 1603974)
Backed out changeset 484a45d16149 (bug 1603974)
Backed out changeset 5d4cd3237ec0 (bug 1603974)
Backed out changeset c2601b5bdd3e (bug 1603974)
Backed out changeset fe96d48d5b14 (bug 1603974)
Backed out changeset 9467dffe8d04 (bug 1603974)
2020-04-07 18:35:04 +03:00
Toshihito Kikuchi
bf6e25daaa Bug 1603974 - Part 8: Use RedirectToNoOpEntryPoint for dgapi[64].dll. r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D68349

--HG--
extra : moz-landing-system : lando
2020-04-07 14:39:47 +00:00
Toshihito Kikuchi
c92df182f4 Bug 1603974 - Part 7: Introduce a new blocklist type RedirectToNoOpEntryPoint. r=mhowell
This patch introduces a new DLL blocklist type `RedirectToNoOpEntryPoint`
which hooks a DLL's entrypoint into a no-op function.  With this technique,
we give the injected DLL no chance to run its code though we allow it to be
loaded into the process.

This new blocklist type is intended to block a DLL which is injected by IAT
patching which was planted by a kernel callback routine for LoadImage.  It's
because blocking such a DLL makes a new process fail to launch.

Differential Revision: https://phabricator.services.mozilla.com/D68348

--HG--
extra : moz-landing-system : lando
2020-04-07 14:39:49 +00:00
Toshihito Kikuchi
f30b012bd4 Bug 1603974 - Part 6: Introduce Kernel32ExportsSolver. r=mhowell
This patch introduces `Kernel32ExportsSolver` which calculates RVAs of
kernel32's functions and transfers them to a target process, where the
transferred RVAs are resolved into function addresses.

Depends on D68346

Differential Revision: https://phabricator.services.mozilla.com/D68347

--HG--
extra : moz-landing-system : lando
2020-04-07 14:39:51 +00:00
Toshihito Kikuchi
9fe11cf59a Bug 1603974 - Part 5: Introduce WindowsDllEntryPointInterceptor. r=mhowell
This patch introduces a new DLL interceptor `WindowsDllEntryPointInterceptor`
which applies a hook to a target function without backing up the original
function code.

Depends on D68345

Differential Revision: https://phabricator.services.mozilla.com/D68346

--HG--
extra : moz-landing-system : lando
2020-04-07 14:39:54 +00:00
Toshihito Kikuchi
8219a28c40 Bug 1603974 - Part 4: Introduce MMPolicyInProcessEarlyStage. r=mhowell
This patch introduces a new policy `MMPolicyInProcessEarlyStage` which does
not consume any functions imported from kernel32.dll so that we can use it
in a process's early stage i.e. before IAT is resolved.

Depends on D68344

Differential Revision: https://phabricator.services.mozilla.com/D68345

--HG--
extra : moz-landing-system : lando
2020-04-07 14:39:56 +00:00
Toshihito Kikuchi
55af68b7d2 Bug 1603974 - Part 3: Extract a patching operation from CreateTrampoline. r=mhowell
`WindowsDllDetourPatcher::CreateTrampoline` does not only create a trampoline
region but also applies a patch on an original function.  This patch extracts
the patching part as separate functions.

Depends on D68343

Differential Revision: https://phabricator.services.mozilla.com/D68344

--HG--
extra : moz-landing-system : lando
2020-04-07 14:40:04 +00:00
Toshihito Kikuchi
b5969e8a0f Bug 1603974 - Part 2: Move PEHeaders from CheckBlockInfo to IsDllAllowed. r=mhowell
This patch moves the instantiation of `PEHeaders` from `CheckBlockInfo` to
`IsDllAllowed` so that `IsDllAllowed` can use an instance of `PEHeaders`.

Depends on D68342

Differential Revision: https://phabricator.services.mozilla.com/D68343

--HG--
extra : moz-landing-system : lando
2020-04-07 14:40:07 +00:00
Toshihito Kikuchi
18f97f01b8 Bug 1603974 - Part 1: Implement nt::VirtualQuery consuming only ntdll.dll. r=mhowell
This patch introduces `nt::VirtualQuery` which consumes only ntdll's functions
to reduce dependency in `MMPolicy` on kernel32.dll.  With this, `MMPolicy` still
depends on kernel32.dll, that will be solved by a coming patch.

Differential Revision: https://phabricator.services.mozilla.com/D68342

--HG--
extra : moz-landing-system : lando
2020-04-07 14:40:14 +00:00
Jon Coppeard
f105b2ae13 Bug 1627683 - Update TSAN suppression list following changes to give GC cells headers r=decoder
Similarly to changeset cfa64a6b5a87, a scope's enclosing scope is no longer updated by MovingTracer::onScopeEdge following the changes in bug 1625212. Update the suppression list accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D69986

--HG--
extra : moz-landing-system : lando
2020-04-07 12:22:07 +00:00
Simon Giesecke
e3d1db10d9 Bug 1626884 - Make RC non-copyable and declare operator= only in debug builds. r=froydnj
RC should be non-copyable. It already is non-copyable in the atomic variant,
but not in the non-atomic variant. This ensures that RefCounted is also
non-copyable, which prevents that classes deriving from RefCounted get
accidentally copied.

Also, RC's operator= should be defined only in debug builds. As already
described in a code comment, it's only used in debug builds (to assign the
dead value), and otherwise no modifications other than incrementing &
decrementing should be possible.

Differential Revision: https://phabricator.services.mozilla.com/D69332

--HG--
extra : moz-landing-system : lando
2020-04-06 09:17:34 +00:00
Andrea Marchesini
9bea58365a Bug 1624146 - Cookie code refactoring - part 10 - CookieService under mozilla::net, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D67759

--HG--
rename : netwerk/cookie/nsCookieService.cpp => netwerk/cookie/CookieService.cpp
rename : netwerk/cookie/nsCookieService.h => netwerk/cookie/CookieService.h
extra : moz-landing-system : lando
2020-04-06 12:26:14 +00:00
Gerald Squelart
ca9fa3fe8f Bug 1627563 - Replace MOZ_MUST_USE with [[nodiscard]] in mozglue/baseprofiler. r=canaltinova
Also move MOZ_MUST_USE before function declarations' specifiers and return type. While clang and gcc's attribute((warn_unused_result)) can appear before, between, or after function specifiers and return types, the [[nodiscard]] attribute must precede the function specifiers.

And removed a few unneded `#include "mozilla/Attributes.h"`.

Differential Revision: https://phabricator.services.mozilla.com/D69755

--HG--
extra : moz-landing-system : lando
2020-04-06 10:04:38 +00:00
Jon Coppeard
2fa68eed9c Bug 1625212 - Update TSAN supression list now a Shape's base shape is not marked directly r=sfink
Previously this ended up with MovingTracer doing the update itself, but now the pointer is stored in a CellHeader it's done through an overload of TraceEdge.

The TSAN stack doesn't appear to have the class for the unsafeSetPtr method that actually does the update so rather than make this apply to all uses of this method I added a supression for the next function up in the stack.

Differential Revision: https://phabricator.services.mozilla.com/D69524

--HG--
extra : moz-landing-system : lando
2020-04-06 10:43:34 +00:00
Sylvestre Ledru
0aa6f03cf3 Bug 1519636 - Reformat recent changes to the Google coding style r=jgilbert
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D67574

--HG--
extra : moz-landing-system : lando
2020-04-05 13:34:58 +00:00
Toshihito Kikuchi
b7dfd23416 Bug 1625452 - No need to pass an offset to CountPrefixBytes. r=handyman
When our detour processes instructions, we pass `ReadOnlyTargetFunction` to
`CountPrefixBytes` to determine whether a lock prefix exists or not.
In that case, we don't need to pass both `ReadOnlyTargetFunction` and an offset
as a parameter because `ReadOnlyTargetFunction` has an offset as a member.

Differential Revision: https://phabricator.services.mozilla.com/D69360

--HG--
extra : moz-landing-system : lando
2020-04-04 10:31:32 +00:00
Eric Rahm
12ca859e67 Bug 1626456 - Remove stray nsAutoPtr.h includes. r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D69127

--HG--
extra : moz-landing-system : lando
2020-04-03 21:05:46 +00:00
Gabriele Svelto
5c3d7d4ed9 Bug 1624336 - Block old versions of COMODO Firewall to prevent them from crashing Firefox r=aklotz
Differential Revision: https://phabricator.services.mozilla.com/D68188

--HG--
extra : moz-landing-system : lando
2020-04-02 20:47:30 +00:00
Gerald Squelart
d4709d16f3 Bug 1625856 - ProfileBufferChunkManagerWithLocalLimit - r=canaltinova
`ProfileBufferChunkManagerWithLocalLimit` is a chunk manager that enforces a
memory limit in each process.

It is meant to mimic the main way `BlocksRingBuffer` works, so that we can more
easily switch to the new buffer storage without introducing the extra complexity
of inter-process memory coordination yet.

`ProfileBufferChunkManagerWithLocalLimit` will still offer a benefit over
`BlocksRingBuffer`, in that it won't allocate the maximum buffer size
immediately -- speeding the initialization, and hopefully even reducing the
total Firefox memory consumption in short-lived processes.

Differential Revision: https://phabricator.services.mozilla.com/D68770

--HG--
extra : moz-landing-system : lando
2020-04-02 03:09:36 +00:00
Dorel Luca
8d8dda7ae9 Backed out 2 changesets (bug 1595596) for build bustage in build/src/mozglue/misc/MmapFaultHandler.cpp. CLOSED TREE
Backed out changeset 34c018c96749 (bug 1595596)
Backed out changeset 1e21eefd5fce (bug 1595596)

--HG--
rename : mozglue/misc/MmapFaultHandler.cpp => modules/libjar/MmapFaultHandler.cpp
rename : mozglue/misc/MmapFaultHandler.h => modules/libjar/MmapFaultHandler.h
2020-03-31 02:07:33 +03:00
Doug Thayer
13ecdfb5c8 Bug 1595596 - Use MMAP_FAULT_HANDLER in StartupCache r=aklotz
Please double check that I am using this correctly. I believe we are
seeing the crash in the linked bug because we are not handling hardware
faults when reading from the memory mapped file. This patch just wraps
all accesses in the MMAP_FAULT_HANDLER_ macros.

Depends on D53042

Differential Revision: https://phabricator.services.mozilla.com/D53043

--HG--
rename : modules/libjar/MmapFaultHandler.cpp => mozglue/misc/MmapFaultHandler.cpp
rename : modules/libjar/MmapFaultHandler.h => mozglue/misc/MmapFaultHandler.h
extra : moz-landing-system : lando
2020-03-27 21:00:47 +00:00
Gerald Squelart
de1f096fd6 Bug 1624257 - ProfileBufferChunkManagerSingle - r=canaltinova
Chunk manager dealing with only one chunk at a time.

Differential Revision: https://phabricator.services.mozilla.com/D68014

--HG--
extra : moz-landing-system : lando
2020-03-29 23:49:32 +00:00
Gerald Squelart
2e503c9a92 Bug 1624257 - ProfileBufferChunkManager - r=canaltinova
Base class for chunk managers.

Differential Revision: https://phabricator.services.mozilla.com/D68013

--HG--
extra : moz-landing-system : lando
2020-03-29 23:25:35 +00:00
André Bargull
14ca007916 Bug 1625138 - Part 41: Remove no longer needed includes for mozilla/TypeTraits. r=froydnj
Also adds missing includes in some files, these were previously only transivitely
included through mozilla/TypeTraits.h.

Differential Revision: https://phabricator.services.mozilla.com/D68561

--HG--
extra : moz-landing-system : lando
2020-03-28 16:00:09 +00:00
André Bargull
13bfe75b97 Bug 1625138 - Part 40: Replace remaining mozilla::IsSame with std::is_same. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68560

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:21 +00:00
André Bargull
cf0b1e89e9 Bug 1625138 - Part 30: Replace mozilla::RemoveCV with std::remove_cv. r=froydnj,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D68547

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:18 +00:00
André Bargull
a08be4177e Bug 1625138 - Part 17: Replace mozilla::Decay with std::decay. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68372

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:15 +00:00
André Bargull
ebec34a898 Bug 1625138 - Part 16: Replace mozilla::IsIntegral with std::is_integral. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68371

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:15 +00:00
André Bargull
13e9ad3137 Bug 1625138 - Part 14: Replace mozilla::IsSigned with std::is_signed. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68369

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:15 +00:00
André Bargull
1e4d8b891e Bug 1625138 - Part 4: Replace mozilla::MakeUnsigned with std::make_unsigned. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68358

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:12 +00:00
Christian Holler
c248943491 Bug 1620326 - Add a separate TSan suppression list for the updater. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D67125

--HG--
extra : moz-landing-system : lando
2020-03-26 21:19:24 +00:00
James Willcox
2ef4e466f8 Bug 1291377 - Don't use custom linker on Android 6.0+ r=glandium
We still need it for Android < 6.0 (API 23) because otherwise we don't
have a way to hook up mozalloc.

Differential Revision: https://phabricator.services.mozilla.com/D66993

--HG--
extra : moz-landing-system : lando
2020-03-20 15:35:48 +00:00
Gerald Squelart
c80fa7258c Bug 1623228 - ProfileBufferChunk - r=canaltinova
A `ProfileBufferChunk` represents a single chunk of memory, with an optional
link to the next chunk.

In the new Fission-compatible profiler storage, chunks will be allocated by a
chunk manager, filled with data by the profiler, and then released back to the
chunk manager.
The chunk manager may decide to destroy or recycle old chunks based on memory
limits (per process, or for the entire Firefox app).

Differential Revision: https://phabricator.services.mozilla.com/D67272

--HG--
extra : moz-landing-system : lando
2020-03-24 01:04:33 +00:00
Razvan Maries
f86965f8af Backed out changeset 1a28a2477439 (bug 1623228) for build bustages on ProfileBufferChunk.h. CLOSED TREE 2020-03-23 23:29:12 +02:00
Gerald Squelart
df0599ee6d Bug 1623228 - ProfileBufferChunk - r=canaltinova
A `ProfileBufferChunk` represents a single chunk of memory, with an optional
link to the next chunk.

In the new Fission-compatible profiler storage, chunks will be allocated by a
chunk manager, filled with data by the profiler, and then released back to the
chunk manager.
The chunk manager may decide to destroy or recycle old chunks based on memory
limits (per process, or for the entire Firefox app).

Differential Revision: https://phabricator.services.mozilla.com/D67272

--HG--
extra : moz-landing-system : lando
2020-03-23 18:16:08 +00:00
Sylvestre Ledru
734f79b541 Bug 1624237 - Run misc-unused-using-decls - Remove useless declarations r=andi
$ ./mach static-analysis check --checks="-*, misc-unused-using-decls" --fix <path>

Differential Revision: https://phabricator.services.mozilla.com/D67811

--HG--
extra : moz-landing-system : lando
2020-03-23 13:15:33 +00:00
Christian Holler
b503a043c8 Bug 1600895 - Add additional suppression for race variant. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D67732

--HG--
extra : moz-landing-system : lando
2020-03-23 10:30:03 +00:00
Bogdan Tara
05377fcd08 Backed out changeset fe0c22951e7c (bug 1291377) for mozglue related Android bustages CLOSED TREE 2020-03-20 16:39:42 +02:00
James Willcox
e2c25ee165 Bug 1291377 - Don't use custom linker on Android 6.0+ r=glandium
We still need it for Android < 6.0 (API 23) because otherwise we don't
have a way to hook up mozalloc.

Differential Revision: https://phabricator.services.mozilla.com/D66993

--HG--
extra : moz-landing-system : lando
2020-03-20 14:20:48 +00:00
Gabriele Svelto
4d14cf5024 Bug 1621804 - Block the latest release of OpenSC which crashes Firefox nightly r=aklotz
Differential Revision: https://phabricator.services.mozilla.com/D67529

--HG--
extra : moz-landing-system : lando
2020-03-19 22:36:51 +00:00
Gerald Squelart
7dd306dcd9 Bug 1623195 - Optimize ProfileBufferEntryWriter::Serializer<Variant> - r=canaltinova
The old code was using `std::index_sequence_for` to call templated functions for
*every* possible Variant alternative.
Instead, using `Variant::match()` with a generic lambda (that also takes the
current Variant index, thanks to bug 1621865) means we're only calling the
function corresponding to the current alternative.

Differential Revision: https://phabricator.services.mozilla.com/D67241

--HG--
extra : moz-landing-system : lando
2020-03-18 10:23:10 +00:00
Chris Fronk
d5b004443b Bug 1143478 - Rename mozilla::Pair to CompactPair. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64511

--HG--
rename : mfbt/Pair.h => mfbt/CompactPair.h
extra : moz-landing-system : lando
2020-03-17 12:42:12 +00:00