Commit 315008f9 authored by Pavel Emelyanov's avatar Pavel Emelyanov

restore: Cleanup ptrs remapping code done so far

After all arrays remapping is reworked, the remap_array() can
be dropped from code and in-place ptr fixup helper can appear.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 02853f0a
...@@ -2820,23 +2820,16 @@ static int sigreturn_restore(pid_t pid, unsigned long ta_cp, CoreEntry *core) ...@@ -2820,23 +2820,16 @@ static int sigreturn_restore(pid_t pid, unsigned long ta_cp, CoreEntry *core)
task_args->task_size = kdat.task_size; task_args->task_size = kdat.task_size;
task_args->vmas = rst_mem_remap_ptr((unsigned long)task_args->vmas, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->vmas);
task_args->rings = rst_mem_remap_ptr((unsigned long)task_args->rings, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->rings);
task_args->tcp_socks = rst_mem_remap_ptr((unsigned long)task_args->tcp_socks, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->tcp_socks);
task_args->timerfd = rst_mem_remap_ptr((unsigned long)task_args->timerfd, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->timerfd);
task_args->posix_timers = rst_mem_remap_ptr((unsigned long)task_args->posix_timers, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->posix_timers);
task_args->siginfo = rst_mem_remap_ptr((unsigned long)task_args->siginfo, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->siginfo);
task_args->rlims = rst_mem_remap_ptr((unsigned long)task_args->rlims, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->rlims);
task_args->helpers = rst_mem_remap_ptr((unsigned long)task_args->helpers, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->helpers);
task_args->zombies = rst_mem_remap_ptr((unsigned long)task_args->zombies, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->zombies);
task_args->seccomp_filters = rst_mem_remap_ptr((unsigned long)task_args->seccomp_filters, RM_PRIVATE); RST_MEM_FIXUP_PPTR(task_args->seccomp_filters);
#define remap_array(name, nr, cpos) do { \
task_args->name##_n = nr; \
task_args->name = rst_mem_remap_ptr(cpos, RM_PRIVATE); \
} while (0)
#undef remap_array
if (core->tc->has_seccomp_mode) if (core->tc->has_seccomp_mode)
task_args->seccomp_mode = core->tc->seccomp_mode; task_args->seccomp_mode = core->tc->seccomp_mode;
......
...@@ -52,6 +52,10 @@ extern void rst_mem_switch_to_private(void); ...@@ -52,6 +52,10 @@ extern void rst_mem_switch_to_private(void);
*/ */
extern unsigned long rst_mem_align_cpos(int type); extern unsigned long rst_mem_align_cpos(int type);
extern void *rst_mem_remap_ptr(unsigned long pos, int type); extern void *rst_mem_remap_ptr(unsigned long pos, int type);
#define RST_MEM_FIXUP_PPTR(ptr) do { \
ptr = rst_mem_remap_ptr((unsigned long)ptr, RM_PRIVATE);\
} while (0)
/* /*
* Allocate and free objects. We don't need to free arbitrary * Allocate and free objects. We don't need to free arbitrary
* object, thus allocation is simple (linear) and only the * object, thus allocation is simple (linear) and only 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