Commit 64d39a20 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

restorer: unmapping native blob in compat task

We need to do it in pure ia32 asm.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c7c63a3e
......@@ -10,7 +10,6 @@
#include "bitops.h"
#include "asm/int.h"
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
......@@ -35,6 +34,8 @@ typedef struct {
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#define core_is_compat(core) false
typedef UserAarch64RegsEntry UserRegsEntry;
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__AARCH64
......
......@@ -33,6 +33,8 @@ typedef struct {
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#define core_is_compat(core) false
typedef UserArmRegsEntry UserRegsEntry;
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__ARM
......
......@@ -37,11 +37,12 @@ typedef struct {
k_rtsigset_t rt_sa_mask; /* mask last for extensibility */
} rt_sigaction_t;
#define core_is_compat(core) false
typedef UserPpc64RegsEntry UserRegsEntry;
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__PPC64
#define CORE_THREAD_ARCH_INFO(core) core->ti_ppc64
static inline void *decode_pointer(uint64_t v) { return (void*)v; }
......
......@@ -105,6 +105,7 @@
#ifndef arch_export_unmap
#define arch_export_unmap __export_unmap
#define arch_export_unmap_compat __export_unmap_compat
#endif
struct pstree_item *current;
......@@ -2867,7 +2868,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;
......
......@@ -885,8 +885,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 control process must
......@@ -898,11 +896,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.
......
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