зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1682609 - Do not enable neither pre-spawn CIG or automatic DLL injection in non-Nightly r=bobowen
IBM Security Trusteer Rapport does not only inject a module via Import Table but also apply a window hook. Bug 1682304 revealed blocking their module with RedirectToNoOpEntryPoint crashes a process because their hook function assumes injection was succceeded by default. In non-Nightly, therefore, we enable neither automatic DLL blocking nor pre-spawn CIG. Differential Revision: https://phabricator.services.mozilla.com/D99966
This commit is contained in:
Родитель
9b230b2b7b
Коммит
9a0d1a6973
|
@ -147,15 +147,19 @@ static void PackOffsetVector(const Vector<nt::MemorySectionNameOnHeap>& aSource,
|
||||||
LauncherVoidResult SharedSection::Init(const nt::PEHeaders& aPEHeaders) {
|
LauncherVoidResult SharedSection::Init(const nt::PEHeaders& aPEHeaders) {
|
||||||
size_t stringBufferSize = 0;
|
size_t stringBufferSize = 0;
|
||||||
Vector<nt::MemorySectionNameOnHeap> modules;
|
Vector<nt::MemorySectionNameOnHeap> modules;
|
||||||
|
|
||||||
|
// We enable automatic DLL blocking only in Nightly for now because it caused
|
||||||
|
// a compat issue (bug 1682304).
|
||||||
|
#if defined(NIGHTLY_BUILD)
|
||||||
aPEHeaders.EnumImportChunks(
|
aPEHeaders.EnumImportChunks(
|
||||||
[&stringBufferSize, &modules, &aPEHeaders](const char* aModule) {
|
[&stringBufferSize, &modules, &aPEHeaders](const char* aModule) {
|
||||||
#if defined(DONT_SKIP_DEFAULT_DEPENDENT_MODULES)
|
# if defined(DONT_SKIP_DEFAULT_DEPENDENT_MODULES)
|
||||||
Unused << aPEHeaders;
|
Unused << aPEHeaders;
|
||||||
#else
|
# else
|
||||||
if (aPEHeaders.IsWithinImage(aModule)) {
|
if (aPEHeaders.IsWithinImage(aModule)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
HMODULE module = ::GetModuleHandleA(aModule);
|
HMODULE module = ::GetModuleHandleA(aModule);
|
||||||
nt::MemorySectionNameOnHeap ntPath =
|
nt::MemorySectionNameOnHeap ntPath =
|
||||||
nt::MemorySectionNameOnHeap::GetBackingFilePath(nt::kCurrentProcess,
|
nt::MemorySectionNameOnHeap::GetBackingFilePath(nt::kCurrentProcess,
|
||||||
|
@ -163,6 +167,7 @@ LauncherVoidResult SharedSection::Init(const nt::PEHeaders& aPEHeaders) {
|
||||||
stringBufferSize += (ntPath.AsUnicodeString()->Length + sizeof(WCHAR));
|
stringBufferSize += (ntPath.AsUnicodeString()->Length + sizeof(WCHAR));
|
||||||
Unused << modules.emplaceBack(std::move(ntPath));
|
Unused << modules.emplaceBack(std::move(ntPath));
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t arraySize = modules.length() * sizeof(Layout::mModulePathArray[0]);
|
size_t arraySize = modules.length() * sizeof(Layout::mModulePathArray[0]);
|
||||||
size_t totalSize =
|
size_t totalSize =
|
||||||
|
@ -216,20 +221,21 @@ LauncherVoidResult SharedSection::TransferHandle(
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" MOZ_EXPORT uint32_t GetDependentModulePaths(uint32_t** aOutArray) {
|
extern "C" MOZ_EXPORT uint32_t GetDependentModulePaths(uint32_t** aOutArray) {
|
||||||
|
if (aOutArray) {
|
||||||
|
*aOutArray = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We enable pre-spawn CIG only in Nightly for now because it caused
|
||||||
|
// a compat issue (bug 1682304).
|
||||||
|
#if defined(NIGHTLY_BUILD)
|
||||||
const bool isCallerXul = CheckForAddress(RETURN_ADDRESS(), L"xul.dll");
|
const bool isCallerXul = CheckForAddress(RETURN_ADDRESS(), L"xul.dll");
|
||||||
MOZ_ASSERT(isCallerXul);
|
MOZ_ASSERT(isCallerXul);
|
||||||
if (!isCallerXul) {
|
if (!isCallerXul) {
|
||||||
if (aOutArray) {
|
|
||||||
*aOutArray = nullptr;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherResult<SharedSection::Layout*> resultView = gSharedSection.GetView();
|
LauncherResult<SharedSection::Layout*> resultView = gSharedSection.GetView();
|
||||||
if (resultView.isErr()) {
|
if (resultView.isErr()) {
|
||||||
if (aOutArray) {
|
|
||||||
*aOutArray = nullptr;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +245,9 @@ extern "C" MOZ_EXPORT uint32_t GetDependentModulePaths(uint32_t** aOutArray) {
|
||||||
*aOutArray = resultView.inspect()->mModulePathArray;
|
*aOutArray = resultView.inspect()->mModulePathArray;
|
||||||
}
|
}
|
||||||
return resultView.inspect()->mModulePathArrayLength;
|
return resultView.inspect()->mModulePathArrayLength;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace freestanding
|
} // namespace freestanding
|
||||||
|
|
Загрузка…
Ссылка в новой задаче