зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1508416: Check TLS initialization before reading sAlreadyHandlingTrap. r=luke
--HG-- extra : rebase_source : e8d9c35323a54540b57ef4efed2fe05548e07260
This commit is contained in:
Родитель
d6372b1489
Коммит
ca5f5855d3
|
@ -27,6 +27,7 @@
|
|||
#include "wasm/WasmInstance.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# include <winternl.h> // must include before util/Windows.h's `#undef`s
|
||||
# include "util/Windows.h"
|
||||
#elif defined(XP_DARWIN)
|
||||
# include <mach/exc.h>
|
||||
|
@ -490,10 +491,18 @@ HandleTrap(CONTEXT* context, JSContext* assertCx = nullptr)
|
|||
// =============================================================================
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// Obtained empirically from thread_local codegen on x86/x64/arm64.
|
||||
// Compiled in all user binaries, so should be stable over time.
|
||||
static const unsigned sThreadLocalArrayPointerIndex = 11;
|
||||
|
||||
static LONG WINAPI
|
||||
WasmTrapHandler(LPEXCEPTION_POINTERS exception)
|
||||
{
|
||||
// Make sure TLS is initialized before reading sAlreadyHandlingTrap.
|
||||
if (!NtCurrentTeb()->Reserved1[sThreadLocalArrayPointerIndex]) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
if (sAlreadyHandlingTrap.get()) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче