QtTest: Increase the size of the alternate stack

The default (8kB) isn't enough for modern Linux on x86-64. I can't
exactly account for it, as the size of the xsave area is 0x340 bytes,
plus the regular area it's still less than ~1.5 kB. But empirically we
can see that 8kB causes a SIGSEGV when a signal is delivered, while 16
kB works.

Since we're increasing the size, let's make sure it ends up in a
separate page from the rest of the .bss data.

Change-Id: I5d1e6f7607404caa96e4ffff13e84c87c33723c7
Reviewed-by: Jason McDonald <macadder1@gmail.com>
This commit is contained in:
Thiago Macieira 2015-06-15 10:51:37 -07:00
parent 706af26acc
commit 741a7aef58

View File

@ -2453,7 +2453,12 @@ FatalSignalHandler::FatalSignalHandler()
#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];
# if defined(Q_CC_GNU) && defined(Q_OF_ELF)
// Put the alternate stack in the .lbss (large BSS) section so that it doesn't
// interfere with normal .bss symbols
__attribute__((section(".lbss.altstack"), aligned(4096)))
# endif
static char alternate_stack[16 * 1024];
stack_t stack;
stack.ss_flags = 0;
stack.ss_size = sizeof alternate_stack;