Commit 4d962b27 authored by Andrey Vagin's avatar Andrey Vagin Committed by Cyrill Gorcunov

crtools: dump and restore clear_tid_address

pthread_join works with this patch
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent e8c6c877
...@@ -1152,6 +1152,8 @@ static int dump_task_thread(pid_t pid, struct cr_fdset *cr_fdset) ...@@ -1152,6 +1152,8 @@ static int dump_task_thread(pid_t pid, struct cr_fdset *cr_fdset)
ret = get_task_regs(pid, core); ret = get_task_regs(pid, core);
if (ret) if (ret)
goto err_free; goto err_free;
jerr(ptrace(PTRACE_GET_TID_ADDRESS, pid, NULL,
&core->clear_tid_address), err_free);
pr_info("OK\n"); pr_info("OK\n");
core->tc.task_state = TASK_ALIVE; core->tc.task_state = TASK_ALIVE;
......
...@@ -312,6 +312,7 @@ struct core_entry { ...@@ -312,6 +312,7 @@ struct core_entry {
struct image_header header; struct image_header header;
struct task_core_entry tc; struct task_core_entry tc;
struct ckpt_arch_entry arch; struct ckpt_arch_entry arch;
u64 clear_tid_address;
}; };
u8 __core_pad[CKPT_CORE_SIZE]; u8 __core_pad[CKPT_CORE_SIZE];
}; };
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#endif #endif
#define PTRACE_LISTEN 0x4208 #define PTRACE_LISTEN 0x4208
#define PTRACE_GET_TID_ADDRESS 0x4209
#define PTRACE_SEIZE_DEVEL 0x80000000 #define PTRACE_SEIZE_DEVEL 0x80000000
......
...@@ -144,6 +144,8 @@ long restore_thread(struct thread_restore_args *args) ...@@ -144,6 +144,8 @@ long restore_thread(struct thread_restore_args *args)
/* We're to close it! */ /* We're to close it! */
sys_close(args->fd_core); sys_close(args->fd_core);
sys_set_tid_address((int *) core_entry->clear_tid_address);
rt_sigframe = (void *)args->mem_zone.rt_sigframe + 8; rt_sigframe = (void *)args->mem_zone.rt_sigframe + 8;
#define CPREGT1(d) rt_sigframe->uc.uc_mcontext.d = core_entry->arch.gpregs.d #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) ...@@ -427,6 +429,8 @@ long restore_task(struct task_restore_core_args *args)
goto core_restore_end; goto core_restore_end;
} }
sys_set_tid_address((int *) core_entry->clear_tid_address);
/* /*
* Tune up the task fields. * Tune up the task fields.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment