Use a QVarLengthArray for FatalSignalHandler's alternate stack
The stack needs to be at least SIGSTKSZ, which isn't constexpr, so we can't allocate it at compile time. However, we can resize(SIGSTKSZ) a QVarLengthArray that's probably big enough anyway. At the same time, increase the compile-time size to 32k, to match what our Catch2 harness for the self-test uses. Change-Id: I3a34ece73901dd402672cd6fe4da66923f1932c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
2ad5fd36fb
commit
4515c5e4fc
@ -1691,11 +1691,12 @@ public:
|
|||||||
// interfere with normal .bss symbols
|
// interfere with normal .bss symbols
|
||||||
__attribute__((section(".lbss.altstack"), aligned(4096)))
|
__attribute__((section(".lbss.altstack"), aligned(4096)))
|
||||||
# endif
|
# endif
|
||||||
static char alternate_stack[16 * 1024];
|
static QVarLengthArray<char, 32 * 1024> alternateStack;
|
||||||
|
alternateStack.resize(qMax(SIGSTKSZ, alternateStack.size()));
|
||||||
stack_t stack;
|
stack_t stack;
|
||||||
stack.ss_flags = 0;
|
stack.ss_flags = 0;
|
||||||
stack.ss_size = sizeof alternate_stack;
|
stack.ss_size = alternateStack.size();
|
||||||
stack.ss_sp = alternate_stack;
|
stack.ss_sp = alternateStack.data();
|
||||||
sigaltstack(&stack, nullptr);
|
sigaltstack(&stack, nullptr);
|
||||||
act.sa_flags |= SA_ONSTACK;
|
act.sa_flags |= SA_ONSTACK;
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user