[CRIU] [PATCH urgent] restorer: Fix bug in address computation of thread args area

Cyrill Gorcunov gorcunov at openvz.org
Wed Mar 28 13:38:42 EDT 2012


It's bloody wrong to treat thread_args as arguments
area (I managed to overlook this problem in commit
014841825acb14a1d695569b9fe3575f5de6442b).

Because when we restore threads this bug overwrites
a couple of function prologue bytes it passed unnoticed,
but in case of bunch of threads this might lead into
unpredicted results.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
CC: Andrey Vagin <avagin at openvz.org>
---
 cr-restore.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index cf32cdb..4f38c7f 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1601,10 +1601,10 @@ static int sigreturn_restore(pid_t pid, struct list_head *tgt_vmas, int nr_vmas)
 	restore_thread_exec_start	= restore_code_start + restorer_blob_offset__restore_thread;
 	restore_task_exec_start		= restore_code_start + restorer_blob_offset__restore_task;
 	task_args			= restore_code_start + restore_code_len;
-	thread_args			= restore_thread_exec_start;
+	thread_args			= (void *)((long)task_args + sizeof(*task_args));
 
 	memzero_p(task_args);
-	memzero_p(thread_args);
+	memzero(thread_args, sizeof(*thread_args) * me->nr_threads);
 
 	/*
 	 * Code at a new place.
-- 
1.7.7.6



More information about the CRIU mailing list