From 83b286649bd3e984857ffdf73fba1d2a8a59ad00 Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Wed, 26 Jul 2023 08:52:53 +0000 Subject: [PATCH] Bug 1844908 - Remove pre-Win10-specific codepath from Gecko Profiler. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D184305 --- mozglue/baseprofiler/core/platform-win32.cpp | 8 ++----- .../core/shared-libraries-win32.cc | 24 ------------------- tools/profiler/core/shared-libraries-win32.cc | 21 ---------------- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/mozglue/baseprofiler/core/platform-win32.cpp b/mozglue/baseprofiler/core/platform-win32.cpp index 808bd9d618de..4511c4b1bb64 100644 --- a/mozglue/baseprofiler/core/platform-win32.cpp +++ b/mozglue/baseprofiler/core/platform-win32.cpp @@ -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) diff --git a/mozglue/baseprofiler/core/shared-libraries-win32.cc b/mozglue/baseprofiler/core/shared-libraries-win32.cc index eb6ca3572ade..2a453612d3ca 100644 --- a/mozglue/baseprofiler/core/shared-libraries-win32.cc +++ b/mozglue/baseprofiler/core/shared-libraries-win32.cc @@ -10,7 +10,6 @@ #include "mozilla/glue/WindowsUnicode.h" #include "mozilla/NativeNt.h" #include "mozilla/WindowsEnumProcessModules.h" -#include "mozilla/WindowsVersion.h" #include #include @@ -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 diff --git a/tools/profiler/core/shared-libraries-win32.cc b/tools/profiler/core/shared-libraries-win32.cc index cb0bcd1f41aa..1dc0d06836bd 100644 --- a/tools/profiler/core/shared-libraries-win32.cc +++ b/tools/profiler/core/shared-libraries-win32.cc @@ -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