Bug 1354611: Acquire the stack walk lock in Win64's LdrLoadDll. r=aklotz

This will prevent the profiler from suspending a target thread while that thread holds the RtlLookupFunctionEntry lock, which the profiler itself also wants to use.
This commit is contained in:
David Major 2017-04-20 15:09:11 -04:00
Родитель c4a6792abb
Коммит 3b7255411e
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -27,6 +27,7 @@
#include "nsWindowsDllInterceptor.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StackWalk_windows.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WindowsVersion.h"
#include "nsWindowsHelpers.h"
@ -703,7 +704,13 @@ continue_loading:
printf_stderr("LdrLoadDll: continuing load... ('%S')\n", moduleFileName->Buffer);
#endif
return stub_LdrLoadDll(filePath, flags, moduleFileName, handle);
// Prevent the stack walker from suspending this thread when LdrLoadDll
// holds the RtlLookupFunctionEntry lock.
AcquireStackWalkWorkaroundLock();
NTSTATUS ret = stub_LdrLoadDll(filePath, flags, moduleFileName, handle);
ReleaseStackWalkWorkaroundLock();
return ret;
}
WindowsDllInterceptor NtDllIntercept;