Граф коммитов

8 Коммитов

Автор SHA1 Сообщение Дата
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
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
Toshihito Kikuchi c277593b98 Bug 1587539 - Skip bounds check when getting IAT if Import Directory is tampered. r=aklotz
Some applications tamper Import Directory entry of a loaded executable image
to pretend static dependency on their module.  We have `RestoreImportDirectory`
to revert it in the browser process.  If tampering happened in the launcher
process, however, we failed to get an IAT thunk address via `GetIATThunksForModule`
because it could be located outside the mapped image.

With this patch, we skip bounds check in `GetIATThunksForModule` if we detect
tampering in the launcher process.  We can proceed safely because it's expected
that Import Directory is still valid though it's located outside.

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

--HG--
extra : moz-landing-system : lando
2019-11-06 21:54:55 +00:00
Toshihito Kikuchi 18aab300b5 Bug 1576697 - Use LauncherResult in WinHeaderOnlyUtils.h instead of WindowsErrorResult. r=aklotz
`WindowsErrorResult` is a class to hold either a value or a Windows error
code based on the `Result` template.  We also have `LauncherResult` for the
same purpose, which was introduced as a part of the launcher process feature
afterward.  The difference is `LauncherResult` holds a filename and line
number along with an error code.

This patch integrates LauncherResult.h into WinHeaderOnlyUtils.h so that we
can use `LauncherResult` more broadly.

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

--HG--
extra : moz-landing-system : lando
2019-09-07 18:17:45 +00:00
Sylvestre Ledru a1dce6440a Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-22 16:35:03 +00:00
Aaron Klotz 1a74deabad Bug 1503538: Part 3 - Changes to NativeNt and ImportDir to allow for blocking injected static DLL dependencies; r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D27145

--HG--
extra : moz-landing-system : lando
2019-04-12 19:58:01 +00:00