Bug 1844908 - Remove pre-Win10-specific codepath from Gecko Profiler. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D184305
This commit is contained in:
Masatoshi Kimura 2023-07-26 08:52:53 +00:00
parent aba7dab929
commit 83b286649b
3 changed files with 2 additions and 51 deletions

View File

@ -34,7 +34,6 @@
#include "nsWindowsDllInterceptor.h"
#include "mozilla/StackWalk_windows.h"
#include "mozilla/WindowsVersion.h"
namespace mozilla {
namespace baseprofiler {
@ -336,11 +335,8 @@ MFBT_API void InitializeWin64ProfilerHooks() {
NtDllIntercept.Init("ntdll.dll");
stub_LdrUnloadDll.Set(NtDllIntercept, "LdrUnloadDll", &patched_LdrUnloadDll);
if (IsWin8OrLater()) { // LdrResolveDelayLoadedAPI was introduced in Win8
stub_LdrResolveDelayLoadedAPI.Set(NtDllIntercept,
"LdrResolveDelayLoadedAPI",
&patched_LdrResolveDelayLoadedAPI);
}
stub_LdrResolveDelayLoadedAPI.Set(NtDllIntercept, "LdrResolveDelayLoadedAPI",
&patched_LdrResolveDelayLoadedAPI);
}
#endif // defined(GP_PLAT_amd64_windows)

View File

@ -10,7 +10,6 @@
#include "mozilla/glue/WindowsUnicode.h"
#include "mozilla/NativeNt.h"
#include "mozilla/WindowsEnumProcessModules.h"
#include "mozilla/WindowsVersion.h"
#include <cctype>
#include <string>
@ -60,29 +59,6 @@ static bool IsModuleUnsafeToLoad(const std::string& aModuleName) {
return std::tolower(aModuleChar) == aDetouredChar;
};
#if defined(_M_AMD64) || defined(_M_IX86)
// Hackaround for Bug 1607574. Nvidia's shim driver nvd3d9wrap[x].dll detours
// LoadLibraryExW and it causes AV when the following conditions are met.
// 1. LoadLibraryExW was called for "detoured.dll"
// 2. nvinit[x].dll was unloaded
// 3. OS version is older than 6.2
# 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
constexpr std::string_view detoured_dll = "detoured.dll";
if (std::equal(aModuleName.cbegin(), aModuleName.cend(),
detoured_dll.cbegin(), detoured_dll.cend(),
LowerCaseEqualsLiteral) &&
!mozilla::IsWin8OrLater() && ::GetModuleHandleW(kNvidiaShimDriver) &&
!::GetModuleHandleW(kNvidiaInitDriver)) {
return true;
}
#endif // defined(_M_AMD64) || defined(_M_IX86)
// Hackaround for Bug 1723868. There is no safe way to prevent the module
// Microsoft's VP9 Video Decoder from being unloaded because mfplat.dll may
// have posted more than one task to unload the module in the work queue

View File

@ -10,30 +10,9 @@
#include "mozilla/NativeNt.h"
#include "mozilla/WindowsEnumProcessModules.h"
#include "mozilla/WindowsProcessMitigations.h"
#include "mozilla/WindowsVersion.h"
#include "nsPrintfCString.h"
static bool IsModuleUnsafeToLoad(const nsAString& aModuleName) {
#if defined(_M_AMD64) || defined(_M_IX86)
// Hackaround for Bug 1607574. Nvidia's shim driver nvd3d9wrap[x].dll detours
// LoadLibraryExW and it causes AV when the following conditions are met.
// 1. LoadLibraryExW was called for "detoured.dll"
// 2. nvinit[x].dll was unloaded
// 3. OS version is older than 6.2
# 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 (aModuleName.LowerCaseEqualsLiteral("detoured.dll") &&
!mozilla::IsWin8OrLater() && ::GetModuleHandleW(kNvidiaShimDriver) &&
!::GetModuleHandleW(kNvidiaInitDriver)) {
return true;
}
#endif // defined(_M_AMD64) || defined(_M_IX86)
// Hackaround for Bug 1723868. There is no safe way to prevent the module
// Microsoft's VP9 Video Decoder from being unloaded because mfplat.dll may
// have posted more than one task to unload the module in the work queue