author | Csoregi Natalia <ncsoregi@mozilla.com> |
Fri, 16 Mar 2018 16:38:57 +0200 | |
changeset 464588 | 1844f2f666237323616c67178f515e2fb14483ca |
parent 464587 | 86bf83ac969071303e8380973dda6bedb64e0a4c |
child 464589 | 6a0b4d9ef4fdfd9bcc9a5d842dfdba0e3749206d |
push id | 1728 |
push user | jlund@mozilla.com |
push date | Mon, 18 Jun 2018 21:12:27 +0000 |
treeherder | mozilla-release@c296fde26f5f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1435816 |
milestone | 61.0a1 |
backs out | 66fb307a2a709ec7df5e542aed9291879d063697 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mozglue/build/WindowsDllBlocklist.cpp +++ b/mozglue/build/WindowsDllBlocklist.cpp @@ -24,17 +24,16 @@ #pragma warning( pop ) #include "Authenticode.h" #include "nsAutoPtr.h" #include "nsWindowsDllInterceptor.h" #include "mozilla/Sprintf.h" #include "mozilla/StackWalk_windows.h" #include "mozilla/UniquePtr.h" -#include "mozilla/Vector.h" #include "mozilla/WindowsVersion.h" #include "nsWindowsHelpers.h" #include "WindowsDllBlocklist.h" #include "mozilla/AutoProfilerLabel.h" #include "mozilla/glue/WindowsDllServices.h" using namespace mozilla; @@ -799,36 +798,23 @@ continue_loading: // Prevent the stack walker from suspending this thread when LdrLoadDll // holds the RtlLookupFunctionEntry lock. AutoSuppressStackWalking suppress; #endif return stub_LdrLoadDll(filePath, flags, moduleFileName, handle); } -#if defined(NIGHTLY_BUILD) -// Map of specific thread proc addresses we should block. In particular, -// LoadLibrary* APIs which indicate DLL injection -static mozilla::Vector<void*, 4>* gStartAddressesToBlock; -#endif - static bool ShouldBlockThread(void* aStartAddress) { // Allows crashfirefox.exe to continue to work. Also if your threadproc is null, this crash is intentional. if (aStartAddress == 0) return false; -#if defined(NIGHTLY_BUILD) - if (std::find(gStartAddressesToBlock->begin(), gStartAddressesToBlock->end(), - aStartAddress) != gStartAddressesToBlock->end()) { - return true; - } -#endif - bool shouldBlock = false; MEMORY_BASIC_INFORMATION startAddressInfo = {0}; if (VirtualQuery(aStartAddress, &startAddressInfo, sizeof(startAddressInfo))) { shouldBlock |= startAddressInfo.State != MEM_COMMIT; shouldBlock |= startAddressInfo.Protect != PAGE_EXECUTE_READ; } return shouldBlock; @@ -859,17 +845,16 @@ static WindowsDllInterceptor Kernel32Int MFBT_API void DllBlocklist_Initialize(uint32_t aInitFlags) { if (sBlocklistInitAttempted) { return; } sInitFlags = aInitFlags; sBlocklistInitAttempted = true; - gStartAddressesToBlock = new mozilla::Vector<void*, 4>; // In order to be effective against AppInit DLLs, the blocklist must be // initialized before user32.dll is loaded into the process (bug 932100). if (GetModuleHandleA("user32.dll")) { sUser32BeforeBlocklist = true; #ifdef DEBUG printf_stderr("DLL blocklist was unable to intercept AppInit DLLs.\n"); #endif @@ -915,44 +900,16 @@ DllBlocklist_Initialize(uint32_t aInitFl if(!Kernel32Intercept.AddDetour("BaseThreadInitThunk", reinterpret_cast<intptr_t>(patched_BaseThreadInitThunk), (void**) &stub_BaseThreadInitThunk)) { #ifdef DEBUG printf_stderr("BaseThreadInitThunk hook failed\n"); #endif } } - -#if defined(NIGHTLY_BUILD) - // Populate a list of thread start addresses to block. - HMODULE hKernel = GetModuleHandleW(L"kernel32.dll"); - if (hKernel) { - void* pProc; - - pProc = GetProcAddress(hKernel, "LoadLibraryA"); - if (pProc) { - gStartAddressesToBlock->append(pProc); - } - - pProc = GetProcAddress(hKernel, "LoadLibraryW"); - if (pProc) { - gStartAddressesToBlock->append(pProc); - } - - pProc = GetProcAddress(hKernel, "LoadLibraryExA"); - if (pProc) { - gStartAddressesToBlock->append(pProc); - } - - pProc = GetProcAddress(hKernel, "LoadLibraryExW"); - if (pProc) { - gStartAddressesToBlock->append(pProc); - } - } -#endif } MFBT_API void DllBlocklist_WriteNotes(HANDLE file) { DWORD nBytes; WriteFile(file, kBlockedDllsParameter, kBlockedDllsParameterLen, &nBytes, nullptr);