mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
linux: print warning for unusually small stacks
Thread stacks with less than 4K usable space are insufficient for our implementation of Linux exception signal handling. If such a unusually small stack overflows the SIGSEGV handler will not be able to print the diagnostic message leaving no hint of the cause of the stuck process.
This commit is contained in:
parent
887b6233b1
commit
f14024eb52
@ -17,6 +17,7 @@
|
||||
#include <base/thread.h>
|
||||
#include <base/snprintf.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/log.h>
|
||||
#include <linux_native_cpu/client.h>
|
||||
#include <cpu_thread/client.h>
|
||||
|
||||
@ -55,6 +56,9 @@ void Thread::_thread_start()
|
||||
size_t stack_size = thread->_stack->top() - thread->_stack->base();
|
||||
|
||||
lx_sigaltstack(stack_base, stack_size);
|
||||
if (stack_size < 0x1000)
|
||||
raw("small stack of ", stack_size, " bytes for \"", thread->name(),
|
||||
"\" may may break Linux signal handling");
|
||||
|
||||
/*
|
||||
* Set signal handler such that canceled system calls get not
|
||||
|
Loading…
Reference in New Issue
Block a user