Commit 4912da57 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

test: sigaltstack -- Setup proper stack size

We use test_msg helper inside alternative stack
which in turn allocates TEST_MSG_BUFFER_SIZE
by its own, so we increased the stack storage
in @stack_thread and @stack_main but miss to
inform the kernel about bigger stack size.

Thus in worst scenario we can screwup the stack
so provide proper size here.
Reported-by: 's avatarVasily Averin <vvs@virtuozzo.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f0bec213
...@@ -64,7 +64,7 @@ void thread_sigaction(int signo, siginfo_t *info, void *context) ...@@ -64,7 +64,7 @@ void thread_sigaction(int signo, siginfo_t *info, void *context)
static void *thread_func(void *arg) static void *thread_func(void *arg)
{ {
sas_state[SAS_THRD_OLD] = (stack_t) { sas_state[SAS_THRD_OLD] = (stack_t) {
.ss_size = SIGSTKSZ, .ss_size = sizeof(stack_thread) - 8,
.ss_sp = stack_thread, .ss_sp = stack_thread,
.ss_flags = SS_ONSTACK, .ss_flags = SS_ONSTACK,
}; };
...@@ -106,7 +106,7 @@ int main(int argc, char *argv[]) ...@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
pthread_t thread; pthread_t thread;
sas_state[SAS_MAIN_OLD] = (stack_t) { sas_state[SAS_MAIN_OLD] = (stack_t) {
.ss_size = SIGSTKSZ, .ss_size = sizeof(stack_main) - 8,
.ss_sp = stack_main, .ss_sp = stack_main,
.ss_flags = SS_ONSTACK, .ss_flags = SS_ONSTACK,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment