Commit Graph

333 Commits

Author SHA1 Message Date
Toshihito Kikuchi
a2f2d585ea Bug 1509748 - Do not touch ntdll's PE header directly if EAF+ is enabled. r=mhowell,mstange
If EAF+ is enabled for firefox.exe, the process does not launch because we parse
the PE headers of ntdll.dll at startup, which is prohibited by EAF+.

With this patch, we skip two operations when EAF+ is enabled.

The first one is to cache ntdll's IAT at startup.  Because EAF+ is expected to
prevent an injected module from parsing PE headers and modifying IAT, we can skip
this caching safely.

The second one is to load ntdll's debug information for the profiler.  With this
patch, the profiler's callstack will not show a raw address instead of a symbol
name.  It's a bad side effect, but much better than startup crash.

Differential Revision: https://phabricator.services.mozilla.com/D76959
2020-05-27 21:48:35 +00:00
Greg V
e65e9412b0 Bug 1634205 - Support Gecko Profiler and Base Profiler on FreeBSD r=mstange
- supports amd64 and arm64 (aarch64)
- uses LUL for stack walking

Differential Revision: https://phabricator.services.mozilla.com/D73162
2020-05-06 17:44:19 +00:00
Toshihito Kikuchi
62788db1e7 Bug 1620118 - Part 1: Add ProcessedModuleLoadEvent::mIsDependent. r=aklotz
This patch adds a boolean field `mIsDependent` indicating whether a module was
loaded via the executable's Import Directory Table or not.

This patch also partially reverts Bug 1587539, moving a logic to detect Import
Directory tampering to `PEHeaders`'s ctor.  With this, we can skip generating
a map of the executable's dependent modules if no tampering is detected.

Differential Revision: https://phabricator.services.mozilla.com/D66274
2020-05-04 17:20:51 +00:00
Chris Peterson
7ebea17a8e Bug 1629317 - Replace MOZ_MUST_USE with [[nodiscard]] in mozglue/misc/NativeNt.h. r=mhowell
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.

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

--HG--
extra : moz-landing-system : lando
2020-04-13 15:15:32 +00:00
Nicholas Nethercote
8139b4051e Bug 1619840 - Remove fix_{linux,macosx}_stack.py and fix_stack_using_bpsyms.py. r=erahm
This commit removes `test_fix_stack_using_bpsyms.py`. That test can't easily be
modified to work with `fix_stacks.py` because it relies on internal
implementation details of `fix_stack_using_bpsym.py`. The unit testing done in
the `fix-stacks` repo provides test coverage that is as good or better.

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

--HG--
extra : moz-landing-system : lando
2020-04-08 06:55:54 +00:00
Doug Thayer
c5939cab4c 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-04-10 21:16:15 +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
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
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
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
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
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
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
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
Markus Stange
345b2ee888 Bug 1619362 - Parse MOZ_BASE_PROFILER_STARTUP_DURATION and _INTERVAL. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64988

--HG--
extra : moz-landing-system : lando
2020-03-17 04:11:20 +00:00
Bob Owen
22f20a8d00 Bug 1557282 Part 2: Fix profiler issues when using SetLockdownDefaultDacl. r=dmajor
When we are running from a network drive the new feature in part 1 doesn't work.
So this uses DuplicateHandle instead of OpenThread to get the thread handle used
by the profiler.
It also removes a DuplicateHandle THREAD_ALL_ACCESS call that also fails and a
DuplicateHandle to get a real process handle, which only seems to have been to
fix something on Windows XP.
The handle passed in is always the profiler one, so already has the necessary
permissions. If no thread handle is passed then the pseudo handle is used.

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

--HG--
extra : moz-landing-system : lando
2020-03-12 20:40:50 +00:00
Narcis Beleuzu
feebca4edf Backed out 4 changesets (bug 1557282) as requested by tjr . CLOSED TREE
Backed out changeset deabd1e1018b (bug 1557282)
Backed out changeset 25e5b5ba8ac3 (bug 1557282)
Backed out changeset 30afcaf2782a (bug 1557282)
Backed out changeset f83095f739e0 (bug 1557282)

--HG--
extra : rebase_source : 1730b805fbd8d0b786f7dcec71aa9c02a8f7a93a
2020-03-12 19:39:27 +02:00
Bob Owen
f25e4ba8c6 Bug 1557282 Part 2: Fix profiler issues when using SetLockdownDefaultDacl.
When we are running from a network drive the new feature in part 1 doesn't work.
So this uses DuplicateHandle instead of OpenThread to get the thread handle used
by the profiler.
It also removes a DuplicateHandle THREAD_ALL_ACCESS call that also fails and a
DuplicateHandle to get a real process handle, which only seems to have been to
fix something on Windows XP.
The handle passed in is always the profiler one, so already has the necessary
permissions. If no thread handle is passed then the pseudo handle is used.

Depends on D66610

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

--HG--
extra : moz-landing-system : lando
2020-03-12 16:57:45 +00:00
Simon Giesecke
a763c5c535 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in mozglue. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D65495

--HG--
extra : moz-landing-system : lando
2020-03-10 08:47:24 +00:00
David Parks
d7f1ab7118 Bug 1615752: Require 10-byte detour for Win 8.0 x64 CreateFileA and DuplicateHandle r=aklotz
In the current Win 8.0, these functions both start with a RIP-relative JMP (6 bytes) followed by 6 nops (6-bytes), which does not give us the 13-bytes we need for a trampoline so we require the trampoline to fit into 10 bytes.

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

--HG--
extra : moz-landing-system : lando
2020-03-03 19:23:53 +00:00
Toshihito Kikuchi
cc5d112b9f Bug 1615308 - Validate each entry of IAT for ntdll.dll before copying it into a new process. r=aklotz
We copy IAT for ntdll.dll into a new process so that our hook code can use
ntdll's functions even in the early stage.  However, IAT can be modified and
some entries may point to an address which is not valid in the child process.
In such a case, we should not copy IAT.  One example is Windows compat mode
which redirects some ntdll functions into AcLayers.dll via IAT.

With this patch, we verify each IAT entry and if any of them is outside ntdll,
we give up using the launcher process and start the browser process.

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

--HG--
extra : moz-landing-system : lando
2020-03-03 00:19:41 +00:00
Toshihito Kikuchi
cd995fd09d Bug 1617935 - Support opcode83 [r+disp8],imm8 in x86 detour. r=handyman
In x86, our detour handles opcode 83 only when the Mod bits is 3.
When working on another project, I hit the instruction `cmp [ebp+0Ch],1`
where the Mod bits is 1, and it can be easily handled by a small fix.
It turned out my project does not need it, but it'd be good to have this.

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

--HG--
extra : moz-landing-system : lando
2020-02-27 21:11:55 +00:00
Andrew McCreight
4babb2b5ab Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

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

--HG--
extra : moz-landing-system : lando
2020-02-27 17:39:15 +00:00
Ciure Andrei
00dd87f6f4 Backed out changeset d407a28318e6 (bug 1609815) for causing windows ming bustages CLOSED TREE
--HG--
extra : histedit_source : b2c748e31e0f6ba8fcf9960a336e0bbd361b07e6
2020-02-27 07:05:19 +02:00
Andrew McCreight
b197e1f783 Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

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

--HG--
extra : moz-landing-system : lando
2020-02-27 04:43:48 +00:00
Toshihito Kikuchi
f6a7430688 Bug 1610790: Part 2 - Implement GetProcAddress for a remote process. r=handyman
This patch adds a function to get an exported function in a remote process.
We need this implementation to address Bug 1604008, Bug 1608645, and Bug 1610790.

When `WindowsDllInterceptor` detours a function in a remote process, we used the
native `GetProcAddress` locally, and then detours the returned address in the
target process.  The problem is if the caller's export table was modified, the
address returned from `GetProcAddress` might be invalid in the target process,
which is Bug 1604008.

I implemented `GetProcAddress` depending on both local and remote process image,
but it caused two regressions Bug 1608645 and Bug 1610790 because multiple
applications modify firefox's export table in multiple ways, such as replacing
an entry of EAT, replacing an RVA to Export section, or etc.

With this patch, we can use `PEExportSection<MMPolicy>::GetProcAddress` to get
an exported function in a remote process without relying on any local data so
that it's not impacted by modification of the local export table.

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

Depends on D62314
2020-02-11 22:21:10 +02:00
Cosmin Sabou
aa2a505209 Backed out 2 changesets (bug 1610790) for causing build bustages about ShowSSEConfig.
CLOSED TREE
2020-02-12 01:10:38 +02:00
Toshihito Kikuchi
23b368208e Bug 1610790: Part 2 - Implement GetProcAddress for a remote process. r=handyman
This patch adds a function to get an exported function in a remote process.
We need this implementation to address Bug 1604008, Bug 1608645, and Bug 1610790.

When `WindowsDllInterceptor` detours a function in a remote process, we used the
native `GetProcAddress` locally, and then detours the returned address in the
target process.  The problem is if the caller's export table was modified, the
address returned from `GetProcAddress` might be invalid in the target process,
which is Bug 1604008.

I implemented `GetProcAddress` depending on both local and remote process image,
but it caused two regressions Bug 1608645 and Bug 1610790 because multiple
applications modify firefox's export table in multiple ways, such as replacing
an entry of EAT, replacing an RVA to Export section, or etc.

With this patch, we can use `PEExportSection<MMPolicy>::GetProcAddress` to get
an exported function in a remote process without relying on any local data so
that it's not impacted by modification of the local export table.

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

Depends on D62314

--HG--
extra : rebase_source : 3088f5997a2097ef22ce8567783375e5f7866ab2
2020-02-11 22:21:10 +02:00
Cosmin Sabou
d8474fa6b6 Backed out changeset f0890a32d6bb (bug 1604008) as requested by tkikuchi (toshi).
--HG--
extra : rebase_source : 799ec22fbc48b549c2e9d5ea295bcf92cb941b5d
2020-02-11 23:21:17 +02:00
Cosmin Sabou
b438e2a16f Backed out changeset f74adc43b654 (bug 1608645) as requested by tkikuchi (toshi).
--HG--
extra : rebase_source : 83d53600fe057aca34128ac37b451120cb3337b5
2020-02-11 23:19:56 +02:00
Toshihito Kikuchi
3694eeda43 Bug 1592486 - Store ModuleLoadFrame::sTopFrame as a global variable if TLS is not ready. r=aklotz
We had a thread-local varialbe `ModuleLoadFrame::sTopFrame` to track the topmost
stack frame of `LdrLoadDll`.  However, our hook function `patched_LdrLoadDll` can
be called even before TLS is initialized.  In such a case, accessing `sTopFrame`
causes AV.

This patch introduces `SafeThreadLocal` to safely access a thread-local varialbe.
If TLS is not initialized, it falls back to a global variable because in that
early stage there is only a single thread running.

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

--HG--
extra : moz-landing-system : lando
2020-02-07 18:08:11 +00:00
Narcis Beleuzu
614e851352 Backed out changeset 6866be136e53 (bug 1592486) for cppunit failures on TestNativeNt.exe . CLOSED TREE 2020-02-06 11:53:45 +02:00
Toshihito Kikuchi
c531413173 Bug 1592486 - Store ModuleLoadFrame::sTopFrame as a global variable if TLS is not ready. r=aklotz
We had a thread-local varialbe `ModuleLoadFrame::sTopFrame` to track the topmost
stack frame of `LdrLoadDll`.  However, our hook function `patched_LdrLoadDll` can
be called even before TLS is initialized.  In such a case, accessing `sTopFrame`
causes AV.

This patch introduces `SafeThreadLocal` to safely access a thread-local varialbe.
If TLS is not initialized, it falls back to a global variable because in that
early stage there is only a single thread running.

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

--HG--
extra : moz-landing-system : lando
2020-02-06 03:10:57 +00:00
David Major
76ce9d96fa Bug 1598119 - Disable Control Flow Guard for WindowsDllInterceptor returns r=handyman
Under the stronger Control Flow Guard scheme coming in clang 10, when a nop-space hook jumps back to the original API, at `ntdll!Whatever+2`, that address is not a registered jump target, so we crash with a CFG failure. Since this is a deliberate violation of the rules, let's disable CFG for these calls.

Based on my testing, this is the only place we need to use this attribute, so I placed its definition close to the use. (Had we needed more of these, I would have put it in mfbt/.)

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

--HG--
extra : moz-landing-system : lando
2020-01-21 18:50:22 +00:00
Toshihito Kikuchi
a172471711 Bug 1608645 - Ensure FindExportAddressTableEntry can handle a modified Export Table. r=aklotz
A third-party application can modify the export directory, the export address/name/ordinal
tables, or an entry in those tables.  If that happens, we will see an RVA is located outside
the mapped image and `RVAToPtr` returns null.  This patch makes sure we don't hit null AV
when modification is detected.

`FindExportAddressTableEntry` should not return a pointer to the modified table entry because
we dereference it in another process to cross-process detour.

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

--HG--
extra : moz-landing-system : lando
2020-01-21 00:44:28 +00:00