mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1635823 - Skip nvd3d9wrap.dll to bypass Nvidia's crash for x86. r=mhowell, a=RyanVM
As Bug 1607574, we implemented a workaround for the crash caused by Nvidia's shim driver, where we hardcoded "nvd3d9wrapx.dll" as a target's name. However, it turned out that nvd3d9wrapx.dll is only for x64, and in x86 nvd3d9wrap.dll causes the same crash. We need to choose a right name per platform. Since there is no crash reports from ARM64 (probably no Nvidia driver is available for Windows ARM64 now), we skip the workaround for ARM64. Differential Revision: https://phabricator.services.mozilla.com/D74125
This commit is contained in:
parent
6cb509b787
commit
220fbcaee4
@ -149,18 +149,26 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf() {
|
||||
moduleNameStr.Cut(0, pos + 1);
|
||||
}
|
||||
|
||||
// Hackaround for Bug 1607574. Nvidia's shim driver nvd3d9wrapx.dll detours
|
||||
// LoadLibraryExW when it's loaded and the detour function causes AV when
|
||||
// the code tries to access data pointing to an address within unloaded
|
||||
// nvinitx.dll.
|
||||
// Hackaround for Bug 1607574. Nvidia's shim driver nvd3d9wrap[x].dll
|
||||
// detours LoadLibraryExW when it's loaded and the detour function causes
|
||||
// AV when the code tries to access data pointing to an address within
|
||||
// unloaded nvinit[x].dll.
|
||||
// The crashing code is executed when a given parameter is "detoured.dll"
|
||||
// and OS version is older than 6.2. We hit that crash at the following
|
||||
// call to LoadLibraryEx even if we specify LOAD_LIBRARY_AS_DATAFILE.
|
||||
// We work around it by skipping LoadLibraryEx, and add a library info with
|
||||
// a dummy breakpad id instead.
|
||||
#if !defined(_M_ARM64)
|
||||
# if defined(_M_AMD64)
|
||||
LPCWSTR kNvidiaShimDriver = L"nvd3d9wrapx.dll";
|
||||
LPCWSTR kNvidiaInitDriver = L"nvinitx.dll";
|
||||
# elif defined(_M_IX86)
|
||||
LPCWSTR kNvidiaShimDriver = L"nvd3d9wrap.dll";
|
||||
LPCWSTR kNvidiaInitDriver = L"nvinit.dll";
|
||||
# endif
|
||||
if (moduleNameStr.LowerCaseEqualsLiteral("detoured.dll") &&
|
||||
!mozilla::IsWin8OrLater() && ::GetModuleHandle(L"nvd3d9wrapx.dll") &&
|
||||
!::GetModuleHandle(L"nvinitx.dll")) {
|
||||
!mozilla::IsWin8OrLater() && ::GetModuleHandle(kNvidiaShimDriver) &&
|
||||
!::GetModuleHandle(kNvidiaInitDriver)) {
|
||||
NS_NAMED_LITERAL_STRING(pdbNameStr, "detoured.pdb");
|
||||
SharedLibrary shlib(
|
||||
(uintptr_t)module.lpBaseOfDll,
|
||||
@ -172,6 +180,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf() {
|
||||
sharedLibraryInfo.AddSharedLibrary(shlib);
|
||||
continue;
|
||||
}
|
||||
#endif // !defined(_M_ARM64)
|
||||
|
||||
nsCString breakpadId;
|
||||
// Load the module again to make sure that its handle will remain
|
||||
|
Loading…
Reference in New Issue
Block a user