Commit bc6a4db6 authored by Victor Stinner's avatar Victor Stinner

Issue #11393: fault handler uses raise(signum) for SIGILL on Windows

parent 7098685b
...@@ -270,14 +270,16 @@ faulthandler_fatal_error( ...@@ -270,14 +270,16 @@ faulthandler_fatal_error(
else else
_Py_DumpTraceback(fd, tstate); _Py_DumpTraceback(fd, tstate);
#ifndef MS_WINDOWS #ifdef MS_WINDOWS
/* call the previous signal handler: it is called if we use sigaction() if (signum == SIGSEGV) {
thanks to SA_NODEFER flag, otherwise it is deferred */ /* don't call explictly the previous handler for SIGSEGV in this signal
raise(signum); handler, because the Windows signal handler would not be called */
#else return;
/* on Windows, don't call explictly the previous handler, because Windows }
signal handler would not be called */
#endif #endif
/* call the previous signal handler: it is called immediatly if we use
sigaction() thanks to SA_NODEFER flag, otherwise it is deferred */
raise(signum);
} }
/* Install handler for fatal signals (SIGSEGV, SIGFPE, ...). */ /* Install handler for fatal signals (SIGSEGV, SIGFPE, ...). */
...@@ -681,8 +683,9 @@ static PyObject * ...@@ -681,8 +683,9 @@ static PyObject *
faulthandler_sigsegv(PyObject *self, PyObject *args) faulthandler_sigsegv(PyObject *self, PyObject *args)
{ {
#if defined(MS_WINDOWS) #if defined(MS_WINDOWS)
/* faulthandler_fatal_error() restores the previous signal handler and then /* For SIGSEGV, faulthandler_fatal_error() restores the previous signal
gives back the execution flow to the program. In a normal case, the handler and then gives back the execution flow to the program (without
calling explicitly the previous error handler). In a normal case, the
SIGSEGV was raised by the kernel because of a fault, and so if the SIGSEGV was raised by the kernel because of a fault, and so if the
program retries to execute the same instruction, the fault will be program retries to execute the same instruction, the fault will be
raised again. raised again.
...@@ -724,13 +727,7 @@ faulthandler_sigbus(PyObject *self, PyObject *args) ...@@ -724,13 +727,7 @@ faulthandler_sigbus(PyObject *self, PyObject *args)
static PyObject * static PyObject *
faulthandler_sigill(PyObject *self, PyObject *args) faulthandler_sigill(PyObject *self, PyObject *args)
{ {
#if defined(MS_WINDOWS)
/* see faulthandler_sigsegv() for the explanation about while(1) */
while(1)
raise(SIGILL);
#else
raise(SIGILL); raise(SIGILL);
#endif
Py_RETURN_NONE; Py_RETURN_NONE;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment