Commit 2652962b authored by Pavel Emelyanov's avatar Pavel Emelyanov

rst: Unmap restorer dyn-args memory at the end

Reported-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 79dfbe6c
...@@ -1432,7 +1432,7 @@ static void *rst_mem_alloc(unsigned long size) ...@@ -1432,7 +1432,7 @@ static void *rst_mem_alloc(unsigned long size)
return aux; return aux;
} }
static int rst_mem_remap(void *to) static int rst_mem_remap(struct task_restore_core_args *ta, void *to)
{ {
if (!rst_mem_len) if (!rst_mem_len)
return 0; return 0;
...@@ -1446,6 +1446,8 @@ static int rst_mem_remap(void *to) ...@@ -1446,6 +1446,8 @@ static int rst_mem_remap(void *to)
} }
rst_mem_r = to; rst_mem_r = to;
ta->rst_mem = to;
ta->rst_mem_size = rst_mem_len;
return 0; return 0;
} }
...@@ -2181,7 +2183,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core) ...@@ -2181,7 +2183,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
goto err; goto err;
mem += vmas_len; mem += vmas_len;
if (rst_mem_remap(mem)) if (rst_mem_remap(task_args, mem))
goto err; goto err;
task_args->timer_n = posix_timers_nr; task_args->timer_n = posix_timers_nr;
......
...@@ -117,6 +117,8 @@ struct task_restore_core_args { ...@@ -117,6 +117,8 @@ struct task_restore_core_args {
struct thread_restore_args *thread_args; /* array of thread arguments */ struct thread_restore_args *thread_args; /* array of thread arguments */
struct shmems *shmems; struct shmems *shmems;
struct task_entries *task_entries; struct task_entries *task_entries;
void *rst_mem;
unsigned long rst_mem_size;
VmaEntry *self_vmas; VmaEntry *self_vmas;
VmaEntry *tgt_vmas; VmaEntry *tgt_vmas;
siginfo_t *siginfo; siginfo_t *siginfo;
......
...@@ -926,6 +926,8 @@ long __export_restore_task(struct task_restore_core_args *args) ...@@ -926,6 +926,8 @@ long __export_restore_task(struct task_restore_core_args *args)
goto core_restore_failed; goto core_restore_failed;
} }
sys_munmap(args->rst_mem, args->rst_mem_size);
/* /*
* Sigframe stack. * Sigframe stack.
*/ */
......
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