From 4912da57fbdb1ddebcc8c189d384e3f6e8265703 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Wed, 11 May 2016 18:29:00 +0300 Subject: [PATCH] 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 Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- test/zdtm/static/sigaltstack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/zdtm/static/sigaltstack.c b/test/zdtm/static/sigaltstack.c index be5ddf792..5f0428d78 100644 --- a/test/zdtm/static/sigaltstack.c +++ b/test/zdtm/static/sigaltstack.c @@ -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, };