Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergiy Kuryata <sergeyk@microsoft.com>2017-07-14 22:24:00 +0300
committerGitHub <noreply@github.com>2017-07-14 22:24:00 +0300
commitecd479499b6f4cf50f419bc6f355eb20445e6622 (patch)
treef0f46fb280a84dde93b27576324ac5fe5b2687ea /src/Native/Runtime/windows
parent180830f17230196c5d9a99963f2f1374aa54a03e (diff)
Fix usage of GetThreadContext on ARM64 (#4160)
Diffstat (limited to 'src/Native/Runtime/windows')
-rw-r--r--src/Native/Runtime/windows/PalRedhawkMinWin.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Native/Runtime/windows/PalRedhawkMinWin.cpp b/src/Native/Runtime/windows/PalRedhawkMinWin.cpp
index 8255695ac..80351f820 100644
--- a/src/Native/Runtime/windows/PalRedhawkMinWin.cpp
+++ b/src/Native/Runtime/windows/PalRedhawkMinWin.cpp
@@ -291,7 +291,11 @@ REDHAWK_PALEXPORT _Success_(return) bool REDHAWK_PALAPI PalGetThreadContext(HAND
// at a point where the kernel cannot guarantee a completely accurate context. We'll fail the request in
// this case (which should force our caller to resume the thread and try again -- since this is a fairly
// narrow window we're highly likely to succeed next time).
- if ((win32ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) &&
+ // Note: in some cases (x86 WOW64, ARM32 on ARM64) the OS will not set the CONTEXT_EXCEPTION_REPORTING flag
+ // if the thread is executing in kernel mode (i.e. in the middle of a syscall or exception handling).
+ // Therefore, we should treat the absence of the CONTEXT_EXCEPTION_REPORTING flag as an indication that
+ // it is not safe to manipulate with the current state of the thread context.
+ if ((win32ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) == 0 ||
(win32ctx.ContextFlags & (CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE)))
return false;