Commit 57032aff authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

restorer: Do restore futex robust lists

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 097d73a1
...@@ -1339,6 +1339,12 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v ...@@ -1339,6 +1339,12 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
task_args->gpregs = *core->thread_info->gpregs; task_args->gpregs = *core->thread_info->gpregs;
task_args->blk_sigset = core->tc->blk_sigset; task_args->blk_sigset = core->tc->blk_sigset;
if (core->thread_core) {
task_args->has_futex = true;
task_args->futex_rla = core->thread_core->futex_rla;
task_args->futex_rla_len = core->thread_core->futex_rla_len;
}
/* No longer need it */ /* No longer need it */
core_entry__free_unpacked(core, NULL); core_entry__free_unpacked(core, NULL);
...@@ -1400,6 +1406,12 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v ...@@ -1400,6 +1406,12 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
thread_args[i].gpregs = *core->thread_info->gpregs; thread_args[i].gpregs = *core->thread_info->gpregs;
thread_args[i].clear_tid_addr = core->thread_info->clear_tid_addr; thread_args[i].clear_tid_addr = core->thread_info->clear_tid_addr;
if (core->thread_core) {
thread_args[i].has_futex = true;
thread_args[i].futex_rla = core->thread_core->futex_rla;
thread_args[i].futex_rla_len = core->thread_core->futex_rla_len;
}
core_entry__free_unpacked(core, NULL); core_entry__free_unpacked(core, NULL);
pr_info("Thread %4d stack %8p heap %8p rt_sigframe %8p\n", pr_info("Thread %4d stack %8p heap %8p rt_sigframe %8p\n",
......
...@@ -64,6 +64,10 @@ struct thread_restore_args { ...@@ -64,6 +64,10 @@ struct thread_restore_args {
mutex_t *rst_lock; mutex_t *rst_lock;
UserX86RegsEntry gpregs; UserX86RegsEntry gpregs;
u64 clear_tid_addr; u64 clear_tid_addr;
bool has_futex;
u64 futex_rla;
u32 futex_rla_len;
} __aligned(sizeof(long)); } __aligned(sizeof(long));
struct task_restore_core_args { struct task_restore_core_args {
...@@ -101,6 +105,10 @@ struct task_restore_core_args { ...@@ -101,6 +105,10 @@ struct task_restore_core_args {
char comm[TASK_COMM_LEN]; char comm[TASK_COMM_LEN];
TaskKobjIdsEntry ids; TaskKobjIdsEntry ids;
UserX86RegsEntry gpregs; UserX86RegsEntry gpregs;
bool has_futex;
u64 futex_rla;
u32 futex_rla_len;
} __aligned(sizeof(long)); } __aligned(sizeof(long));
struct pt_regs { struct pt_regs {
......
...@@ -144,6 +144,15 @@ long __export_restore_thread(struct thread_restore_args *args) ...@@ -144,6 +144,15 @@ long __export_restore_thread(struct thread_restore_args *args)
sys_set_tid_address((int *)args->clear_tid_addr); sys_set_tid_address((int *)args->clear_tid_addr);
if (args->has_futex) {
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; rt_sigframe = (void *)args->mem_zone.rt_sigframe + 8;
#define CPREGT1(d) rt_sigframe->uc.uc_mcontext.d = args->gpregs.d #define CPREGT1(d) rt_sigframe->uc.uc_mcontext.d = args->gpregs.d
...@@ -432,6 +441,15 @@ long __export_restore_task(struct task_restore_core_args *args) ...@@ -432,6 +441,15 @@ long __export_restore_task(struct task_restore_core_args *args)
if (ret) if (ret)
goto core_restore_end; goto core_restore_end;
if (args->has_futex) {
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 * We need to prepare a valid sigframe here, so
* after sigreturn the kernel will pick up the * after sigreturn the kernel will pick up the
......
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