Commit 8544895a authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

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: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent dd3f23e2
#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
...@@ -25,6 +25,7 @@ restorer-obj-y += ./$(ARCH_DIR)/restorer.o ...@@ -25,6 +25,7 @@ restorer-obj-y += ./$(ARCH_DIR)/restorer.o
ifeq ($(ARCH),x86) ifeq ($(ARCH),x86)
ifeq ($(CONFIG_COMPAT),y) ifeq ($(CONFIG_COMPAT),y)
restorer-obj-y += ./$(ARCH_DIR)/call32.o restorer-obj-y += ./$(ARCH_DIR)/call32.o
restorer-obj-y += ./$(ARCH_DIR)/restorer_unmap.o
restorer-obj-y += ./$(ARCH_DIR)/sigaction_compat_pie.o restorer-obj-y += ./$(ARCH_DIR)/sigaction_compat_pie.o
endif endif
endif endif
......
...@@ -929,35 +929,14 @@ static unsigned long vdso_rt_size; ...@@ -929,35 +929,14 @@ static unsigned long vdso_rt_size;
#define vdso_rt_size (0) #define vdso_rt_size (0)
#endif #endif
static void *bootstrap_start; void *bootstrap_start = NULL;
static unsigned int bootstrap_len; unsigned int bootstrap_len = 0;
void __export_unmap(void) void __export_unmap(void)
{ {
sys_munmap(bootstrap_start, bootstrap_len - vdso_rt_size); 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 * This function unmaps all VMAs, which don't belong to
* the restored process or the restorer. * 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