summaryrefslogtreecommitdiff
path: root/src/pal/src/exception/signal.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2017-06-16 13:23:34 +0200
committerGitHub <noreply@github.com>2017-06-16 13:23:34 +0200
commitb594d588bc8a7778c30cf0445599ce97cc2edac9 (patch)
tree80eca90a5f4e5484b4fedefb3597148b804c0813 /src/pal/src/exception/signal.cpp
parent23cbc3e9a2d8b0602a8e154b15b2a11ced71c17f (diff)
downloadcoreclr-b594d588bc8a7778c30cf0445599ce97cc2edac9.tar.gz
coreclr-b594d588bc8a7778c30cf0445599ce97cc2edac9.tar.bz2
coreclr-b594d588bc8a7778c30cf0445599ce97cc2edac9.zip
Fix chained hardware exception handling on Unix (#12316)
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 the 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/signal.cpp')
-rw-r--r--src/pal/src/exception/signal.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pal/src/exception/signal.cpp b/src/pal/src/exception/signal.cpp
index b82daca53d..6a046bd00b 100644
--- a/src/pal/src/exception/signal.cpp
+++ b/src/pal/src/exception/signal.cpp
@@ -119,7 +119,7 @@ struct sigaction g_previous_sigquit;
struct sigaction g_previous_activation;
#endif
-// Offset of the local variable containing native context in the common_signal_handler function.
+// Offset of the local variable containing pointer to windows style context in the common_signal_handler function.
// This offset is relative to the frame pointer.
int g_common_signal_handler_context_locvar_offset = 0;
#endif // !HAVE_MACH_EXCEPTIONS
@@ -766,7 +766,7 @@ static bool common_signal_handler(int code, siginfo_t *siginfo, void *sigcontext
native_context_t *ucontext;
ucontext = (native_context_t *)sigcontext;
- g_common_signal_handler_context_locvar_offset = (int)((char*)&ucontext - (char*)__builtin_frame_address(0));
+ g_common_signal_handler_context_locvar_offset = (int)((char*)&contextRecord - (char*)__builtin_frame_address(0));
AllocateExceptionRecords(&exceptionRecord, &contextRecord);