Commit 3b7a4cbe authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restorer: Start using sigreturn_restore

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 7e481f89
......@@ -90,6 +90,7 @@ static struct pipe_info *pipes;
static int nr_pipes;
static int restore_task_with_children(int my_pid, char *pstree_path);
static void sigreturn_restore(pid_t pid);
static void show_saved_shmems(void)
{
......@@ -394,7 +395,7 @@ static int prepare_shared(int ps_fd)
break;
if (ret != sizeof(e)) {
perror("Can't read ps");
perror("Can't read pstree_entry");
return 1;
}
......@@ -873,7 +874,7 @@ static int prepare_and_execute_image(int pid)
if (prepare_image_maps(fd_new, pid))
return 1;
sync();
sigreturn_restore(pid);
if (convert_to_elf(elf_path, fd_new))
return 1;
......@@ -1280,7 +1281,7 @@ err_or_found:
return hint;
}
static void restorer_test(pid_t pid)
static void sigreturn_restore(pid_t pid)
{
long code_len, vma_len, args_offset, new_sp, hint;
void *args_rip, *exec_mem, *exec_start;
......@@ -1373,7 +1374,7 @@ static void restorer_test(pid_t pid)
strcpy(args->self_vmas_path, path);
snprintf(path, sizeof(path), "core-%d.img", pid);
snprintf(path, sizeof(path), "core-%d.img.out", pid);
strcpy(args->core_path, path);
pr_info("vma_len: %li code_len: %li exec_mem: %p exec_start: %p new_sp: %p args: %p\n",
......@@ -1407,7 +1408,9 @@ err:
int cr_restore_tasks(pid_t pid, struct cr_options *opts)
{
restorer_test(pid);
#if 0
sigreturn_restore(pid);
#endif
if (opts->leader_only)
return restore_one_task(pid);
......
......@@ -217,8 +217,10 @@ self_len_end:
if (!(vma_entry.status & VMA_AREA_REGULAR))
continue;
#if 0
vma_entry.fd = -1UL; /* for a while */
vma_entry.pgoff = 0;
#endif
/*
* Should map memory here. Note we map them as
......@@ -228,16 +230,18 @@ self_len_end:
va = sys_mmap((void *)vma_entry.start,
vma_entry.end - vma_entry.start,
vma_entry.prot | PROT_WRITE,
(vma_entry.flags |
MAP_ANONYMOUS |
MAP_FIXED |
MAP_PRIVATE) & ~MAP_SHARED,
vma_entry.flags | MAP_FIXED,
vma_entry.fd,
vma_entry.pgoff);
if (va != vma_entry.start) {
write_hex_n(__LINE__);
write_hex_n(vma_entry.start);
write_hex_n(vma_entry.end);
write_hex_n(vma_entry.prot);
write_hex_n(vma_entry.flags);
write_hex_n(vma_entry.fd);
write_hex_n(vma_entry.pgoff);
write_hex_n(va);
goto core_restore_end;
}
......
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