@@ -59,6 +59,7 @@ typedef struct user_pt_regs user_regs_struct_t;
#define REG_SYSCALL_NR(regs) ((u64)(regs).regs[8])
#define user_regs_native(pregs) true
+#define core_is_compat(core) false
/*
* Range for task size calculated from the following Linux kernel files:
@@ -94,6 +94,7 @@ struct user_vfp_exc {
#define REG_SYSCALL_NR(regs) ((regs).ARM_r7)
#define user_regs_native(pregs) true
+#define core_is_compat(core) false
/*
* Range for task size calculated from the following Linux kernel files:
@@ -77,6 +77,7 @@ typedef UserPpc64RegsEntry UserRegsEntry;
#define REG_SYSCALL_NR(regs) ((u64)(regs).gpr[0])
#define user_regs_native(pregs) true
+#define core_is_compat(core) false
#define CORE_THREAD_ARCH_INFO(core) core->ti_ppc64
@@ -108,6 +108,7 @@
#ifndef arch_export_unmap
#define arch_export_unmap __export_unmap
+#define arch_export_unmap_compat __export_unmap_compat
#endif
struct pstree_item *current;
@@ -2820,7 +2821,12 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
*/
task_args->clone_restore_fn = restorer_sym(mem, arch_export_restore_thread);
restore_task_exec_start = restorer_sym(mem, arch_export_restore_task);
- rsti(current)->munmap_restorer = restorer_sym(mem, arch_export_unmap);
+ if (core_is_compat(core))
+ rsti(current)->munmap_restorer =
+ restorer_sym(mem, arch_export_unmap_compat);
+ else
+ rsti(current)->munmap_restorer =
+ restorer_sym(mem, arch_export_unmap);
task_args->bootstrap_start = mem;
mem += restorer_len;
@@ -940,8 +940,6 @@ static void restore_posix_timers(struct task_restore_args *args)
sys_timer_settime((kernel_timer_t)rt->spt.it_id, 0, &rt->val, NULL);
}
}
-static void *bootstrap_start;
-static unsigned int bootstrap_len;
/*
* sys_munmap must not return here. The controll process must
@@ -953,11 +951,34 @@ static unsigned long vdso_rt_size;
#define vdso_rt_size (0)
#endif
+static void *bootstrap_start;
+static unsigned int bootstrap_len;
+
void __export_unmap(void)
{
sys_munmap(bootstrap_start, bootstrap_len - vdso_rt_size);
}
+#ifdef CONFIG_X86_64
+asm (
+ " .pushsection .text\n"
+ " .global __export_unmap_compat\n"
+ "__export_unmap_compat:\n"
+ " .code32\n"
+ " mov bootstrap_start, %ebx\n"
+ " mov bootstrap_len, %ecx\n"
+ " movl $"__stringify(__NR32_munmap)", %eax\n"
+ " int $0x80\n"
+ " .code64\n"
+ " .popsection\n"
+);
+extern char __export_unmap_compat;
+#else
+void __export_unmap_compat(void)
+{
+}
+#endif
+
/*
* This function unmaps all VMAs, which don't belong to
* the restored process or the restorer.
We need to do it in pure ia32 asm. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com> --- criu/arch/aarch64/include/asm/types.h | 1 + criu/arch/arm/include/asm/types.h | 1 + criu/arch/ppc64/include/asm/types.h | 1 + criu/cr-restore.c | 8 +++++++- criu/pie/restorer.c | 25 +++++++++++++++++++++++-- 5 files changed, 33 insertions(+), 3 deletions(-)