diff --git a/criu/arch/x86/sys-exec-tbl.c b/criu/arch/x86/sys-exec-tbl.c index b7f95b98e..ca45ef0d3 100644 --- a/criu/arch/x86/sys-exec-tbl.c +++ b/criu/arch/x86/sys-exec-tbl.c @@ -24,26 +24,19 @@ find_syscall_table(char *name, struct syscall_exec_desc *tbl) return NULL; } -int __attribute__((weak)) arch_task_compatible(pid_t pid) { return false; } #define ARCH_HAS_FIND_SYSCALL /* overwrite default to search in two tables above */ #ifdef CONFIG_X86_64 -struct syscall_exec_desc * find_syscall(char *name, int pid) +struct syscall_exec_desc * find_syscall(char *name, struct parasite_ctl *ctl) { - int err = arch_task_compatible(pid); - - switch(err) { - case 0: - return find_syscall_table(name, sc_exec_table_64); - case 1: - return find_syscall_table(name, sc_exec_table_32); - default: /* Error */ - return NULL; - } + if (seized_native(ctl)) + return find_syscall_table(name, sc_exec_table_64); + else + return find_syscall_table(name, sc_exec_table_32); } #else struct syscall_exec_desc * -find_syscall(char *name, __attribute__((unused)) int pid) +find_syscall(char *name, __always_unused struct parasite_ctl *ctl) { return find_syscall_table(name, sc_exec_table_32); } diff --git a/criu/cr-exec.c b/criu/cr-exec.c index 618a73c1e..356e206d5 100644 --- a/criu/cr-exec.c +++ b/criu/cr-exec.c @@ -23,7 +23,7 @@ struct syscall_exec_desc { #ifndef ARCH_HAS_FIND_SYSCALL struct syscall_exec_desc * -find_syscall(char *name, int __attribute__((unused)) pid) +find_syscall(char *name, struct parasite_ctl __always_unused *ctl) { int i; @@ -135,12 +135,6 @@ int cr_exec(int pid, char **opt) goto out; } - si = find_syscall(sys_name, pid); - if (!si) { - pr_err("Unknown syscall [%s]\n", sys_name); - goto out; - } - if (seize_catch_task(pid)) goto out; @@ -178,6 +172,12 @@ int cr_exec(int pid, char **opt) goto out_unseize; } + si = find_syscall(sys_name, ctl); + if (!si) { + pr_err("Unknown syscall [%s]\n", sys_name); + goto out_cure; + } + ret = execute_syscall(ctl, si, opt + 1); if (ret < 0) { pr_err("Can't execute syscall remotely\n");