Commit 74c0a702 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

criu: wrap compatible code with CONFIG_COMPAT

As we will not support *native* 32-bit i386 build, I dropped some
ifdefs, introducing instead of ifdef(CONFIG_X86_64) --
ifdef(CONFIG_COMPAT).

CRIU should build now without ia32 Glibc and gcc-multilib support.
Maybe I should add some warning that the build is made without
compatible task support (or criu check should print that),
will do as compat patches hit master.

Fixes: #181

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 31d394bc
......@@ -10,5 +10,7 @@ asflags-y += -iquote $(obj)/include
obj-y += cpu.o
obj-y += crtools.o
obj-y += sigframe.o
obj-y += sigaction_compat.o
obj-y += call32.o
ifeq ($(CONFIG_COMPAT),y)
obj-y += sigaction_compat.o
obj-y += call32.o
endif
......@@ -17,11 +17,9 @@ target :=
target_32 := syscalls-32
target_64 := syscalls-64
SYS-BITS := 32
# native x86_64
ifeq ($(ARCH),x86)
SYS-BITS += 64
SYS-BITS := 64
ifeq ($(CONFIG_COMPAT),y)
SYS-BITS += 32
endif
# targets
......
......@@ -134,8 +134,6 @@ static inline void _setup_sas(struct rt_sigframe* sigframe, ThreadSasEntry *sas)
int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r);
int restore_nonsigframe_gpregs(UserX86RegsEntry *r);
void restore_tls(tls_t *ptls);
int ptrace_set_breakpoint(pid_t pid, void *addr);
int ptrace_flush_breakpoints(pid_t pid);
......
......@@ -13,7 +13,6 @@
int restore_nonsigframe_gpregs(UserX86RegsEntry *r)
{
#ifdef CONFIG_X86_64
long ret;
unsigned long fsgs_base;
......@@ -30,10 +29,10 @@ int restore_nonsigframe_gpregs(UserX86RegsEntry *r)
pr_info("SET_GS fail %ld\n", ret);
return -1;
}
#endif
return 0;
}
#ifdef CONFIG_COMPAT
asm ( " .pushsection .text \n"
" .global restore_set_thread_area \n"
" .code32 \n"
......@@ -90,3 +89,4 @@ void restore_tls(tls_t *ptls)
if (stack32)
free_compat_syscall_stack(stack32);
}
#endif
#ifdef CONFIG_X86_64
static struct syscall_exec_desc sc_exec_table_64[] = {
#include "sys-exec-tbl-64.c"
{ }, /* terminator */
};
#endif
#ifdef CONFIG_COMPAT
static struct syscall_exec_desc sc_exec_table_32[] = {
#include "sys-exec-tbl-32.c"
{ }, /* terminator */
};
#endif
struct syscall_exec_desc;
......@@ -26,7 +26,7 @@ find_syscall_table(char *name, struct syscall_exec_desc *tbl)
#define ARCH_HAS_FIND_SYSCALL
/* overwrite default to search in two tables above */
#ifdef CONFIG_X86_64
#ifdef CONFIG_COMPAT
struct syscall_exec_desc * find_syscall(char *name, struct parasite_ctl *ctl)
{
if (seized_native(ctl))
......@@ -38,6 +38,6 @@ struct syscall_exec_desc * find_syscall(char *name, struct parasite_ctl *ctl)
struct syscall_exec_desc *
find_syscall(char *name, __always_unused struct parasite_ctl *ctl)
{
return find_syscall_table(name, sc_exec_table_32);
return find_syscall_table(name, sc_exec_table_64);
}
#endif
......@@ -299,11 +299,11 @@ void debug_show_page_pipe(struct page_pipe *pp)
if (pp->flags & PP_COMPAT) {
iov_c = (void *)ppb->iov;
pr_debug("\t\t%x %lu\n", iov_c[i].iov_base,
iov_c[i].iov_len / PAGE_SIZE);
(unsigned long) iov_c[i].iov_len / PAGE_SIZE);
} else {
iov = &ppb->iov[i];
pr_debug("\t\t%p %lu\n", iov->iov_base,
iov->iov_len / PAGE_SIZE);
(unsigned long) iov->iov_len / PAGE_SIZE);
}
}
}
......@@ -313,11 +313,11 @@ void debug_show_page_pipe(struct page_pipe *pp)
if (pp->flags & PP_COMPAT) {
iov_c = (void *)pp->holes;
pr_debug("\t%x %lu\n", iov_c[i].iov_base,
iov_c[i].iov_len / PAGE_SIZE);
(unsigned long) iov_c[i].iov_len / PAGE_SIZE);
} else {
iov = &pp->holes[i];
pr_debug("\t%p %lu\n", iov->iov_base,
iov->iov_len / PAGE_SIZE);
(unsigned long) iov->iov_len / PAGE_SIZE);
}
}
}
......@@ -1489,7 +1489,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
if (seized_native(ctl))
parasite_size = pie_size(parasite_native);
#ifdef CONFIG_X86_64 /* compat blob isn't defined for other archs */
#ifdef CONFIG_COMPAT
else
parasite_size = pie_size(parasite_compat);
#endif
......@@ -1513,7 +1513,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
if (seized_native(ctl))
init_parasite_ctl(ctl, native);
#ifdef CONFIG_X86_64 /* compat blob isn't defined for other archs */
#ifdef CONFIG_COMPAT
else
init_parasite_ctl(ctl, compat);
#endif
......
......@@ -2,7 +2,7 @@
# restorer is always native (64-bit)
parasite_target := native
ifeq ($(ARCH),x86)
ifeq ($(CONFIG_COMPAT),y)
parasite_target += compat
endif
......@@ -14,8 +14,11 @@ restorer-obj-y += ./$(ARCH_DIR)/restorer.o
ifeq ($(ARCH),x86)
restorer-obj-e += ./$(ARCH_DIR)/syscalls-64.built-in.o
restorer-obj-y += ./$(ARCH_DIR)/call32.o
restorer-obj-y += ./$(ARCH_DIR)/sigaction_compat_pie.o
ifeq ($(CONFIG_COMPAT),y)
restorer-obj-y += ./$(ARCH_DIR)/call32.o
restorer-obj-y += ./$(ARCH_DIR)/sigaction_compat_pie.o
endif
native-obj-y += ./$(ARCH_DIR)/parasite-head-64.o
native-obj-e += ./$(ARCH_DIR)/syscalls-64.built-in.o
......
......@@ -6,11 +6,12 @@ CFLAGS += -Wa,--noexecstack -fno-stack-protector -DCR_NOGLIBC
CFLAGS_native += -fpie
ifeq ($(ARCH),x86)
target += compat
ifeq ($(CONFIG_COMPAT),y)
target += compat
native-lib-y += util-vdso-elf32.o
endif
CFLAGS_native += -DCONFIG_X86_64
CFLAGS_compat += -fno-pic -m32 -DCONFIG_X86_32
native-lib-y += util-vdso-elf32.o
CFLAGS_util-vdso-elf32.o += -DCONFIG_X86_32
endif
......
#include "parasite-native-blob.h"
#ifdef CONFIG_X86_64
#ifdef CONFIG_COMPAT
# include "parasite-compat-blob.h"
#endif
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