summaryrefslogtreecommitdiff
path: root/src/pal/src/exception/seh-unwind.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2017-06-17 14:13:39 +0200
committerGitHub <noreply@github.com>2017-06-17 14:13:39 +0200
commita02634eb41284dbd432ef84aa38f526f955e5f64 (patch)
tree3b688a97e457dc7ee3bc9f507d9a6c8f693384d6 /src/pal/src/exception/seh-unwind.cpp
parenta6ed71c6472c8ea0f680507ae34f56aeaf6bb3d2 (diff)
downloadcoreclr-a02634eb41284dbd432ef84aa38f526f955e5f64.tar.gz
coreclr-a02634eb41284dbd432ef84aa38f526f955e5f64.tar.bz2
coreclr-a02634eb41284dbd432ef84aa38f526f955e5f64.zip
Fix chained hardware exception handling on Unix (#12344)
There is an issue when hardware exception occurs while handling another hardware exception. In such case, the exception unwinding ends up in an infinite loop. It is caused by the kernel reusing the same location for signal handler context. The fix is to use a windows style context local variable in the common_signal_handler that contains the right context - it is the original signal context converted to windows style context.
Diffstat (limited to 'src/pal/src/exception/seh-unwind.cpp')
-rw-r--r--src/pal/src/exception/seh-unwind.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 360ea3e987..f1f25b01e8 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -266,8 +266,8 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
// cannot cross on some systems.
if ((void*)curPc == g_SEHProcessExceptionReturnAddress)
{
- CONTEXT* nativeContext = *(CONTEXT**)(CONTEXTGetFP(context) + g_common_signal_handler_context_locvar_offset);
- memcpy_s(context, sizeof(CONTEXT), nativeContext, sizeof(CONTEXT));
+ CONTEXT* signalContext = (CONTEXT*)(CONTEXTGetFP(context) + g_common_signal_handler_context_locvar_offset);
+ memcpy_s(context, sizeof(CONTEXT), signalContext, sizeof(CONTEXT));
return TRUE;
}