Skip to content

Commit

Permalink
Backed out changeset 4dab43248f15 (bug 1372823) for crashing GTest on…
Browse files Browse the repository at this point in the history
… Windows 10 x64 debug. r=backout

MozReview-Commit-ID: 1u7TFtv6Mdv
  • Loading branch information
Archaeopteryx committed Sep 21, 2017
1 parent ddbf9d2 commit 15ce5cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mozglue/build/WindowsDllBlocklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ printf_stderr(const char *fmt, ...)
}


#ifdef _M_IX86
typedef MOZ_NORETURN_PTR void (__fastcall* BaseThreadInitThunk_func)(BOOL aIsInitialThread, void* aStartAddress, void* aThreadParam);
static BaseThreadInitThunk_func stub_BaseThreadInitThunk = nullptr;
#endif

typedef NTSTATUS (NTAPI *LdrLoadDll_func) (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle);
static LdrLoadDll_func stub_LdrLoadDll;
Expand Down Expand Up @@ -786,6 +788,7 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
return stub_LdrLoadDll(filePath, flags, moduleFileName, handle);
}

#ifdef _M_IX86
static bool
ShouldBlockThread(void* aStartAddress)
{
Expand Down Expand Up @@ -821,6 +824,8 @@ patched_BaseThreadInitThunk(BOOL aIsInitialThread, void* aStartAddress,
stub_BaseThreadInitThunk(aIsInitialThread, aStartAddress, aThreadParam);
}

#endif // _M_IX86


static WindowsDllInterceptor NtDllIntercept;
static WindowsDllInterceptor Kernel32Intercept;
Expand Down Expand Up @@ -870,6 +875,8 @@ DllBlocklist_Initialize(uint32_t aInitFlags)
}
#endif

#ifdef _M_IX86 // Minimize impact. Crashes in BaseThreadInitThunk are more frequent on x86

// Bug 1361410: WRusr.dll will overwrite our hook and cause a crash.
// Workaround: If we detect WRusr.dll, don't hook.
if (!GetModuleHandleW(L"WRusr.dll")) {
Expand All @@ -881,6 +888,7 @@ DllBlocklist_Initialize(uint32_t aInitFlags)
#endif
}
}
#endif // _M_IX86
}

MFBT_API void
Expand Down
2 changes: 2 additions & 0 deletions toolkit/xre/test/win/TestDllInterceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,9 @@ int main()
TestHook(TestSetCursorPos, "user32.dll", "SetCursorPos") &&
TestHook(TestTlsAlloc, "kernel32.dll", "TlsAlloc") &&
TestHook(TestTlsFree, "kernel32.dll", "TlsFree") &&
#ifdef _M_IX86
TestDetour("kernel32.dll", "BaseThreadInitThunk") &&
#endif
TestDetour("ntdll.dll", "LdrLoadDll")) {
printf("TEST-PASS | WindowsDllInterceptor | all checks passed\n");
return 0;
Expand Down

0 comments on commit 15ce5cb

Please sign in to comment.