Let QtTest use an alternate stack for its signal handlers
Otherwise, the handler can't be called for a stack overflow. Change-Id: I5d1e6f7607404caa96e4ffff13e7fabd66011785 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
This commit is contained in:
parent
1d9a6d0859
commit
7c8b3699bf
@ -2439,7 +2439,7 @@ FatalSignalHandler::FatalSignalHandler()
|
|||||||
sigemptyset(&handledSignals);
|
sigemptyset(&handledSignals);
|
||||||
|
|
||||||
const int fatalSignals[] = {
|
const int fatalSignals[] = {
|
||||||
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGFPE, SIGSEGV, SIGPIPE, SIGTERM, 0 };
|
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGBUS, SIGFPE, SIGSEGV, SIGPIPE, SIGTERM, 0 };
|
||||||
|
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
memset(&act, 0, sizeof(act));
|
memset(&act, 0, sizeof(act));
|
||||||
@ -2449,6 +2449,19 @@ FatalSignalHandler::FatalSignalHandler()
|
|||||||
#if !defined(Q_OS_INTEGRITY)
|
#if !defined(Q_OS_INTEGRITY)
|
||||||
act.sa_flags = SA_RESETHAND;
|
act.sa_flags = SA_RESETHAND;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SA_ONSTACK
|
||||||
|
// Let the signal handlers use an alternate stack
|
||||||
|
// This is necessary if SIGSEGV is to catch a stack overflow
|
||||||
|
static char alternate_stack[SIGSTKSZ];
|
||||||
|
stack_t stack;
|
||||||
|
stack.ss_flags = 0;
|
||||||
|
stack.ss_size = sizeof alternate_stack;
|
||||||
|
stack.ss_sp = alternate_stack;
|
||||||
|
sigaltstack(&stack, 0);
|
||||||
|
act.sa_flags |= SA_ONSTACK;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Block all fatal signals in our signal handler so we don't try to close
|
// Block all fatal signals in our signal handler so we don't try to close
|
||||||
// the testlog twice.
|
// the testlog twice.
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
|
Loading…
Reference in New Issue
Block a user