[CRIU] [crtools-bot] crtools: dump and restore clear_tid_address
Cyrill Gorcunov
gorcunov at openvz.org
Fri Feb 3 08:28:04 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
--------------->
commit 4d962b27c0e2d631e1ae8729d33f5e5b2de032d5
Author: Andrey Vagin <avagin at openvz.org>
Date: Thu Feb 2 13:15:00 2012 +0300
crtools: dump and restore clear_tid_address
pthread_join works with this patch
Signed-off-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-dump.c | 2 ++
include/image.h | 1 +
include/ptrace.h | 1 +
restorer.c | 4 ++++
4 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index b326c3f..f5e568d 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1152,6 +1152,8 @@ static int dump_task_thread(pid_t pid, struct cr_fdset *cr_fdset)
ret = get_task_regs(pid, core);
if (ret)
goto err_free;
+ jerr(ptrace(PTRACE_GET_TID_ADDRESS, pid, NULL,
+ &core->clear_tid_address), err_free);
pr_info("OK\n");
core->tc.task_state = TASK_ALIVE;
diff --git a/include/image.h b/include/image.h
index 8e6a000..58b13fc 100644
--- a/include/image.h
+++ b/include/image.h
@@ -312,6 +312,7 @@ struct core_entry {
struct image_header header;
struct task_core_entry tc;
struct ckpt_arch_entry arch;
+ u64 clear_tid_address;
};
u8 __core_pad[CKPT_CORE_SIZE];
};
diff --git a/include/ptrace.h b/include/ptrace.h
index 300cedd..57e63f0 100644
--- a/include/ptrace.h
+++ b/include/ptrace.h
@@ -13,6 +13,7 @@
#endif
#define PTRACE_LISTEN 0x4208
+#define PTRACE_GET_TID_ADDRESS 0x4209
#define PTRACE_SEIZE_DEVEL 0x80000000
diff --git a/restorer.c b/restorer.c
index f6f2caa..e450de4 100644
--- a/restorer.c
+++ b/restorer.c
@@ -144,6 +144,8 @@ long restore_thread(struct thread_restore_args *args)
/* We're to close it! */
sys_close(args->fd_core);
+ sys_set_tid_address((int *) core_entry->clear_tid_address);
+
rt_sigframe = (void *)args->mem_zone.rt_sigframe + 8;
#define CPREGT1(d) rt_sigframe->uc.uc_mcontext.d = core_entry->arch.gpregs.d
@@ -427,6 +429,8 @@ long restore_task(struct task_restore_core_args *args)
goto core_restore_end;
}
+ sys_set_tid_address((int *) core_entry->clear_tid_address);
+
/*
* Tune up the task fields.
*/
More information about the CRIU
mailing list