2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 23:05:39 +00:00

ia32/restorer: move 32-bit pie unmap to x86

We need compat realization for restorer unmap as after rt_sigreturn()
the task is stopped it 32-bit code and ptrace API doesn't allow
setting x86_64 full registers set to ia32 task.

Generic restorer has now x86-specific __export_unmap_compat()
function, which isn't right.

Clean restorer from x86-related realization.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Dmitry Safonov
2017-04-28 21:30:47 +03:00
committed by Andrei Vagin
parent dd3f23e28d
commit 8544895a52
3 changed files with 15 additions and 23 deletions

View File

@@ -0,0 +1,12 @@
#include "common/asm/linkage.h"
#include "compel/plugins/std/syscall-codes.h"
.text
ENTRY(__export_unmap_compat)
.code32
mov bootstrap_start, %ebx
mov bootstrap_len, %ecx
movl $__NR32_munmap, %eax
int $0x80
int $0x03 /* Guard */
.code64

View File

@@ -25,6 +25,7 @@ restorer-obj-y += ./$(ARCH_DIR)/restorer.o
ifeq ($(ARCH),x86)
ifeq ($(CONFIG_COMPAT),y)
restorer-obj-y += ./$(ARCH_DIR)/call32.o
restorer-obj-y += ./$(ARCH_DIR)/restorer_unmap.o
restorer-obj-y += ./$(ARCH_DIR)/sigaction_compat_pie.o
endif
endif

View File

@@ -929,35 +929,14 @@ static unsigned long vdso_rt_size;
#define vdso_rt_size (0)
#endif
static void *bootstrap_start;
static unsigned int bootstrap_len;
void *bootstrap_start = NULL;
unsigned int bootstrap_len = 0;
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"
" sub vdso_rt_size, %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.