[CRIU] [PATCH 3/4] restorer: Do restore futex robust lists

Cyrill Gorcunov gorcunov at openvz.org
Thu Aug 9 12:29:39 EDT 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c       |    5 +++++
 include/restorer.h |    6 ++++++
 restorer.c         |   14 ++++++++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index ba49f6b..fdd9fc1 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1318,6 +1318,9 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
 	task_args->gpregs		= *core->thread_info->gpregs;
 	task_args->blk_sigset		= core->tc->blk_sigset;
 
+	task_args->futex_rla		= core->thread_info->futex_rla;
+	task_args->futex_rla_len	= core->thread_info->futex_rla_len;
+
 	/* No longer need it */
 	core_entry__free_unpacked(core, NULL);
 
@@ -1378,6 +1381,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
 		thread_args[i].rst_lock		= &task_args->rst_lock;
 		thread_args[i].gpregs		= *core->thread_info->gpregs;
 		thread_args[i].clear_tid_addr	= core->thread_info->clear_tid_addr;
+		thread_args[i].futex_rla	= core->thread_info->futex_rla;
+		thread_args[i].futex_rla_len	= core->thread_info->futex_rla_len;
 
 		core_entry__free_unpacked(core, NULL);
 
diff --git a/include/restorer.h b/include/restorer.h
index 1cf2970..bd3517b 100644
--- a/include/restorer.h
+++ b/include/restorer.h
@@ -64,6 +64,9 @@ struct thread_restore_args {
 	mutex_t				*rst_lock;
 	UserX86RegsEntry		gpregs;
 	u64				clear_tid_addr;
+
+	u64				futex_rla;
+	u32				futex_rla_len;
 } __aligned(sizeof(long));
 
 struct task_restore_core_args {
@@ -101,6 +104,9 @@ struct task_restore_core_args {
 	char				comm[TASK_COMM_LEN];
 	TaskKobjIdsEntry		ids;
 	UserX86RegsEntry		gpregs;
+
+	u64				futex_rla;
+	u32				futex_rla_len;
 } __aligned(sizeof(long));
 
 struct pt_regs {
diff --git a/restorer.c b/restorer.c
index 95a7922..7973409 100644
--- a/restorer.c
+++ b/restorer.c
@@ -144,6 +144,13 @@ long __export_restore_thread(struct thread_restore_args *args)
 
 	sys_set_tid_address((int *)args->clear_tid_addr);
 
+	if (sys_set_robust_list((void *)args->futex_rla, args->futex_rla_len)) {
+		write_num_n(__LINE__);
+		write_num_n(my_pid);
+		write_num_n(args->pid);
+		goto core_restore_end;
+	}
+
 	rt_sigframe = (void *)args->mem_zone.rt_sigframe + 8;
 
 #define CPREGT1(d)	rt_sigframe->uc.uc_mcontext.d = args->gpregs.d
@@ -432,6 +439,13 @@ long __export_restore_task(struct task_restore_core_args *args)
 	if (ret)
 		goto core_restore_end;
 
+	if (sys_set_robust_list((void *)args->futex_rla, args->futex_rla_len)) {
+		write_num_n(__LINE__);
+		write_num_n(my_pid);
+		write_num_n(args->pid);
+		goto core_restore_end;
+	}
+
 	/*
 	 * We need to prepare a valid sigframe here, so
 	 * after sigreturn the kernel will pick up the
-- 
1.7.7.6



More information about the CRIU mailing list