mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-14 05:08:19 +00:00
linux: place alternate signal stack in stack area
The alternate stack must use the stack area as, e.g., Thread::myself() depends on this property. Hybrid components do not depend on this property and, therefore, use a static stack buffer. Fixes #1935
This commit is contained in:
@ -245,7 +245,7 @@ extern "C" void lx_restore_rt (void);
|
||||
/**
|
||||
* Simplified binding for sigaction system call
|
||||
*/
|
||||
inline int lx_sigaction(int signum, void (*handler)(int))
|
||||
inline int lx_sigaction(int signum, void (*handler)(int), bool altstack)
|
||||
{
|
||||
struct kernel_sigaction act;
|
||||
act.handler = handler;
|
||||
@ -258,12 +258,16 @@ inline int lx_sigaction(int signum, void (*handler)(int))
|
||||
* when leaving the signal handler and it should call the rt_sigreturn syscall.
|
||||
*/
|
||||
enum { SA_RESTORER = 0x04000000 };
|
||||
act.flags = SA_RESTORER | SA_ONSTACK;
|
||||
act.flags = SA_RESTORER;
|
||||
act.restorer = lx_restore_rt;
|
||||
#else
|
||||
act.flags = SA_ONSTACK;
|
||||
act.flags = 0;
|
||||
act.restorer = 0;
|
||||
#endif
|
||||
|
||||
/* use alternate signal stack if requested */
|
||||
act.flags |= altstack ? SA_ONSTACK : 0;
|
||||
|
||||
lx_sigemptyset(&act.mask);
|
||||
|
||||
return lx_syscall(SYS_rt_sigaction, signum, &act, 0UL, _NSIG/8);
|
||||
|
Reference in New Issue
Block a user