[CRIU] [PATCH] test: sigaltstack -- Setup proper stack size

Cyrill Gorcunov gorcunov at openvz.org
Wed May 11 08:29:27 PDT 2016


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 at virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 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 be5ddf79272e..5f0428d7855e 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,
 	};
-- 
2.5.5



More information about the CRIU mailing list