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: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2016-05-11 18:29:00 +03:00 committed by Pavel Emelyanov
parent f0bec2135b
commit 4912da57fb

View file

@ -64,7 +64,7 @@ void thread_sigaction(int signo, siginfo_t *info, void *context)
static void *thread_func(void *arg)
{
sas_state[SAS_THRD_OLD] = (stack_t) {
.ss_size = SIGSTKSZ,
.ss_size = sizeof(stack_thread) - 8,
.ss_sp = stack_thread,
.ss_flags = SS_ONSTACK,
};
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
pthread_t thread;
sas_state[SAS_MAIN_OLD] = (stack_t) {
.ss_size = SIGSTKSZ,
.ss_size = sizeof(stack_main) - 8,
.ss_sp = stack_main,
.ss_flags = SS_ONSTACK,
};