<div dir="ltr">It seem these patch broke compilation by moving criu/include/ptrace.h → compel/include/uapi/ptrace.h <br><br><a href="https://ci.openvz.org/job/CRIU/job/CRIU-virtuozzo/branch/master/55/console">https://ci.openvz.org/job/CRIU/job/CRIU-virtuozzo/branch/master/55/console</a><br><br>  CC       criu/cr-restore.o<br>criu/cr-dump.c: In function ‘dump_signal_queue’:<br>criu/cr-dump.c:901:16: error: ‘PTRACE_PEEKSIGINFO_SHARED’ undeclared (first use in this function)<br>   arg.flags |= PTRACE_PEEKSIGINFO_SHARED;<br>                ^<br>criu/cr-dump.c:901:16: note: each undeclared identifier is reported only once for each function it appears in<br>criu/cr-dump.c:920:21: error: ‘PTRACE_PEEKSIGINFO’ undeclared (first use in this function)<br>   nr = ret = ptrace(PTRACE_PEEKSIGINFO, tid, &amp;arg, si);<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><br>Best Regards, Tikhomirov Pavel.</div></div></div>
<br><div class="gmail_quote">2016-10-19 22:21 GMT+03:00 Cyrill Gorcunov <span dir="ltr">&lt;<a href="mailto:gorcunov@openvz.org" target="_blank">gorcunov@openvz.org</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here we move parasite engine into compel library<br>
and start using it in criu.<br>
<br>
Note that currently the compel relies on piegen mode<br>
which creates binary blob via parasite_blob_desc_t<br>
structure but in future we will implement complete<br>
runtime loader of object files so the parasite will<br>
be external object module which criu upload into<br>
dumpee and run with compel help.<br>
<br>
Signed-off-by: Cyrill Gorcunov &lt;<a href="mailto:gorcunov@openvz.org">gorcunov@openvz.org</a>&gt;<br>
---<br>
 compel/Makefile                                    |   3 +<br>
 .../aarch64/src/lib/include/<wbr>compel/asm/infect.h    |   6 +<br>
 .../arch/aarch64/src/lib}/<wbr>infect.c                 |  57 ++--<br>
 .../arch/arm/src/lib/include/<wbr>compel/asm/infect.h   |   6 +<br>
 .../arch/arm =&gt; compel/arch/arm/src/lib}/<wbr>infect.c  |  64 ++---<br>
 .../arch/ppc64/src/lib/<wbr>include/compel/asm/infect.h |   6 +<br>
 compel/arch/ppc64/src/lib/<wbr>infect.c                 |  85 ++++++<br>
 .../arch/x86/src/lib/include/<wbr>compel/asm/infect.h   |   6 +<br>
 .../arch/x86 =&gt; compel/arch/x86/src/lib}/<wbr>infect.c  |  97 ++-----<br>
 compel/include/compel/err.h                        |   1 +<br>
 .../include/compel}/infect-<wbr>priv.h                  |   9 +-<br>
 compel/include/compel/infect.h                     |  21 ++<br>
 compel/include/compel/signal.h                     |   1 +<br>
 compel/include/uapi/compel/<wbr>compel.h                | 179 ++++++++++++<br>
 {criu =&gt; compel/src/lib}/infect-rpc.c              |  17 +-<br>
 {criu =&gt; compel/src/lib}/infect.c                  | 128 ++++++---<br>
 criu/Makefile.crtools                              |   2 -<br>
 criu/aio.c                                         |   5 +-<br>
 criu/arch/aarch64/Makefile                         |   1 -<br>
 criu/arch/aarch64/crtools.c                        |   8 -<br>
 criu/arch/aarch64/include/asm/<wbr>dump.h               |   2 +<br>
 criu/arch/aarch64/include/asm/<wbr>parasite-syscall.h   |   8 -<br>
 criu/arch/arm/Makefile                             |   1 -<br>
 criu/arch/arm/crtools.c                            |  12 -<br>
 criu/arch/arm/include/asm/<wbr>dump.h                   |   2 +<br>
 criu/arch/arm/include/asm/<wbr>parasite-syscall.h       |   6 -<br>
 criu/arch/ppc64/Makefile                           |   1 -<br>
 criu/arch/ppc64/crtools.c                          |  15 -<br>
 criu/arch/ppc64/include/asm/<wbr>dump.h                 |   2 +<br>
 criu/arch/ppc64/include/asm/<wbr>parasite-syscall.h     |   8 -<br>
 criu/arch/ppc64/infect.c                           | 308 ---------------------<br>
 criu/arch/x86/Makefile                             |   1 -<br>
 criu/arch/x86/crtools.c                            |  23 +-<br>
 criu/arch/x86/include/asm/<wbr>dump.h                   |   2 +<br>
 criu/arch/x86/include/asm/<wbr>parasite-syscall.h       |  10 -<br>
 criu/arch/x86/sys-exec-tbl.c                       |   2 +-<br>
 criu/cr-exec.c                                     |   3 -<br>
 criu/cr-restore.c                                  |   2 -<br>
 criu/include/errno.h                               |   9 -<br>
 criu/include/infect-rpc.h                          |  20 --<br>
 criu/include/infect.h                              | 108 --------<br>
 criu/include/parasite-syscall.<wbr>h                    |   5 -<br>
 criu/include/parasite.h                            |  31 +--<br>
 criu/include/proc_parse.h                          |   4 +-<br>
 criu/mem.c                                         |   4 +-<br>
 criu/parasite-syscall.c                            |  38 ++-<br>
 criu/pie/parasite.c                                |  12 +-<br>
 criu/seize.c                                       |   3 +-<br>
 criu/vdso.c                                        |   5 +-<br>
 49 files changed, 547 insertions(+), 802 deletions(-)<br>
 create mode 100644 compel/arch/aarch64/src/lib/<wbr>include/compel/asm/infect.h<br>
 rename {criu/arch/aarch64 =&gt; compel/arch/aarch64/src/lib}/<wbr>infect.c (61%)<br>
 create mode 100644 compel/arch/arm/src/lib/<wbr>include/compel/asm/infect.h<br>
 rename {criu/arch/arm =&gt; compel/arch/arm/src/lib}/<wbr>infect.c (57%)<br>
 create mode 100644 compel/arch/ppc64/src/lib/<wbr>include/compel/asm/infect.h<br>
 create mode 100644 compel/arch/ppc64/src/lib/<wbr>infect.c<br>
 create mode 100644 compel/arch/x86/src/lib/<wbr>include/compel/asm/infect.h<br>
 rename {criu/arch/x86 =&gt; compel/arch/x86/src/lib}/<wbr>infect.c (53%)<br>
 create mode 120000 compel/include/compel/err.h<br>
 rename {criu/include =&gt; compel/include/compel}/infect-<wbr>priv.h (88%)<br>
 create mode 100644 compel/include/compel/infect.h<br>
 create mode 120000 compel/include/compel/signal.h<br>
 rename {criu =&gt; compel/src/lib}/infect-rpc.c (90%)<br>
 rename {criu =&gt; compel/src/lib}/infect.c (90%)<br>
 delete mode 100644 criu/arch/aarch64/include/asm/<wbr>parasite-syscall.h<br>
 delete mode 100644 criu/arch/arm/include/asm/<wbr>parasite-syscall.h<br>
 delete mode 100644 criu/arch/ppc64/include/asm/<wbr>parasite-syscall.h<br>
 delete mode 100644 criu/arch/ppc64/infect.c<br>
 delete mode 100644 criu/arch/x86/include/asm/<wbr>parasite-syscall.h<br>
 delete mode 100644 criu/include/errno.h<br>
 delete mode 100644 criu/include/infect-rpc.h<br>
 delete mode 100644 criu/include/infect.h<br>
<br>
diff --git a/compel/Makefile b/compel/Makefile<br>
index adf864eb383f..b4e15892682c 100644<br>
--- a/compel/Makefile<br>
+++ b/compel/Makefile<br>
@@ -28,6 +28,9 @@ lib-y                 += src/lib/compel.o<br>
 lib-y                  += arch/$(ARCH)/src/lib/cpu.o<br>
 lib-y                  += arch/$(ARCH)/src/lib/sigframe.<wbr>o<br>
 lib-y                  += src/lib/ptrace.o<br>
+lib-y                  += src/lib/infect-rpc.o<br>
+lib-y                  += arch/$(ARCH)/src/lib/infect.o<br>
+lib-y                  += src/lib/infect.o<br>
<br>
 #<br>
 # This requires arch specific header to<br>
diff --git a/compel/arch/aarch64/src/lib/<wbr>include/compel/asm/infect.h b/compel/arch/aarch64/src/lib/<wbr>include/compel/asm/infect.h<br>
new file mode 100644<br>
index 000000000000..05faf08f4b37<br>
--- /dev/null<br>
+++ b/compel/arch/aarch64/src/lib/<wbr>include/compel/asm/infect.h<br>
@@ -0,0 +1,6 @@<br>
+#ifndef COMPEL_ASM_INFECT_H__<br>
+#define COMPEL_ASM_INFECT_H__<br>
+<br>
+#define BUILTIN_SYSCALL_SIZE   8<br>
+<br>
+#endif /* COMPEL_ASM_INFECT_H__ */<br>
diff --git a/criu/arch/aarch64/infect.c b/compel/arch/aarch64/src/lib/<wbr>infect.c<br>
similarity index 61%<br>
rename from criu/arch/aarch64/infect.c<br>
rename to compel/arch/aarch64/src/lib/<wbr>infect.c<br>
index aaa91b8c162a..d0111701d76c 100644<br>
--- a/criu/arch/aarch64/infect.c<br>
+++ b/compel/arch/aarch64/src/lib/<wbr>infect.c<br>
@@ -1,16 +1,20 @@<br>
-#include &lt;sys/ptrace.h&gt;<br>
-#include &lt;sys/types.h&gt;<br>
+#include &lt;stdlib.h&gt;<br>
+#include &lt;stdio.h&gt;<br>
<br>
-#include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
+#include &lt;sys/mman.h&gt;<br>
+#include &lt;errno.h&gt;<br>
<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
+#include &quot;asm/processor-flags.h&quot;<br>
+#include &quot;asm/infect.h&quot;<br>
 #include &quot;asm/types.h&quot;<br>
-#include &quot;criu-log.h&quot;<br>
-#include &quot;kerndat.h&quot;<br>
-#include &quot;parasite-syscall.h&quot;<br>
-#include &quot;errno.h&quot;<br>
+<br>
+#include &quot;compiler.h&quot;<br>
 #include &quot;infect.h&quot;<br>
 #include &quot;infect-priv.h&quot;<br>
+#include &quot;bug.h&quot;<br>
+#include &quot;err.h&quot;<br>
+<br>
+#include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
<br>
 /*<br>
  * Injected syscall instruction<br>
@@ -29,33 +33,6 @@ static inline void __always_unused __check_code_syscall(void)<br>
        BUILD_BUG_ON(!is_log2(sizeof(<wbr>code_syscall)));<br>
 }<br>
<br>
-int compel_get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *arg)<br>
-{<br>
-       struct iovec iov;<br>
-       user_fpregs_struct_t fpsimd;<br>
-       int ret;<br>
-<br>
-       pr_info(&quot;Dumping GP/FPU registers for %d\n&quot;, pid);<br>
-<br>
-       iov.iov_base = &amp;regs;<br>
-       iov.iov_len = sizeof(user_regs_struct_t);<br>
-       if ((ret = ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &amp;iov))) {<br>
-               pr_perror(&quot;Failed to obtain CPU registers for %d&quot;, pid);<br>
-               goto err;<br>
-       }<br>
-<br>
-       iov.iov_base = &amp;fpsimd;<br>
-       iov.iov_len = sizeof(fpsimd);<br>
-       if ((ret = ptrace(PTRACE_GETREGSET, pid, NT_PRFPREG, &amp;iov))) {<br>
-               pr_perror(&quot;Failed to obtain FPU registers for %d&quot;, pid);<br>
-               goto err;<br>
-       }<br>
-<br>
-       ret = save(arg, &amp;regs, &amp;fpsimd);<br>
-err:<br>
-       return ret;<br>
-}<br>
-<br>
 int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
                                        unsigned long arg1,<br>
                                        unsigned long arg2,<br>
@@ -83,7 +60,14 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
        return err;<br>
 }<br>
<br>
-void *mmap_re(struct parasite_ctl *ctl,<br>
+void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
+{<br>
+       regs-&gt;pc = new_ip;<br>
+       if (stack)<br>
+               regs-&gt;sp = (unsigned long)stack;<br>
+}<br>
+<br>
+void *remote_mmap(struct parasite_ctl *ctl,<br>
                void *addr, size_t length, int prot,<br>
                int flags, int fd, off_t offset)<br>
 {<br>
@@ -97,4 +81,3 @@ void *mmap_re(struct parasite_ctl *ctl,<br>
<br>
        return (void *)map;<br>
 }<br>
-<br>
diff --git a/compel/arch/arm/src/lib/<wbr>include/compel/asm/infect.h b/compel/arch/arm/src/lib/<wbr>include/compel/asm/infect.h<br>
new file mode 100644<br>
index 000000000000..05faf08f4b37<br>
--- /dev/null<br>
+++ b/compel/arch/arm/src/lib/<wbr>include/compel/asm/infect.h<br>
@@ -0,0 +1,6 @@<br>
+#ifndef COMPEL_ASM_INFECT_H__<br>
+#define COMPEL_ASM_INFECT_H__<br>
+<br>
+#define BUILTIN_SYSCALL_SIZE   8<br>
+<br>
+#endif /* COMPEL_ASM_INFECT_H__ */<br>
diff --git a/criu/arch/arm/infect.c b/compel/arch/arm/src/lib/<wbr>infect.c<br>
similarity index 57%<br>
rename from criu/arch/arm/infect.c<br>
rename to compel/arch/arm/src/lib/<wbr>infect.c<br>
index 6f87a33d23d8..6d65cb8815f7 100644<br>
--- a/criu/arch/arm/infect.c<br>
+++ b/compel/arch/arm/src/lib/<wbr>infect.c<br>
@@ -1,16 +1,20 @@<br>
-#include &lt;sys/ptrace.h&gt;<br>
-#include &lt;sys/types.h&gt;<br>
+#include &lt;stdlib.h&gt;<br>
+#include &lt;stdio.h&gt;<br>
<br>
-#include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
+#include &lt;sys/mman.h&gt;<br>
+#include &lt;errno.h&gt;<br>
<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
+#include &quot;asm/processor-flags.h&quot;<br>
+#include &quot;asm/infect.h&quot;<br>
 #include &quot;asm/types.h&quot;<br>
-#include &quot;criu-log.h&quot;<br>
-#include &quot;kerndat.h&quot;<br>
-#include &quot;parasite-syscall.h&quot;<br>
-#include &quot;errno.h&quot;<br>
+<br>
+#include &quot;compiler.h&quot;<br>
 #include &quot;infect.h&quot;<br>
 #include &quot;infect-priv.h&quot;<br>
+#include &quot;bug.h&quot;<br>
+#include &quot;err.h&quot;<br>
+<br>
+#include &quot;uapi/compel/plugins/std/<wbr>syscall-codes.h&quot;<br>
<br>
 /*<br>
  * Injected syscall instruction<br>
@@ -29,39 +33,14 @@ static inline __always_unused void __check_code_syscall(void)<br>
        BUILD_BUG_ON(!is_log2(sizeof(<wbr>code_syscall)));<br>
 }<br>
<br>
-#define PTRACE_GETVFPREGS 27<br>
-int compel_get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *arg)<br>
+void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
 {<br>
-       user_fpregs_struct_t vfp;<br>
-       int ret = -1;<br>
-<br>
-       pr_info(&quot;Dumping GP/FPU registers for %d\n&quot;, pid);<br>
-<br>
-       if (ptrace(PTRACE_GETVFPREGS, pid, NULL, &amp;vfp)) {<br>
-               pr_perror(&quot;Can&#39;t obtain FPU registers for %d&quot;, pid);<br>
-               goto err;<br>
-       }<br>
-<br>
-       /* Did we come from a system call? */<br>
-       if ((int)regs.ARM_ORIG_r0 &gt;= 0) {<br>
-               /* Restart the system call */<br>
-               switch ((long)(int)regs.ARM_r0) {<br>
-               case -ERESTARTNOHAND:<br>
-               case -ERESTARTSYS:<br>
-               case -ERESTARTNOINTR:<br>
-                       regs.ARM_r0 = regs.ARM_ORIG_r0;<br>
-                       regs.ARM_pc -= 4;<br>
-                       break;<br>
-               case -ERESTART_RESTARTBLOCK:<br>
-                       regs.ARM_r0 = __NR_restart_syscall;<br>
-                       regs.ARM_pc -= 4;<br>
-                       break;<br>
-               }<br>
-       }<br>
-<br>
-       ret = save(arg, &amp;regs, &amp;vfp);<br>
-err:<br>
-       return ret;<br>
+       regs-&gt;ARM_pc = new_ip;<br>
+       if (stack)<br>
+               regs-&gt;ARM_sp = (unsigned long)stack;<br>
+<br>
+       /* Make sure flags are in known state */<br>
+       regs-&gt;ARM_cpsr &amp;= PSR_f | PSR_s | PSR_x | MODE32_BIT;<br>
 }<br>
<br>
 int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
@@ -101,9 +80,10 @@ void *remote_mmap(struct parasite_ctl *ctl,<br>
<br>
        err = compel_syscall(ctl, __NR_mmap2, &amp;map,<br>
                        (unsigned long)addr, length, prot, flags, fd, offset &gt;&gt; 12);<br>
-       if (err &lt; 0 || map &gt; kdat.task_size)<br>
+       // FIXME @kdat?<br>
+//     if (err &lt; 0 || map &gt; kdat.task_size)<br>
+       if (err &lt; 0)<br>
                map = 0;<br>
<br>
        return (void *)map;<br>
 }<br>
-<br>
diff --git a/compel/arch/ppc64/src/lib/<wbr>include/compel/asm/infect.h b/compel/arch/ppc64/src/lib/<wbr>include/compel/asm/infect.h<br>
new file mode 100644<br>
index 000000000000..05faf08f4b37<br>
--- /dev/null<br>
+++ b/compel/arch/ppc64/src/lib/<wbr>include/compel/asm/infect.h<br>
@@ -0,0 +1,6 @@<br>
+#ifndef COMPEL_ASM_INFECT_H__<br>
+#define COMPEL_ASM_INFECT_H__<br>
+<br>
+#define BUILTIN_SYSCALL_SIZE   8<br>
+<br>
+#endif /* COMPEL_ASM_INFECT_H__ */<br>
diff --git a/compel/arch/ppc64/src/lib/<wbr>infect.c b/compel/arch/ppc64/src/lib/<wbr>infect.c<br>
new file mode 100644<br>
index 000000000000..815cf8b61acc<br>
--- /dev/null<br>
+++ b/compel/arch/ppc64/src/lib/<wbr>infect.c<br>
@@ -0,0 +1,85 @@<br>
+#include &lt;stdlib.h&gt;<br>
+#include &lt;stdio.h&gt;<br>
+#include &lt;stdint.h&gt;<br>
+<br>
+#include &lt;sys/mman.h&gt;<br>
+#include &lt;errno.h&gt;<br>
+<br>
+#include &quot;asm/processor-flags.h&quot;<br>
+#include &quot;asm/infect.h&quot;<br>
+#include &quot;asm/types.h&quot;<br>
+<br>
+#include &quot;compiler.h&quot;<br>
+#include &quot;infect.h&quot;<br>
+#include &quot;infect-priv.h&quot;<br>
+#include &quot;bug.h&quot;<br>
+#include &quot;err.h&quot;<br>
+<br>
+#include &quot;uapi/compel/plugins/std/<wbr>syscall-codes.h&quot;<br>
+<br>
+/*<br>
+ * Injected syscall instruction<br>
+ */<br>
+const uint32_t code_syscall[] = {<br>
+       0x44000002,             /* sc           */<br>
+       0x0fe00000              /* twi 31,0,0   */<br>
+};<br>
+<br>
+static inline void __check_code_syscall(void)<br>
+{<br>
+       BUILD_BUG_ON(sizeof(code_<wbr>syscall) != BUILTIN_SYSCALL_SIZE);<br>
+       BUILD_BUG_ON(!is_log2(sizeof(<wbr>code_syscall)));<br>
+}<br>
+<br>
+void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
+{<br>
+       /*<br>
+        * OpenPOWER ABI requires that r12 is set to the calling function addressi<br>
+        * to compute the TOC pointer.<br>
+        */<br>
+       regs-&gt;gpr[12] = new_ip;<br>
+       regs-&gt;nip = new_ip;<br>
+       if (stack)<br>
+               regs-&gt;gpr[1] = (unsigned long) stack;<br>
+       regs-&gt;trap = 0;<br>
+}<br>
+<br>
+int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
+               unsigned long arg1,<br>
+               unsigned long arg2,<br>
+               unsigned long arg3,<br>
+               unsigned long arg4,<br>
+               unsigned long arg5,<br>
+               unsigned long arg6)<br>
+{<br>
+       user_regs_struct_t regs = ctl-&gt;orig.regs;<br>
+       int err;<br>
+<br>
+       regs.gpr[0] = (unsigned long)nr;<br>
+       regs.gpr[3] = arg1;<br>
+       regs.gpr[4] = arg2;<br>
+       regs.gpr[5] = arg3;<br>
+       regs.gpr[6] = arg4;<br>
+       regs.gpr[7] = arg5;<br>
+       regs.gpr[8] = arg6;<br>
+<br>
+       err = compel_execute_syscall(ctl, &amp;regs, (char*)code_syscall);<br>
+<br>
+       *ret = regs.gpr[3];<br>
+       return err;<br>
+}<br>
+<br>
+void *remote_mmap(struct parasite_ctl *ctl,<br>
+                 void *addr, size_t length, int prot,<br>
+                 int flags, int fd, off_t offset)<br>
+{<br>
+       unsigned long map = 0;<br>
+       int err;<br>
+<br>
+       err = compel_syscall(ctl, __NR_mmap, &amp;map,<br>
+                       (unsigned long)addr, length, prot, flags, fd, offset);<br>
+       if (err &lt; 0 || (long)map &lt; 0)<br>
+               map = 0;<br>
+<br>
+       return (void *)map;<br>
+}<br>
diff --git a/compel/arch/x86/src/lib/<wbr>include/compel/asm/infect.h b/compel/arch/x86/src/lib/<wbr>include/compel/asm/infect.h<br>
new file mode 100644<br>
index 000000000000..05faf08f4b37<br>
--- /dev/null<br>
+++ b/compel/arch/x86/src/lib/<wbr>include/compel/asm/infect.h<br>
@@ -0,0 +1,6 @@<br>
+#ifndef COMPEL_ASM_INFECT_H__<br>
+#define COMPEL_ASM_INFECT_H__<br>
+<br>
+#define BUILTIN_SYSCALL_SIZE   8<br>
+<br>
+#endif /* COMPEL_ASM_INFECT_H__ */<br>
diff --git a/criu/arch/x86/infect.c b/compel/arch/x86/src/lib/<wbr>infect.c<br>
similarity index 53%<br>
rename from criu/arch/x86/infect.c<br>
rename to compel/arch/x86/src/lib/<wbr>infect.c<br>
index 70423f6e34c3..4503a816e8ca 100644<br>
--- a/criu/arch/x86/infect.c<br>
+++ b/compel/arch/x86/src/lib/<wbr>infect.c<br>
@@ -1,19 +1,20 @@<br>
-#include &lt;sys/ptrace.h&gt;<br>
-#include &lt;sys/types.h&gt;<br>
-#include &lt;sys/uio.h&gt;<br>
-#include &lt;sys/auxv.h&gt;<br>
-#include &lt;sys/mman.h&gt;<br>
+#include &lt;stdlib.h&gt;<br>
+#include &lt;stdio.h&gt;<br>
<br>
-#include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
-#include &lt;compel/cpu.h&gt;<br>
+#include &lt;sys/mman.h&gt;<br>
+#include &lt;errno.h&gt;<br>
<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
-#include &quot;err.h&quot;<br>
+#include &quot;asm/processor-flags.h&quot;<br>
+#include &quot;asm/infect.h&quot;<br>
 #include &quot;asm/types.h&quot;<br>
-#include &quot;errno.h&quot;<br>
-#include &quot;parasite-syscall.h&quot;<br>
+<br>
+#include &quot;compiler.h&quot;<br>
 #include &quot;infect.h&quot;<br>
 #include &quot;infect-priv.h&quot;<br>
+#include &quot;bug.h&quot;<br>
+#include &quot;err.h&quot;<br>
+<br>
+#include &quot;uapi/compel/plugins/std/<wbr>syscall-codes.h&quot;<br>
<br>
 /*<br>
  * Injected syscall instruction<br>
@@ -40,71 +41,21 @@ static inline __always_unused void __check_code_syscall(void)<br>
        BUILD_BUG_ON(!is_log2(sizeof(<wbr>code_syscall)));<br>
 }<br>
<br>
-#define get_signed_user_reg(pregs, name)                               \<br>
-       ((user_regs_native(pregs)) ? (int64_t)((pregs)-&gt;<a href="http://native.name" rel="noreferrer" target="_blank">native.name</a><wbr>) :  \<br>
-                               (int32_t)((pregs)-&gt;<a href="http://compat.name" rel="noreferrer" target="_blank">compat.name</a><wbr>))<br>
-<br>
-int compel_get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *arg)<br>
+/*<br>
+ * regs must be inited when calling this function from original context<br>
+ */<br>
+void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
 {<br>
-       user_fpregs_struct_t xsave      = {  }, *xs = NULL;<br>
-<br>
-       struct iovec iov;<br>
-       int ret = -1;<br>
-<br>
-       pr_info(&quot;Dumping general registers for %d in %s mode\n&quot;, pid,<br>
-                       user_regs_native(&amp;regs) ? &quot;native&quot; : &quot;compat&quot;);<br>
-<br>
-       /* Did we come from a system call? */<br>
-       if (get_signed_user_reg(&amp;regs, orig_ax) &gt;= 0) {<br>
-               /* Restart the system call */<br>
-               switch (get_signed_user_reg(&amp;regs, ax)) {<br>
-               case -ERESTARTNOHAND:<br>
-               case -ERESTARTSYS:<br>
-               case -ERESTARTNOINTR:<br>
-                       set_user_reg(&amp;regs, ax, get_user_reg(&amp;regs, orig_ax));<br>
-                       set_user_reg(&amp;regs, ip, get_user_reg(&amp;regs, ip) - 2);<br>
-                       break;<br>
-               case -ERESTART_RESTARTBLOCK:<br>
-                       pr_warn(&quot;Will restore %d with interrupted system call\n&quot;, pid);<br>
-                       set_user_reg(&amp;regs, ax, -EINTR);<br>
-                       break;<br>
-               }<br>
-       }<br>
-<br>
-#ifndef PTRACE_GETREGSET<br>
-# define PTRACE_GETREGSET 0x4204<br>
-#endif<br>
-<br>
-       if (!cpu_has_feature(X86_FEATURE_<wbr>FPU))<br>
-               goto out;<br>
-<br>
-       /*<br>
-        * FPU fetched either via fxsave or via xsave,<br>
-        * thus decode it accrodingly.<br>
-        */<br>
+       set_user_reg(regs, ip, new_ip);<br>
+       if (stack)<br>
+               set_user_reg(regs, sp, (unsigned long) stack);<br>
<br>
-       pr_info(&quot;Dumping GP/FPU registers for %d\n&quot;, pid);<br>
-<br>
-       if (cpu_has_feature(X86_FEATURE_<wbr>XSAVE)) {<br>
-               iov.iov_base = &amp;xsave;<br>
-               iov.iov_len = sizeof(xsave);<br>
-<br>
-               if (ptrace(PTRACE_GETREGSET, pid, (unsigned int)NT_X86_XSTATE, &amp;iov) &lt; 0) {<br>
-                       pr_perror(&quot;Can&#39;t obtain FPU registers for %d&quot;, pid);<br>
-                       goto err;<br>
-               }<br>
-       } else {<br>
-               if (ptrace(PTRACE_GETFPREGS, pid, NULL, &amp;xsave)) {<br>
-                       pr_perror(&quot;Can&#39;t obtain FPU registers for %d&quot;, pid);<br>
-                       goto err;<br>
-               }<br>
-       }<br>
+       /* Avoid end of syscall processing */<br>
+       set_user_reg(regs, orig_ax, -1);<br>
<br>
-       xs = &amp;xsave;<br>
-out:<br>
-       ret = save(arg, &amp;regs, xs);<br>
-err:<br>
-       return ret;<br>
+       /* Make sure flags are in known state */<br>
+       set_user_reg(regs, flags, get_user_reg(regs, flags) &amp;<br>
+                    ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF));<br>
 }<br>
<br>
 int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
diff --git a/compel/include/compel/err.h b/compel/include/compel/err.h<br>
new file mode 120000<br>
index 000000000000..62323ce5b06f<br>
--- /dev/null<br>
+++ b/compel/include/compel/err.h<br>
@@ -0,0 +1 @@<br>
+../../../criu/include/err.h<br>
\ No newline at end of file<br>
diff --git a/criu/include/infect-priv.h b/compel/include/compel/<wbr>infect-priv.h<br>
similarity index 88%<br>
rename from criu/include/infect-priv.h<br>
rename to compel/include/compel/infect-<wbr>priv.h<br>
index 3ddd1175f754..3766ef2b134a 100644<br>
--- a/criu/include/infect-priv.h<br>
+++ b/compel/include/compel/<wbr>infect-priv.h<br>
@@ -1,8 +1,11 @@<br>
-#ifndef __COMPEL_INFECT_PRIV_H__<br>
-#define __COMPEL_INFECT_PRIV_H__<br>
+#ifndef COMPEL_INFECT_PRIV_H__<br>
+#define COMPEL_INFECT_PRIV_H__<br>
<br>
 #include &lt;stdbool.h&gt;<br>
<br>
+#include &quot;uapi/compel/plugins/std/<wbr>syscall-types.h&quot;<br>
+#include &quot;uapi/compel/compel.h&quot;<br>
+<br>
 /* parasite control block */<br>
 struct parasite_ctl {<br>
        int                     rpid;                                   /* Real pid of the victim */<br>
@@ -49,4 +52,4 @@ extern int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
 extern void *remote_mmap(struct parasite_ctl *ctl,<br>
                void *addr, size_t length, int prot,<br>
                int flags, int fd, off_t offset);<br>
-#endif<br>
+#endif /* COMPEL_INFECT_PRIV_H__ */<br>
diff --git a/compel/include/compel/<wbr>infect.h b/compel/include/compel/<wbr>infect.h<br>
new file mode 100644<br>
index 000000000000..9db6a7b22e83<br>
--- /dev/null<br>
+++ b/compel/include/compel/<wbr>infect.h<br>
@@ -0,0 +1,21 @@<br>
+#ifndef COMPEL_INFECT_H__<br>
+#define COMPEL_INFECT_H__<br>
+<br>
+#include &lt;stdint.h&gt;<br>
+#include &lt;sys/un.h&gt;<br>
+<br>
+#include &quot;asm/infect.h&quot;<br>
+#include &quot;asm/types.h&quot;<br>
+<br>
+struct parasite_ctl;<br>
+<br>
+extern void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);<br>
+extern int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
+                         unsigned long arg1, unsigned long arg2,<br>
+                         unsigned long arg3, unsigned long arg4,<br>
+                         unsigned long arg5, unsigned long arg6);<br>
+extern void *mmap_seized(struct parasite_ctl *ctl,<br>
+                        void *addr, size_t length, int prot,<br>
+                        int flags, int fd, off_t offset);<br>
+<br>
+#endif /* COMPEL_INFECT_H__ */<br>
diff --git a/compel/include/compel/<wbr>signal.h b/compel/include/compel/<wbr>signal.h<br>
new file mode 120000<br>
index 000000000000..c8868266d8fa<br>
--- /dev/null<br>
+++ b/compel/include/compel/<wbr>signal.h<br>
@@ -0,0 +1 @@<br>
+../../../criu/include/signal.<wbr>h<br>
\ No newline at end of file<br>
diff --git a/compel/include/uapi/compel/<wbr>compel.h b/compel/include/uapi/compel/<wbr>compel.h<br>
index c0828fdfbb2d..7e1e4fcc1745 100644<br>
--- a/compel/include/uapi/compel/<wbr>compel.h<br>
+++ b/compel/include/uapi/compel/<wbr>compel.h<br>
@@ -1,8 +1,17 @@<br>
 #ifndef UAPI_COMPEL_H__<br>
 #define UAPI_COMPEL_H__<br>
<br>
+#include &lt;stdint.h&gt;<br>
+#include &lt;signal.h&gt;<br>
 #include &lt;errno.h&gt;<br>
<br>
+#include &lt;sys/types.h&gt;<br>
+#include &lt;sys/un.h&gt;<br>
+<br>
+#include &lt;compel/asm/types.h&gt;<br>
+#include &lt;compel/asm/sigframe.h&gt;<br>
+#include &lt;compel/lock.h&gt;<br>
+<br>
 #define COMPEL_TYPE_INT                (1u &lt;&lt; 0)<br>
 #define COMPEL_TYPE_LONG       (1u &lt;&lt; 1)<br>
 #define COMPEL_TYPE_GOTPCREL   (1u &lt;&lt; 2)<br>
@@ -35,4 +44,174 @@ extern unsigned int compel_log_get_loglevel(void);<br>
 extern int compel_log_get_fd(void);<br>
 extern void compel_log_set_fd(int fd);<br>
<br>
+/*<br>
+ * Parasite engine<br>
+ */<br>
+<br>
+struct parasite_ctl;<br>
+<br>
+extern int compel_rpc_sync(unsigned int cmd, struct parasite_ctl *ctl);<br>
+extern int compel_rpc_call(unsigned int cmd, struct parasite_ctl *ctl);<br>
+extern int compel_rpc_call_sync(unsigned int cmd, struct parasite_ctl *ctl);<br>
+extern int compel_rpc_sock(struct parasite_ctl *ctl);<br>
+<br>
+struct ctl_msg {<br>
+       uint32_t        cmd;            /* command itself */<br>
+       uint32_t        ack;            /* ack on command */<br>
+       uint32_t        err;            /* error code on reply */<br>
+};<br>
+<br>
+#define ctl_msg_cmd(_cmd)      (struct ctl_msg){ .cmd = _cmd, }<br>
+#define ctl_msg_ack(_cmd, _err)        (struct ctl_msg){ .cmd = _cmd, .ack = _cmd, .err = _err, }<br>
+<br>
+struct parasite_unmap_args {<br>
+       uint64_t        parasite_start;<br>
+       uint64_t        parasite_len;<br>
+};<br>
+<br>
+typedef struct {<br>
+       void *          blob;<br>
+       size_t          blob_size;<br>
+       size_t          pie_size;<br>
+       unsigned long   (*get_parasite_ip)(void *remote_map);<br>
+       unsigned int *  (*get_addr_cmd)(void *local_map);<br>
+       void *          (*get_addr_args)(void *local_map);<br>
+       void            (*postproc)(void *local_map, void *remote_map);<br>
+} parasite_blob_desc_t;<br>
+<br>
+enum {<br>
+       COMPEL_PARASITE_CMD_IDLE        =   0,<br>
+       COMPEL_PARASITE_CMD_ACK         = 100,<br>
+       COMPEL_PARASITE_CMD_INIT_<wbr>DAEMON = 200,<br>
+       COMPEL_PARASITE_CMD_UNMAP       = 300,<br>
+       COMPEL_PARASITE_CMD_FINI        = 400,<br>
+<br>
+       /*<br>
+        * Custom user commands should start from here.<br>
+        */<br>
+       COMPEL_PARASITE_CMD_USR_BASE    = 500,<br>
+};<br>
+<br>
+#define PARASITE_ARG_SIZE_MIN  (1 &lt;&lt; 12)<br>
+#define PARASITE_START_AREA_MIN        (4096)<br>
+<br>
+#define compel_parasite_args(ctl, type)                                        \<br>
+       ({                                                              \<br>
+               void *___ret;                                           \<br>
+               BUILD_BUG_ON(sizeof(type) &gt; PARASITE_ARG_SIZE_MIN);     \<br>
+               ___ret = compel_parasite_args_p(ctl);                   \<br>
+               ___ret;                                                 \<br>
+       })<br>
+<br>
+extern void *compel_parasite_args_p(struct parasite_ctl *ctl);<br>
+extern void *compel_parasite_args_s(struct parasite_ctl *ctl, int args_size);<br>
+<br>
+extern int compel_execute_syscall(struct parasite_ctl *ctl,<br>
+                                 user_regs_struct_t *regs,<br>
+                                 const char *code_syscall);<br>
+<br>
+#define COMPEL_PARASITE_STACK_SIZE     (16 &lt;&lt; 10)<br>
+<br>
+struct parasite_init_args {<br>
+       int32_t                         h_addr_len;<br>
+       struct sockaddr_un              h_addr;<br>
+       int32_t                         log_level;<br>
+       uint64_t                        sigreturn_addr;<br>
+       uint64_t                        sigframe; /* pointer to sigframe */<br>
+       futex_t                         daemon_connected;<br>
+};<br>
+<br>
+struct seize_task_status {<br>
+       char                    state;<br>
+       int                     ppid;<br>
+       unsigned long long      sigpnd;<br>
+       unsigned long long      shdpnd;<br>
+       int                     seccomp_mode;<br>
+};<br>
+<br>
+struct thread_ctx {<br>
+       k_rtsigset_t            sigmask;<br>
+       user_regs_struct_t      regs;<br>
+};<br>
+<br>
+/*<br>
+ * FIXME -- these should be mapped to CRIU&#39;s pid.h&#39;s<br>
+ */<br>
+<br>
+#define TASK_ALIVE             0x1<br>
+#define TASK_DEAD              0x2<br>
+#define TASK_STOPPED           0x3<br>
+#define TASK_ZOMBIE            0x6<br>
+<br>
+struct infect_ctx {<br>
+       int             *p_sock;<br>
+<br>
+       /*<br>
+        * Regs manipulation context.<br>
+        */<br>
+       int             (*save_regs)(void *arg, user_regs_struct_t *regs,<br>
+                                    user_fpregs_struct_t *f);<br>
+       int             (*make_sigframe)(void *arg, struct rt_sigframe *sf,<br>
+                                        struct rt_sigframe *rtsf,<br>
+                                        k_rtsigset_t *bs);<br>
+       void            *regs_arg;<br>
+<br>
+       unsigned long   syscall_ip;     /* entry point of infection */<br>
+       unsigned long   flags;          /* fine-tune (e.g. faults) */<br>
+<br>
+       /* Hander for SIGCHLD deaths */<br>
+       void            (*child_handler)(int signal, siginfo_t *siginfo,<br>
+                                        void *data);<br>
+};<br>
+<br>
+extern struct parasite_ctl *compel_prepare(pid_t pid);<br>
+extern int compel_infect(struct parasite_ctl *ctl,<br>
+                        parasite_blob_desc_t *d,<br>
+                        unsigned long nr_threads,<br>
+                        unsigned long args_size);<br>
+extern int compel_prepare_thread(pid_t pid, struct thread_ctx *ctx);<br>
+extern int compel_run_in_thread(pid_t pid, unsigned int cmd,<br>
+                               struct parasite_ctl *ctl,<br>
+                               struct thread_ctx *octx);<br>
+extern int compel_stop_daemon(struct parasite_ctl *ctl);<br>
+extern int compel_cure_remote(struct parasite_ctl *ctl);<br>
+extern int compel_cure_local(struct parasite_ctl *ctl);<br>
+extern int compel_cure(struct parasite_ctl *ctl);<br>
+<br>
+/*<br>
+ * The PTRACE_SYSCALL will trap task twice -- on<br>
+ * enter into and on exit from syscall. If we trace<br>
+ * a single task, we may skip half of all getregs<br>
+ * calls -- on exit we don&#39;t need them.<br>
+ */<br>
+enum trace_flags {<br>
+       TRACE_ALL,<br>
+       TRACE_ENTER,<br>
+       TRACE_EXIT,<br>
+};<br>
+<br>
+extern int compel_stop_on_syscall(int tasks, int sys_nr,<br>
+                                 int sys_nr_compat,<br>
+                                 enum trace_flags trace);<br>
+<br>
+extern int compel_stop_pie(pid_t pid, void *addr,<br>
+                          enum trace_flags *tf, bool no_bp);<br>
+extern int compel_unmap(struct parasite_ctl *ctl, unsigned long addr);<br>
+<br>
+extern int compel_stop_task(pid_t pid);<br>
+extern int compel_wait_task(pid_t pid, pid_t ppid,<br>
+                           int (*get_status)(pid_t pid, struct seize_task_status *ss),<br>
+                           struct seize_task_status *ss);<br>
+extern int compel_unseize_task(pid_t pid, int orig_state, int st);<br>
+<br>
+#define INFECT_NO_MEMFD                0x1     /* don&#39;t use memfd() */<br>
+#define INFECT_FAIL_CONNECT    0x2     /* make parasite connect() fail */<br>
+#define INFECT_NO_BREAKPOINTS  0x4     /* no breakpoints in pie tracking */<br>
+<br>
+extern struct infect_ctx *compel_infect_ctx(struct parasite_ctl *ctl);<br>
+<br>
+extern int compel_mode_native(struct parasite_ctl *ctl);<br>
+<br>
+extern k_rtsigset_t *compel_task_sigmask(struct parasite_ctl *ctl);<br>
+<br>
 #endif /* UAPI_COMPEL_H__ */<br>
diff --git a/criu/infect-rpc.c b/compel/src/lib/infect-rpc.c<br>
similarity index 90%<br>
rename from criu/infect-rpc.c<br>
rename to compel/src/lib/infect-rpc.c<br>
index 0084495acbcf..097b177a38c5 100644<br>
--- a/criu/infect-rpc.c<br>
+++ b/compel/src/lib/infect-rpc.c<br>
@@ -1,9 +1,14 @@<br>
-#include &quot;xmalloc.h&quot;<br>
-#include &quot;parasite.h&quot;<br>
-#include &quot;parasite-syscall.h&quot;<br>
-#include &quot;infect.h&quot;<br>
+#include &lt;stdlib.h&gt;<br>
+#include &lt;string.h&gt;<br>
+#include &lt;stdbool.h&gt;<br>
+<br>
+#include &lt;sys/types.h&gt;<br>
+#include &lt;sys/socket.h&gt;<br>
+<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;infect-priv.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
+#include &quot;log.h&quot;<br>
<br>
 static int __parasite_send_cmd(int sockfd, struct ctl_msg *m)<br>
 {<br>
@@ -30,7 +35,7 @@ int parasite_wait_ack(int sockfd, unsigned int cmd, struct ctl_msg *m)<br>
        pr_debug(&quot;Wait for ack %d on daemon socket\n&quot;, cmd);<br>
<br>
        while (1) {<br>
-               memzero(m, sizeof(*m));<br>
+               memset(m, 0, sizeof(*m));<br>
<br>
                ret = recv(sockfd, m, sizeof(*m), MSG_WAITALL);<br>
                if (ret == -1) {<br>
diff --git a/criu/infect.c b/compel/src/lib/infect.c<br>
similarity index 90%<br>
rename from criu/infect.c<br>
rename to compel/src/lib/infect.c<br>
index 002500f167ac..2882148b1be5 100644<br>
--- a/criu/infect.c<br>
+++ b/compel/src/lib/infect.c<br>
@@ -1,38 +1,45 @@<br>
+#include &lt;stdio.h&gt;<br>
+#include &lt;stdlib.h&gt;<br>
+#include &lt;unistd.h&gt;<br>
+#include &lt;string.h&gt;<br>
+#include &lt;stdint.h&gt;<br>
+<br>
 #include &lt;sys/wait.h&gt;<br>
 #include &lt;sys/types.h&gt;<br>
+#include &lt;sys/socket.h&gt;<br>
 #include &lt;sys/ptrace.h&gt;<br>
-#include &lt;unistd.h&gt;<br>
+#include &lt;sys/mman.h&gt;<br>
+#include &lt;sys/un.h&gt;<br>
+<br>
 #include &lt;errno.h&gt;<br>
 #include &lt;signal.h&gt;<br>
+<br>
 #include &lt;linux/seccomp.h&gt;<br>
<br>
-#include &lt;compel/asm/sigframe.h&gt;<br>
+#include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
+#include &lt;compel/ptrace.h&gt;<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
+#include &quot;uapi/compel/plugins/plugin-<wbr>fds.h&quot;<br>
<br>
-#include &quot;ptrace.h&quot;<br>
-#include &quot;signal.h&quot;<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
-#include &quot;asm/dump.h&quot;<br>
-#include &quot;restorer.h&quot;<br>
-#include &quot;parasite.h&quot;<br>
-#include &quot;parasite-syscall.h&quot;<br>
-#include &quot;pie-relocs.h&quot;<br>
-#include &quot;parasite-blob.h&quot;<br>
-#include &quot;log.h&quot;<br>
 #include &quot;infect.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
 #include &quot;infect-priv.h&quot;<br>
<br>
-#define PTRACE_EVENT_STOP      128<br>
+#include &quot;xmalloc.h&quot;<br>
+#include &quot;signal.h&quot;<br>
+#include &quot;log.h&quot;<br>
+#include &quot;bug.h&quot;<br>
<br>
-#ifndef SECCOMP_MODE_DISABLED<br>
-#define SECCOMP_MODE_DISABLED 0<br>
+#ifdef LOG_PREFIX<br>
+#undef LOG_PREFIX<br>
 #endif<br>
<br>
-#ifndef PTRACE_O_SUSPEND_SECCOMP<br>
-# define PTRACE_O_SUSPEND_SECCOMP (1 &lt;&lt; 21)<br>
-#endif<br>
+#define LOG_PREFIX &quot;compel: infect: &quot;<br>
+<br>
+#define UNIX_PATH_MAX (sizeof(struct sockaddr_un) -                    \<br>
+                      (size_t)((struct sockaddr_un *) 0)-&gt;sun_path)<br>
<br>
-#define SI_EVENT(_si_code)     (((_si_code) &amp; 0xFFFF) &gt;&gt; 8)<br>
+#define close_safe(x)  if (*(x) &gt;= 0) { close(*(x)); *(x) = -1; }<br>
<br>
 int compel_stop_task(int pid)<br>
 {<br>
@@ -125,7 +132,7 @@ static int do_suspend_seccomp(pid_t pid)<br>
  * up with someone else.<br>
  */<br>
 int compel_wait_task(int pid, int ppid,<br>
-               int (*get_status)(int pid, struct seize_task_status *),<br>
+               int (*get_status)(int pid, struct seize_task_status *ss),<br>
                struct seize_task_status *ss)<br>
 {<br>
        siginfo_t si;<br>
@@ -477,7 +484,7 @@ int compel_execute_syscall(struct parasite_ctl *ctl,<br>
 {<br>
        pid_t pid = ctl-&gt;rpid;<br>
        int err;<br>
-       u8 code_orig[BUILTIN_SYSCALL_<wbr>SIZE];<br>
+       uint8_t code_orig[BUILTIN_SYSCALL_<wbr>SIZE];<br>
<br>
        /*<br>
         * Inject syscall instruction and remember original code,<br>
@@ -525,13 +532,14 @@ static int parasite_init_daemon(struct parasite_ctl *ctl)<br>
        pid_t pid = ctl-&gt;rpid;<br>
        user_regs_struct_t regs;<br>
        struct ctl_msg m = { };<br>
+       int rpc_sk;<br>
<br>
-       *ctl-&gt;addr_cmd = PARASITE_CMD_INIT_DAEMON;<br>
+       *ctl-&gt;addr_cmd = COMPEL_PARASITE_CMD_INIT_<wbr>DAEMON;<br>
<br>
        args = compel_parasite_args(ctl, struct parasite_init_args);<br>
<br>
        args-&gt;sigframe = (uintptr_t)ctl-&gt;rsigframe;<br>
-       args-&gt;log_level = log_get_loglevel();<br>
+       args-&gt;log_level = compel_log_get_loglevel();<br>
<br>
        futex_set(&amp;args-&gt;daemon_<wbr>connected, 0);<br>
<br>
@@ -556,12 +564,15 @@ static int parasite_init_daemon(struct parasite_ctl *ctl)<br>
        if (accept_tsock(ctl) &lt; 0)<br>
                goto err;<br>
<br>
-       if (parasite_send_fd(ctl, log_get_fd()))<br>
+       rpc_sk = compel_rpc_sock(ctl);<br>
+       if (send_fd(rpc_sk, NULL, 0, compel_log_get_fd()) &lt; 0) {<br>
+               pr_perror(&quot;Can&#39;t send file descriptor&quot;);<br>
                goto err;<br>
+       }<br>
<br>
        pr_info(&quot;Wait for parasite being daemonized...\n&quot;);<br>
<br>
-       if (parasite_wait_ack(ctl-&gt;tsock, PARASITE_CMD_INIT_DAEMON, &amp;m)) {<br>
+       if (parasite_wait_ack(ctl-&gt;tsock, COMPEL_PARASITE_CMD_INIT_<wbr>DAEMON, &amp;m)) {<br>
                pr_err(&quot;Can&#39;t switch parasite %d to daemon mode %d\n&quot;,<br>
                       pid, m.err);<br>
                goto err;<br>
@@ -602,6 +613,7 @@ static int parasite_start_daemon(struct parasite_ctl *ctl)<br>
<br>
 static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)<br>
 {<br>
+       char path[64];<br>
        int fd;<br>
<br>
        ctl-&gt;remote_map = remote_mmap(ctl, NULL, size,<br>
@@ -614,10 +626,13 @@ static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)<br>
<br>
        ctl-&gt;map_length = round_up(size, page_size());<br>
<br>
-       fd = open_proc_rw(ctl-&gt;rpid, &quot;map_files/%p-%p&quot;,<br>
-                ctl-&gt;remote_map, ctl-&gt;remote_map + ctl-&gt;map_length);<br>
-       if (fd &lt; 0)<br>
+       snprintf(path, sizeof(path), &quot;/proc/%d/map_files/%p-%p&quot;,<br>
+                ctl-&gt;rpid, ctl-&gt;remote_map, ctl-&gt;remote_map + ctl-&gt;map_length);<br>
+       fd = open(path, O_RDWR);<br>
+       if (fd &lt; 0) {<br>
+               pr_perror(&quot;Can&#39;t open %s\n&quot;, path);<br>
                return -1;<br>
+       }<br>
<br>
        ctl-&gt;local_map = mmap(NULL, size, PROT_READ | PROT_WRITE,<br>
                              MAP_SHARED | MAP_FILE, fd, 0);<br>
@@ -635,11 +650,12 @@ static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)<br>
 static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)<br>
 {<br>
        void *where = (void *)ctl-&gt;ictx.syscall_ip + BUILTIN_SYSCALL_SIZE;<br>
-       u8 orig_code[MEMFD_FNAME_SZ] = MEMFD_FNAME;<br>
+       uint8_t orig_code[MEMFD_FNAME_SZ] = MEMFD_FNAME;<br>
        pid_t pid = ctl-&gt;rpid;<br>
        unsigned long sret = -ENOSYS;<br>
        int ret, fd, lfd;<br>
        bool __maybe_unused compat_task = !compel_mode_native(ctl);<br>
+       char path[64];<br>
<br>
        if (ctl-&gt;ictx.flags &amp; INFECT_NO_MEMFD)<br>
                return 1;<br>
@@ -673,9 +689,12 @@ static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)<br>
                return fd;<br>
<br>
        ctl-&gt;map_length = round_up(size, page_size());<br>
-       lfd = open_proc_rw(ctl-&gt;rpid, &quot;fd/%d&quot;, fd);<br>
-       if (lfd &lt; 0)<br>
+       snprintf(path, sizeof(path), &quot;/proc/%d/fd/%d&quot;, ctl-&gt;rpid, fd);<br>
+       lfd = open(path, O_RDWR);<br>
+       if (lfd &lt; 0) {<br>
+               pr_perror(&quot;Can&#39;t open %s&quot;, path);<br>
                goto err_cure;<br>
+       }<br>
<br>
        if (ftruncate(lfd, ctl-&gt;map_length) &lt; 0) {<br>
                pr_perror(&quot;Fail to truncate memfd for parasite&quot;);<br>
@@ -738,11 +757,18 @@ int compel_map_exchange(struct parasite_ctl *ctl, unsigned long size)<br>
                __export_parasite_args);                                \<br>
        } while (0)<br>
<br>
-int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned long args_size)<br>
+int compel_infect(struct parasite_ctl *ctl, parasite_blob_desc_t *d,<br>
+                 unsigned long nr_threads, unsigned long args_size)<br>
 {<br>
        int ret;<br>
        unsigned long p, map_exchange_size, parasite_size = 0;<br>
<br>
+       pr_debug(&quot;desc: blob %p blob_size %zd pie_size %zd &quot;<br>
+                &quot;get_parasite_ip %p get_addr_cmd %p &quot;<br>
+                &quot;get_addr_args %p postproc %p\n&quot;,<br>
+                d-&gt;blob, d-&gt;blob_size, d-&gt;pie_size, d-&gt;get_parasite_ip,<br>
+                d-&gt;get_addr_cmd, d-&gt;get_addr_args, d-&gt;postproc);<br>
+<br>
        /*<br>
         * Inject a parasite engine. Ie allocate memory inside alien<br>
         * space and copy engine code there. Then re-map the engine<br>
@@ -750,20 +776,23 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l<br>
         * without using ptrace at all.<br>
         */<br>
<br>
-       if (compel_mode_native(ctl))<br>
-               parasite_size = pie_size(parasite_native);<br>
+       if (compel_mode_native(ctl)) {<br>
+               //parasite_size = pie_size(parasite_native);<br>
+               parasite_size = d-&gt;pie_size;<br>
 #ifdef CONFIG_COMPAT<br>
-       else<br>
-               parasite_size = pie_size(parasite_compat);<br>
+       } else {<br>
+               //parasite_size = pie_size(parasite_compat);<br>
+               parasite_size = d-&gt;pie_size;<br>
 #endif<br>
+       }<br>
<br>
        ctl-&gt;args_size = round_up(args_size, PAGE_SIZE);<br>
        parasite_size += ctl-&gt;args_size;<br>
<br>
        map_exchange_size = parasite_size;<br>
-       map_exchange_size += RESTORE_STACK_SIGFRAME + PARASITE_STACK_SIZE;<br>
+       map_exchange_size += RESTORE_STACK_SIGFRAME + COMPEL_PARASITE_STACK_SIZE;<br>
        if (nr_threads &gt; 1)<br>
-               map_exchange_size += PARASITE_STACK_SIZE;<br>
+               map_exchange_size += COMPEL_PARASITE_STACK_SIZE;<br>
<br>
        ret = compel_map_exchange(ctl, map_exchange_size);<br>
        if (ret)<br>
@@ -771,12 +800,22 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l<br>
<br>
        pr_info(&quot;Putting parasite blob into %p-&gt;%p\n&quot;, ctl-&gt;local_map, ctl-&gt;remote_map);<br>
<br>
+#if 0<br>
        if (compel_mode_native(ctl))<br>
                init_parasite_ctl(ctl, native);<br>
 #ifdef CONFIG_COMPAT<br>
        else<br>
                init_parasite_ctl(ctl, compat);<br>
 #endif<br>
+#endif<br>
+<br>
+       memcpy(ctl-&gt;local_map, d-&gt;blob, d-&gt;blob_size);<br>
+       ctl-&gt;parasite_ip        = d-&gt;get_parasite_ip(ctl-&gt;<wbr>remote_map);<br>
+       ctl-&gt;addr_cmd           = d-&gt;get_addr_cmd(ctl-&gt;local_<wbr>map);<br>
+       ctl-&gt;addr_args          = d-&gt;get_addr_args(ctl-&gt;local_<wbr>map);<br>
+<br>
+       pr_debug(&quot;Calling postproc action\n&quot;);<br>
+       d-&gt;postproc(ctl-&gt;local_map, ctl-&gt;remote_map);<br>
<br>
        p = parasite_size;<br>
<br>
@@ -784,11 +823,11 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l<br>
        ctl-&gt;sigframe   = ctl-&gt;local_map  + p;<br>
<br>
        p += RESTORE_STACK_SIGFRAME;<br>
-       p += PARASITE_STACK_SIZE;<br>
+       p += COMPEL_PARASITE_STACK_SIZE;<br>
        ctl-&gt;rstack = ctl-&gt;remote_map + p;<br>
<br>
        if (nr_threads &gt; 1) {<br>
-               p += PARASITE_STACK_SIZE;<br>
+               p += COMPEL_PARASITE_STACK_SIZE;<br>
                ctl-&gt;r_thread_stack = ctl-&gt;remote_map + p;<br>
        }<br>
<br>
@@ -820,7 +859,8 @@ struct parasite_ctl *compel_prepare(int pid)<br>
 {<br>
        struct parasite_ctl *ctl = NULL;<br>
<br>
-       if (!arch_can_dump_task(pid))<br>
+       if (!ptrace_task_compatible(pid))<br>
+//     if (!arch_can_dump_task(pid))<br>
                goto err;<br>
<br>
        /*<br>
@@ -895,7 +935,7 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)<br>
                return -1;<br>
        }<br>
<br>
-       ret = compel_rpc_call(PARASITE_CMD_<wbr>FINI, ctl);<br>
+       ret = compel_rpc_call(COMPEL_<wbr>PARASITE_CMD_FINI, ctl);<br>
        close_safe(&amp;ctl-&gt;tsock);<br>
        if (ret)<br>
                return -1;<br>
@@ -955,7 +995,7 @@ int compel_cure_remote(struct parasite_ctl *ctl)<br>
        if (ctl-&gt;addr_cmd) {<br>
                struct parasite_unmap_args *args;<br>
<br>
-               *ctl-&gt;addr_cmd = PARASITE_CMD_UNMAP;<br>
+               *ctl-&gt;addr_cmd = COMPEL_PARASITE_CMD_UNMAP;<br>
<br>
                args = compel_parasite_args(ctl, struct parasite_unmap_args);<br>
                args-&gt;parasite_start = (uintptr_t)ctl-&gt;remote_map;<br>
diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools<br>
index 60176cad56b2..fb5f91e8ee58 100644<br>
--- a/criu/Makefile.crtools<br>
+++ b/criu/Makefile.crtools<br>
@@ -3,8 +3,6 @@ ccflags-y               += -iquote criu/$(ARCH)<br>
 ccflags-y              += -I compel/include/uapi<br>
 ccflags-y              += -I compel/plugins/include/uapi<br>
<br>
-obj-y                  += infect.o<br>
-obj-y                  += infect-rpc.o<br>
 obj-y                  += action-scripts.o<br>
 obj-y                  += external.o<br>
 obj-y                  += aio.o<br>
diff --git a/criu/aio.c b/criu/aio.c<br>
index 011a1afcf135..8e33576fc150 100644<br>
--- a/criu/aio.c<br>
+++ b/criu/aio.c<br>
@@ -1,6 +1,9 @@<br>
 #include &lt;unistd.h&gt;<br>
 #include &lt;stdio.h&gt;<br>
 #include &lt;stdbool.h&gt;<br>
+<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;vma.h&quot;<br>
 #include &quot;xmalloc.h&quot;<br>
 #include &quot;pstree.h&quot;<br>
@@ -11,8 +14,6 @@<br>
 #include &quot;parasite.h&quot;<br>
 #include &quot;parasite-syscall.h&quot;<br>
 #include &quot;images/mm.pb-c.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
<br>
 #define NR_IOEVENTS_IN_NPAGES(npages) ((PAGE_SIZE * npages - sizeof(struct aio_ring)) / sizeof(struct io_event))<br>
<br>
diff --git a/criu/arch/aarch64/Makefile b/criu/arch/aarch64/Makefile<br>
index 6ae255a8aad9..652d4821bdfd 100644<br>
--- a/criu/arch/aarch64/Makefile<br>
+++ b/criu/arch/aarch64/Makefile<br>
@@ -5,4 +5,3 @@ ccflags-y               += -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include<br>
<br>
 obj-y                  += cpu.o<br>
 obj-y                  += crtools.o<br>
-obj-y                  += infect.o<br>
diff --git a/criu/arch/aarch64/crtools.c b/criu/arch/aarch64/crtools.c<br>
index d6b1b1344722..b4f87d5e7417 100644<br>
--- a/criu/arch/aarch64/crtools.c<br>
+++ b/criu/arch/aarch64/crtools.c<br>
@@ -19,14 +19,6 @@<br>
 #include &quot;cpu.h&quot;<br>
 #include &quot;parasite-syscall.h&quot;<br>
 #include &quot;restorer.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
-{<br>
-       regs-&gt;pc = new_ip;<br>
-       if (stack)<br>
-               regs-&gt;sp = (unsigned long)stack;<br>
-}<br>
<br>
 bool arch_can_dump_task(pid_t pid)<br>
 {<br>
diff --git a/criu/arch/aarch64/include/<wbr>asm/dump.h b/criu/arch/aarch64/include/<wbr>asm/dump.h<br>
index 8a966628900b..c53f67c3d487 100644<br>
--- a/criu/arch/aarch64/include/<wbr>asm/dump.h<br>
+++ b/criu/arch/aarch64/include/<wbr>asm/dump.h<br>
@@ -1,7 +1,9 @@<br>
 #ifndef __CR_ASM_DUMP_H__<br>
 #define __CR_ASM_DUMP_H__<br>
<br>
+typedef int (*save_regs_t)(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
 extern int save_task_regs(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
+extern int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t, void *);<br>
 extern int arch_alloc_thread_info(<wbr>CoreEntry *core);<br>
 extern void arch_free_thread_info(<wbr>CoreEntry *core);<br>
<br>
diff --git a/criu/arch/aarch64/include/<wbr>asm/parasite-syscall.h b/criu/arch/aarch64/include/<wbr>asm/parasite-syscall.h<br>
deleted file mode 100644<br>
index 4a370f605f57..000000000000<br>
--- a/criu/arch/aarch64/include/<wbr>asm/parasite-syscall.h<br>
+++ /dev/null<br>
@@ -1,8 +0,0 @@<br>
-#ifndef __CR_ASM_PARASITE_SYSCALL_H__<br>
-#define __CR_ASM_PARASITE_SYSCALL_H__<br>
-<br>
-struct parasite_ctl;<br>
-<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);<br>
-<br>
-#endif<br>
diff --git a/criu/arch/arm/Makefile b/criu/arch/arm/Makefile<br>
index 69de18e49585..5db577340a7d 100644<br>
--- a/criu/arch/arm/Makefile<br>
+++ b/criu/arch/arm/Makefile<br>
@@ -4,4 +4,3 @@ ccflags-y               += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include -iquote $<br>
<br>
 obj-y                  += cpu.o<br>
 obj-y                  += crtools.o<br>
-obj-y                  += infect.o<br>
diff --git a/criu/arch/arm/crtools.c b/criu/arch/arm/crtools.c<br>
index 84e759ad0a8d..10c1de0b50c0 100644<br>
--- a/criu/arch/arm/crtools.c<br>
+++ b/criu/arch/arm/crtools.c<br>
@@ -18,19 +18,7 @@<br>
 #include &quot;elf.h&quot;<br>
 #include &quot;parasite-syscall.h&quot;<br>
 #include &quot;restorer.h&quot;<br>
-#include &quot;errno.h&quot;<br>
 #include &quot;kerndat.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
-{<br>
-       regs-&gt;ARM_pc = new_ip;<br>
-       if (stack)<br>
-               regs-&gt;ARM_sp = (unsigned long)stack;<br>
-<br>
-       /* Make sure flags are in known state */<br>
-       regs-&gt;ARM_cpsr &amp;= PSR_f | PSR_s | PSR_x | MODE32_BIT;<br>
-}<br>
<br>
 bool arch_can_dump_task(pid_t pid)<br>
 {<br>
diff --git a/criu/arch/arm/include/asm/<wbr>dump.h b/criu/arch/arm/include/asm/<wbr>dump.h<br>
index f08e53843614..fa83b8267710 100644<br>
--- a/criu/arch/arm/include/asm/<wbr>dump.h<br>
+++ b/criu/arch/arm/include/asm/<wbr>dump.h<br>
@@ -1,7 +1,9 @@<br>
 #ifndef __CR_ASM_DUMP_H__<br>
 #define __CR_ASM_DUMP_H__<br>
<br>
+typedef int (*save_regs_t)(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
 extern int save_task_regs(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
+extern int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t, void *);<br>
 extern int arch_alloc_thread_info(<wbr>CoreEntry *core);<br>
 extern void arch_free_thread_info(<wbr>CoreEntry *core);<br>
<br>
diff --git a/criu/arch/arm/include/asm/<wbr>parasite-syscall.h b/criu/arch/arm/include/asm/<wbr>parasite-syscall.h<br>
deleted file mode 100644<br>
index 5c880fdaa9d5..000000000000<br>
--- a/criu/arch/arm/include/asm/<wbr>parasite-syscall.h<br>
+++ /dev/null<br>
@@ -1,6 +0,0 @@<br>
-#ifndef __CR_ASM_PARASITE_SYSCALL_H__<br>
-#define __CR_ASM_PARASITE_SYSCALL_H__<br>
-<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);<br>
-<br>
-#endif<br>
diff --git a/criu/arch/ppc64/Makefile b/criu/arch/ppc64/Makefile<br>
index 69de18e49585..5db577340a7d 100644<br>
--- a/criu/arch/ppc64/Makefile<br>
+++ b/criu/arch/ppc64/Makefile<br>
@@ -4,4 +4,3 @@ ccflags-y               += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include -iquote $<br>
<br>
 obj-y                  += cpu.o<br>
 obj-y                  += crtools.o<br>
-obj-y                  += infect.o<br>
diff --git a/criu/arch/ppc64/crtools.c b/criu/arch/ppc64/crtools.c<br>
index 3d19b783240a..c94b8771f46c 100644<br>
--- a/criu/arch/ppc64/crtools.c<br>
+++ b/criu/arch/ppc64/crtools.c<br>
@@ -18,26 +18,11 @@<br>
 #include &quot;log.h&quot;<br>
 #include &quot;util.h&quot;<br>
 #include &quot;cpu.h&quot;<br>
-#include &quot;errno.h&quot;<br>
-#include &quot;infect.h&quot;<br>
<br>
 #include &quot;protobuf.h&quot;<br>
 #include &quot;images/core.pb-c.h&quot;<br>
 #include &quot;images/creds.pb-c.h&quot;<br>
<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
-{<br>
-       /*<br>
-        * OpenPOWER ABI requires that r12 is set to the calling function addressi<br>
-        * to compute the TOC pointer.<br>
-        */<br>
-       regs-&gt;gpr[12] = new_ip;<br>
-       regs-&gt;nip = new_ip;<br>
-       if (stack)<br>
-               regs-&gt;gpr[1] = (unsigned long) stack;<br>
-       regs-&gt;trap = 0;<br>
-}<br>
-<br>
 bool arch_can_dump_task(pid_t pid)<br>
 {<br>
        return ptrace_task_compatible(pid);<br>
diff --git a/criu/arch/ppc64/include/asm/<wbr>dump.h b/criu/arch/ppc64/include/asm/<wbr>dump.h<br>
index 6439adafd8ca..0c88b7a56235 100644<br>
--- a/criu/arch/ppc64/include/asm/<wbr>dump.h<br>
+++ b/criu/arch/ppc64/include/asm/<wbr>dump.h<br>
@@ -1,7 +1,9 @@<br>
 #ifndef __CR_ASM_DUMP_H__<br>
 #define __CR_ASM_DUMP_H__<br>
<br>
+typedef int (*save_regs_t)(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
 extern int save_task_regs(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
+extern int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t, void *);<br>
 extern int arch_alloc_thread_info(<wbr>CoreEntry *core);<br>
 extern void arch_free_thread_info(<wbr>CoreEntry *core);<br>
<br>
diff --git a/criu/arch/ppc64/include/asm/<wbr>parasite-syscall.h b/criu/arch/ppc64/include/asm/<wbr>parasite-syscall.h<br>
deleted file mode 100644<br>
index 4a370f605f57..000000000000<br>
--- a/criu/arch/ppc64/include/asm/<wbr>parasite-syscall.h<br>
+++ /dev/null<br>
@@ -1,8 +0,0 @@<br>
-#ifndef __CR_ASM_PARASITE_SYSCALL_H__<br>
-#define __CR_ASM_PARASITE_SYSCALL_H__<br>
-<br>
-struct parasite_ctl;<br>
-<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);<br>
-<br>
-#endif<br>
diff --git a/criu/arch/ppc64/infect.c b/criu/arch/ppc64/infect.c<br>
deleted file mode 100644<br>
index 201307be1705..000000000000<br>
--- a/criu/arch/ppc64/infect.c<br>
+++ /dev/null<br>
@@ -1,308 +0,0 @@<br>
-#include &lt;sys/ptrace.h&gt;<br>
-#include &lt;sys/types.h&gt;<br>
-#include &lt;sys/uio.h&gt;<br>
-#include &lt;errno.h&gt;<br>
-<br>
-#include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
-<br>
-#include &quot;asm/types.h&quot;<br>
-#include &quot;ptrace.h&quot;<br>
-#include &quot;parasite-syscall.h&quot;<br>
-#include &quot;errno.h&quot;<br>
-#include &quot;criu-log.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-#include &quot;infect-priv.h&quot;<br>
-<br>
-#ifndef NT_PPC_TM_SPR<br>
-#define NT_PPC_TM_CGPR  0x108           /* TM checkpointed GPR Registers */<br>
-#define NT_PPC_TM_CFPR  0x109           /* TM checkpointed FPR Registers */<br>
-#define NT_PPC_TM_CVMX  0x10a           /* TM checkpointed VMX Registers */<br>
-#define NT_PPC_TM_CVSX  0x10b           /* TM checkpointed VSX Registers */<br>
-#define NT_PPC_TM_SPR   0x10c           /* TM Special Purpose Registers */<br>
-#endif<br>
-<br>
-/* FIXME -- copied between crtools.c and infect.c */<br>
-#define MSR_TMA (1UL&lt;&lt;34)      /* bit 29 Trans Mem state: Transactional */<br>
-#define MSR_TMS (1UL&lt;&lt;33)      /* bit 30 Trans Mem state: Suspended */<br>
-#define MSR_TM  (1UL&lt;&lt;32)      /* bit 31 Trans Mem Available */<br>
-#define MSR_VEC (1UL&lt;&lt;25)<br>
-#define MSR_VSX (1UL&lt;&lt;23)<br>
-<br>
-#define MSR_TM_ACTIVE(x) ((((x) &amp; MSR_TM) &amp;&amp; ((x)&amp;(MSR_TMA|MSR_TMS))) != 0)<br>
-<br>
-/*<br>
- * Injected syscall instruction<br>
- */<br>
-const u32 code_syscall[] = {<br>
-       0x44000002,             /* sc           */<br>
-       0x0fe00000              /* twi 31,0,0   */<br>
-};<br>
-<br>
-static inline void __check_code_syscall(void)<br>
-{<br>
-       BUILD_BUG_ON(sizeof(code_<wbr>syscall) != BUILTIN_SYSCALL_SIZE);<br>
-       BUILD_BUG_ON(!is_log2(sizeof(<wbr>code_syscall)));<br>
-}<br>
-<br>
-/* This is the layout of the POWER7 VSX registers and the way they<br>
- * overlap with the existing FPR and VMX registers.<br>
- *<br>
- *                 VSR doubleword 0               VSR doubleword 1<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[0]  |             FPR[0]            |                              |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[1]  |             FPR[1]            |                              |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- *         |              ...              |                              |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[30] |             FPR[30]           |                              |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[31] |             FPR[31]           |                              |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[32] |                             VR[0]                            |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[33] |                             VR[1]                            |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- *         |                              ...                             |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[62] |                             VR[30]                           |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- * VSR[63] |                             VR[31]                           |<br>
- *         ------------------------------<wbr>------------------------------<wbr>----<br>
- *<br>
- * PTRACE_GETFPREGS returns FPR[0..31] + FPSCR<br>
- * PTRACE_GETVRREGS returns VR[0..31] + VSCR + VRSAVE<br>
- * PTRACE_GETVSRREGS returns VSR[0..31]<br>
- *<br>
- * PTRACE_GETVSRREGS and PTRACE_GETFPREGS are required since we need<br>
- * to save FPSCR too.<br>
- *<br>
- * There 32 VSX double word registers to save since the 32 first VSX double<br>
- * word registers are saved through FPR[0..32] and the remaining registers<br>
- * are saved when saving the Altivec registers VR[0..32].<br>
- */<br>
-<br>
-static int get_fpu_regs(pid_t pid, user_fpregs_struct_t *fp)<br>
-{<br>
-       if (ptrace(PTRACE_GETFPREGS, pid, 0, (void *)&amp;fp-&gt;fpregs) &lt; 0) {<br>
-               pr_perror(&quot;Couldn&#39;t get floating-point registers&quot;);<br>
-               return -1;<br>
-       }<br>
-       fp-&gt;flags |= USER_FPREGS_FL_FP;<br>
-<br>
-       return 0;<br>
-}<br>
-<br>
-static int get_altivec_regs(pid_t pid, user_fpregs_struct_t *fp)<br>
-{<br>
-       if (ptrace(PTRACE_GETVRREGS, pid, 0, (void*)&amp;fp-&gt;vrregs) &lt; 0) {<br>
-               /* PTRACE_GETVRREGS returns EIO if Altivec is not supported.<br>
-                * This should not happen if msr_vec is set. */<br>
-               if (errno != EIO) {<br>
-                       pr_perror(&quot;Couldn&#39;t get Altivec registers&quot;);<br>
-                       return -1;<br>
-               }<br>
-               pr_debug(&quot;Altivec not supported\n&quot;);<br>
-       }<br>
-       else {<br>
-               pr_debug(&quot;Dumping Altivec registers\n&quot;);<br>
-               fp-&gt;flags |= USER_FPREGS_FL_ALTIVEC;<br>
-       }<br>
-       return 0;<br>
-}<br>
-<br>
-/*<br>
- * Since the FPR[0-31] is stored in the first double word of VSR[0-31] and<br>
- * FPR are saved through the FP state, there is no need to save the upper part<br>
- * of the first 32 VSX registers.<br>
- * Furthermore, the 32 last VSX registers are also the 32 Altivec registers<br>
- * already saved, so no need to save them.<br>
- * As a consequence, only the doubleword 1 of the 32 first VSX registers have<br>
- * to be saved (the ones are returned by PTRACE_GETVSRREGS).<br>
- */<br>
-static int get_vsx_regs(pid_t pid, user_fpregs_struct_t *fp)<br>
-{<br>
-       if (ptrace(PTRACE_GETVSRREGS, pid, 0, (void*)fp-&gt;vsxregs) &lt; 0) {<br>
-               /*<br>
-                * EIO is returned in the case PTRACE_GETVRREGS is not<br>
-                * supported.<br>
-                */<br>
-               if (errno != EIO) {<br>
-                       pr_perror(&quot;Couldn&#39;t get VSX registers&quot;);<br>
-                       return -1;<br>
-               }<br>
-               pr_debug(&quot;VSX register&#39;s dump not supported.\n&quot;);<br>
-       }<br>
-       else {<br>
-               pr_debug(&quot;Dumping VSX registers\n&quot;);<br>
-               fp-&gt;flags |= USER_FPREGS_FL_VSX;<br>
-       }<br>
-       return 0;<br>
-}<br>
-<br>
-static int get_tm_regs(pid_t pid, user_fpregs_struct_t *fpregs)<br>
-{<br>
-       struct iovec iov;<br>
-<br>
-       pr_debug(&quot;Dumping TM registers\n&quot;);<br>
-<br>
-#define TM_REQUIRED    0<br>
-#define TM_OPTIONAL    1<br>
-#define PTRACE_GET_TM(s,n,c,u) do {                                    \<br>
-       iov.iov_base = &amp;s;                                              \<br>
-       iov.iov_len = sizeof(s);                                        \<br>
-       if (ptrace(PTRACE_GETREGSET, pid, c, &amp;iov)) {                   \<br>
-               if (!u || errno != EIO) {                               \<br>
-                       pr_perror(&quot;Couldn&#39;t get TM &quot;n);                 \<br>
-                       pr_err(&quot;Your kernel seems to not support the &quot;  \<br>
-                              &quot;new TM ptrace API (&gt;= 4.8)\n&quot;);         \<br>
-                       goto out_free;                                  \<br>
-               }                                                       \<br>
-               pr_debug(&quot;TM &quot;n&quot; not supported.\n&quot;);                    \<br>
-               iov.iov_base = NULL;                                    \<br>
-       }                                                               \<br>
-} while(0)<br>
-<br>
-       /* Get special registers */<br>
-       PTRACE_GET_TM(fpregs-&gt;tm.tm_<wbr>spr_regs, &quot;SPR&quot;, NT_PPC_TM_SPR, TM_REQUIRED);<br>
-<br>
-       /* Get checkpointed regular registers */<br>
-       PTRACE_GET_TM(fpregs-&gt;tm.regs, &quot;GPR&quot;, NT_PPC_TM_CGPR, TM_REQUIRED);<br>
-<br>
-       /* Get checkpointed FP registers */<br>
-       PTRACE_GET_TM(fpregs-&gt;tm.<wbr>fpregs, &quot;FPR&quot;, NT_PPC_TM_CFPR, TM_OPTIONAL);<br>
-       if (iov.iov_base)<br>
-               fpregs-&gt;tm.flags |= USER_FPREGS_FL_FP;<br>
-<br>
-       /* Get checkpointed VMX (Altivec) registers */<br>
-       PTRACE_GET_TM(fpregs-&gt;tm.<wbr>vrregs, &quot;VMX&quot;, NT_PPC_TM_CVMX, TM_OPTIONAL);<br>
-       if (iov.iov_base)<br>
-               fpregs-&gt;tm.flags |= USER_FPREGS_FL_ALTIVEC;<br>
-<br>
-       /* Get checkpointed VSX registers */<br>
-       PTRACE_GET_TM(fpregs-&gt;tm.<wbr>vsxregs, &quot;VSX&quot;, NT_PPC_TM_CVSX, TM_OPTIONAL);<br>
-       if (iov.iov_base)<br>
-               fpregs-&gt;tm.flags |= USER_FPREGS_FL_VSX;<br>
-<br>
-       return 0;<br>
-<br>
-out_free:<br>
-       return -1;      /* still failing the checkpoint */<br>
-}<br>
-<br>
-static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,<br>
-                          user_fpregs_struct_t *fpregs)<br>
-{<br>
-       pr_info(&quot;Dumping GP/FPU registers for %d\n&quot;, pid);<br>
-<br>
-       /*<br>
-        * This is inspired by kernel function check_syscall_restart in<br>
-        * arch/powerpc/kernel/signal.c<br>
-        */<br>
-#ifndef TRAP<br>
-#define TRAP(r)              ((r).trap &amp; ~0xF)<br>
-#endif<br>
-<br>
-       if (TRAP(*regs) == 0x0C00 &amp;&amp; regs-&gt;ccr &amp; 0x10000000) {<br>
-               /* Restart the system call */<br>
-               switch (regs-&gt;gpr[3]) {<br>
-               case ERESTARTNOHAND:<br>
-               case ERESTARTSYS:<br>
-               case ERESTARTNOINTR:<br>
-                       regs-&gt;gpr[3] = regs-&gt;orig_gpr3;<br>
-                       regs-&gt;nip -= 4;<br>
-                       break;<br>
-               case ERESTART_RESTARTBLOCK:<br>
-                       regs-&gt;gpr[0] = __NR_restart_syscall;<br>
-                       regs-&gt;nip -= 4;<br>
-                       break;<br>
-               }<br>
-       }<br>
-<br>
-       /* Resetting trap since we are now coming from user space. */<br>
-       regs-&gt;trap = 0;<br>
-<br>
-       fpregs-&gt;flags = 0;<br>
-       /*<br>
-        * Check for Transactional Memory operation in progress.<br>
-        * Until we have support of TM register&#39;s state through the ptrace API,<br>
-        * we can&#39;t checkpoint process with TM operation in progress (almost<br>
-        * impossible) or suspended (easy to get).<br>
-        */<br>
-       if (MSR_TM_ACTIVE(regs-&gt;msr)) {<br>
-               pr_debug(&quot;Task %d has %s TM operation at 0x%lx\n&quot;,<br>
-                        pid,<br>
-                        (regs-&gt;msr &amp; MSR_TMS) ? &quot;a suspended&quot; : &quot;an active&quot;,<br>
-                        regs-&gt;nip);<br>
-               if (get_tm_regs(pid, fpregs))<br>
-                       return -1;<br>
-               fpregs-&gt;flags = USER_FPREGS_FL_TM;<br>
-       }<br>
-<br>
-       if (get_fpu_regs(pid, fpregs))<br>
-               return -1;<br>
-<br>
-       if (get_altivec_regs(pid, fpregs))<br>
-               return -1;<br>
-<br>
-       if (fpregs-&gt;flags &amp; USER_FPREGS_FL_ALTIVEC) {<br>
-               /*<br>
-                * Save the VSX registers if Altivec registers are supported<br>
-                */<br>
-               if (get_vsx_regs(pid, fpregs))<br>
-                       return -1;<br>
-       }<br>
-       return 0;<br>
-}<br>
-<br>
-int compel_get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *arg)<br>
-{<br>
-       user_fpregs_struct_t fpregs;<br>
-       int ret;<br>
-<br>
-       ret = __get_task_regs(pid, &amp;regs, &amp;fpregs);<br>
-       if (ret)<br>
-               return ret;<br>
-<br>
-       return save(arg, &amp;regs, &amp;fpregs);<br>
-}<br>
-<br>
-int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
-               unsigned long arg1,<br>
-               unsigned long arg2,<br>
-               unsigned long arg3,<br>
-               unsigned long arg4,<br>
-               unsigned long arg5,<br>
-               unsigned long arg6)<br>
-{<br>
-       user_regs_struct_t regs = ctl-&gt;orig.regs;<br>
-       int err;<br>
-<br>
-       regs.gpr[0] = (unsigned long)nr;<br>
-       regs.gpr[3] = arg1;<br>
-       regs.gpr[4] = arg2;<br>
-       regs.gpr[5] = arg3;<br>
-       regs.gpr[6] = arg4;<br>
-       regs.gpr[7] = arg5;<br>
-       regs.gpr[8] = arg6;<br>
-<br>
-       err = compel_execute_syscall(ctl, &amp;regs, (char*)code_syscall);<br>
-<br>
-       *ret = regs.gpr[3];<br>
-       return err;<br>
-}<br>
-<br>
-void *remote_mmap(struct parasite_ctl *ctl,<br>
-                 void *addr, size_t length, int prot,<br>
-                 int flags, int fd, off_t offset)<br>
-{<br>
-       unsigned long map = 0;<br>
-       int err;<br>
-<br>
-       err = compel_syscall(ctl, __NR_mmap, &amp;map,<br>
-                       (unsigned long)addr, length, prot, flags, fd, offset);<br>
-       if (err &lt; 0 || (long)map &lt; 0)<br>
-               map = 0;<br>
-<br>
-       return (void *)map;<br>
-}<br>
diff --git a/criu/arch/x86/Makefile b/criu/arch/x86/Makefile<br>
index c088b2dd47e4..fb8608211ab5 100644<br>
--- a/criu/arch/x86/Makefile<br>
+++ b/criu/arch/x86/Makefile<br>
@@ -8,7 +8,6 @@ asflags-y               += -iquote $(obj)/include<br>
<br>
 obj-y                  += cpu.o<br>
 obj-y                  += crtools.o<br>
-obj-y                  += infect.o<br>
 ifeq ($(CONFIG_COMPAT),y)<br>
         obj-y          += sigaction_compat.o<br>
         obj-y          += call32.o<br>
diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c<br>
index 952041d2428b..cf877cf2754e 100644<br>
--- a/criu/arch/x86/crtools.c<br>
+++ b/criu/arch/x86/crtools.c<br>
@@ -8,8 +8,10 @@<br>
<br>
 #include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
 #include &lt;compel/asm/processor-flags.h&gt;<br>
+#include &lt;compel/asm/fpu.h&gt;<br>
+#include &lt;compel/cpu.h&gt;<br>
+#include &lt;compel/compel.h&gt;<br>
<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
 #include &quot;asm/restorer.h&quot;<br>
 #include &quot;asm/types.h&quot;<br>
 #include &quot;asm/dump.h&quot;<br>
@@ -22,31 +24,12 @@<br>
 #include &quot;log.h&quot;<br>
 #include &quot;util.h&quot;<br>
 #include &quot;cpu.h&quot;<br>
-#include &quot;errno.h&quot;<br>
 #include &quot;kerndat.h&quot;<br>
-#include &quot;infect.h&quot;<br>
<br>
 #include &quot;protobuf.h&quot;<br>
 #include &quot;images/core.pb-c.h&quot;<br>
 #include &quot;images/creds.pb-c.h&quot;<br>
<br>
-/*<br>
- * regs must be inited when calling this function from original context<br>
- */<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)<br>
-{<br>
-       set_user_reg(regs, ip, new_ip);<br>
-       if (stack)<br>
-               set_user_reg(regs, sp, (unsigned long) stack);<br>
-<br>
-       /* Avoid end of syscall processing */<br>
-       set_user_reg(regs, orig_ax, -1);<br>
-<br>
-       /* Make sure flags are in known state */<br>
-       set_user_reg(regs, flags, get_user_reg(regs, flags) &amp;<br>
-                       ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF));<br>
-}<br>
-<br>
 #ifdef CONFIG_X86_64<br>
 /* Remaps 64-bit vDSO on the same addr, where it already is */<br>
 int kdat_compat_sigreturn_test(<wbr>void)<br>
diff --git a/criu/arch/x86/include/asm/<wbr>dump.h b/criu/arch/x86/include/asm/<wbr>dump.h<br>
index ca7cd675f21c..ac48a2fc96e7 100644<br>
--- a/criu/arch/x86/include/asm/<wbr>dump.h<br>
+++ b/criu/arch/x86/include/asm/<wbr>dump.h<br>
@@ -1,7 +1,9 @@<br>
 #ifndef __CR_ASM_DUMP_H__<br>
 #define __CR_ASM_DUMP_H__<br>
<br>
+typedef int (*save_regs_t)(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
 extern int save_task_regs(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
+extern int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t, void *);<br>
 extern int arch_alloc_thread_info(<wbr>CoreEntry *core);<br>
 extern void arch_free_thread_info(<wbr>CoreEntry *core);<br>
<br>
diff --git a/criu/arch/x86/include/asm/<wbr>parasite-syscall.h b/criu/arch/x86/include/asm/<wbr>parasite-syscall.h<br>
deleted file mode 100644<br>
index 769367d70a78..000000000000<br>
--- a/criu/arch/x86/include/asm/<wbr>parasite-syscall.h<br>
+++ /dev/null<br>
@@ -1,10 +0,0 @@<br>
-#ifndef __CR_ASM_PARASITE_SYSCALL_H__<br>
-#define __CR_ASM_PARASITE_SYSCALL_H__<br>
-<br>
-#include &quot;asm/types.h&quot;<br>
-<br>
-struct parasite_ctl;<br>
-<br>
-void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);<br>
-<br>
-#endif<br>
diff --git a/criu/arch/x86/sys-exec-tbl.c b/criu/arch/x86/sys-exec-tbl.c<br>
index 1051af06fe46..4667989ded60 100644<br>
--- a/criu/arch/x86/sys-exec-tbl.c<br>
+++ b/criu/arch/x86/sys-exec-tbl.c<br>
@@ -1,4 +1,4 @@<br>
-#include &quot;infect.h&quot;<br>
+//#include &quot;compel/infect.h&quot;<br>
<br>
 static struct syscall_exec_desc sc_exec_table_64[] = {<br>
 #include &quot;sys-exec-tbl-64.c&quot;<br>
diff --git a/criu/cr-exec.c b/criu/cr-exec.c<br>
index e7b3f058f1a4..b65b080a3331 100644<br>
--- a/criu/cr-exec.c<br>
+++ b/criu/cr-exec.c<br>
@@ -4,14 +4,11 @@<br>
 #include &quot;crtools.h&quot;<br>
 #include &quot;parasite-syscall.h&quot;<br>
 #include &quot;proc_parse.h&quot;<br>
-#include &quot;ptrace.h&quot;<br>
 #include &quot;pstree.h&quot;<br>
 #include &quot;vma.h&quot;<br>
 #include &quot;log.h&quot;<br>
 #include &quot;util.h&quot;<br>
 #include &quot;kerndat.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-#include &quot;infect-priv.h&quot;<br>
<br>
 struct syscall_exec_desc {<br>
        char *name;<br>
diff --git a/criu/cr-restore.c b/criu/cr-restore.c<br>
index 4a9a58f41df1..ac92270cf5b2 100644<br>
--- a/criu/cr-restore.c<br>
+++ b/criu/cr-restore.c<br>
@@ -76,7 +76,6 @@<br>
 #include &quot;file-lock.h&quot;<br>
 #include &quot;action-scripts.h&quot;<br>
 #include &quot;shmem.h&quot;<br>
-#include &quot;infect.h&quot;<br>
 #include &quot;aio.h&quot;<br>
 #include &quot;lsm.h&quot;<br>
 #include &quot;seccomp.h&quot;<br>
@@ -95,7 +94,6 @@<br>
 #include &quot;images/siginfo.pb-c.h&quot;<br>
<br>
 #include &quot;asm/restore.h&quot;<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
<br>
 #include &quot;cr-errno.h&quot;<br>
<br>
diff --git a/criu/include/errno.h b/criu/include/errno.h<br>
deleted file mode 100644<br>
index 5c2322e9fae9..000000000000<br>
--- a/criu/include/errno.h<br>
+++ /dev/null<br>
@@ -1,9 +0,0 @@<br>
-#ifndef __CR_ERRNO_H__<br>
-#define __CR_ERRNO_H__<br>
-<br>
-#define ERESTARTSYS            512<br>
-#define ERESTARTNOINTR         513<br>
-#define ERESTARTNOHAND         514<br>
-#define ERESTART_RESTARTBLOCK  516<br>
-<br>
-#endif /* __CR_ERRNO_H__ */<br>
diff --git a/criu/include/infect-rpc.h b/criu/include/infect-rpc.h<br>
deleted file mode 100644<br>
index fd03a096721a..000000000000<br>
--- a/criu/include/infect-rpc.h<br>
+++ /dev/null<br>
@@ -1,20 +0,0 @@<br>
-#ifndef __COMPEL_INFECT_RPC_H__<br>
-#define __COMPEL_INFECT_RPC_H__<br>
-extern int compel_rpc_sync(unsigned int cmd, struct parasite_ctl *ctl);<br>
-extern int compel_rpc_call(unsigned int cmd, struct parasite_ctl *ctl);<br>
-extern int compel_rpc_call_sync(unsigned int cmd, struct parasite_ctl *ctl);<br>
-extern int compel_rpc_sock(struct parasite_ctl *ctl);<br>
-<br>
-struct ctl_msg {<br>
-       u32     cmd;                    /* command itself */<br>
-       u32     ack;                    /* ack on command */<br>
-       s32     err;                    /* error code on reply */<br>
-};<br>
-<br>
-#define ctl_msg_cmd(_cmd)              \<br>
-       (struct ctl_msg){.cmd = _cmd, }<br>
-<br>
-#define ctl_msg_ack(_cmd, _err)        \<br>
-       (struct ctl_msg){.cmd = _cmd, .ack = _cmd, .err = _err, }<br>
-<br>
-#endif<br>
diff --git a/criu/include/infect.h b/criu/include/infect.h<br>
deleted file mode 100644<br>
index 197540cf344b..000000000000<br>
--- a/criu/include/infect.h<br>
+++ /dev/null<br>
@@ -1,108 +0,0 @@<br>
-#ifndef __COMPEL_INFECT_H__<br>
-#define __COMPEL_INFECT_H__<br>
-extern int compel_stop_task(int pid);<br>
-<br>
-struct seize_task_status {<br>
-       char                    state;<br>
-       int                     ppid;<br>
-       unsigned long long      sigpnd;<br>
-       unsigned long long      shdpnd;<br>
-       int                     seccomp_mode;<br>
-};<br>
-<br>
-extern int compel_wait_task(int pid, int ppid,<br>
-               int (*get_status)(int pid, struct seize_task_status *),<br>
-               struct seize_task_status *st);<br>
-extern int compel_unseize_task(pid_t pid, int orig_state, int state);<br>
-<br>
-/*<br>
- * FIXME -- these should be mapped to pid.h&#39;s<br>
- */<br>
-<br>
-#define TASK_ALIVE             0x1<br>
-#define TASK_DEAD              0x2<br>
-#define TASK_STOPPED           0x3<br>
-#define TASK_ZOMBIE            0x6<br>
-<br>
-struct parasite_ctl;<br>
-struct thread_ctx;<br>
-<br>
-extern struct parasite_ctl *compel_prepare(int pid);<br>
-extern int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned long args_size);<br>
-extern int compel_prepare_thread(int pid, struct thread_ctx *ctx);<br>
-<br>
-extern int compel_stop_daemon(struct parasite_ctl *ctl);<br>
-extern int compel_cure_remote(struct parasite_ctl *ctl);<br>
-extern int compel_cure_local(struct parasite_ctl *ctl);<br>
-extern int compel_cure(struct parasite_ctl *ctl);<br>
-<br>
-#define PARASITE_ARG_SIZE_MIN  ( 1 &lt;&lt; 12)<br>
-<br>
-#define compel_parasite_args(ctl, type)                                        \<br>
-       ({                                                              \<br>
-               void *___ret;                                           \<br>
-               BUILD_BUG_ON(sizeof(type) &gt; PARASITE_ARG_SIZE_MIN);     \<br>
-               ___ret = compel_parasite_args_p(ctl);                   \<br>
-               ___ret;                                                 \<br>
-       })<br>
-<br>
-extern void *compel_parasite_args_p(struct parasite_ctl *ctl);<br>
-extern void *compel_parasite_args_s(struct parasite_ctl *ctl, int args_size);<br>
-<br>
-extern int compel_execute_syscall(struct parasite_ctl *ctl,<br>
-               user_regs_struct_t *regs, const char *code_syscall);<br>
-extern int compel_run_in_thread(pid_t pid, unsigned int cmd,<br>
-                                       struct parasite_ctl *ctl,<br>
-                                       struct thread_ctx *octx);<br>
-<br>
-/*<br>
- * The PTRACE_SYSCALL will trap task twice -- on<br>
- * enter into and on exit from syscall. If we trace<br>
- * a single task, we may skip half of all getregs<br>
- * calls -- on exit we don&#39;t need them.<br>
- */<br>
-enum trace_flags {<br>
-       TRACE_ALL,<br>
-       TRACE_ENTER,<br>
-       TRACE_EXIT,<br>
-};<br>
-<br>
-extern int compel_stop_on_syscall(int tasks, int sys_nr,<br>
-               int sys_nr_compat, enum trace_flags trace);<br>
-<br>
-extern int compel_stop_pie(pid_t pid, void *addr, enum trace_flags *tf, bool no_bp);<br>
-<br>
-extern int compel_unmap(struct parasite_ctl *ctl, unsigned long addr);<br>
-<br>
-extern int compel_mode_native(struct parasite_ctl *ctl);<br>
-<br>
-extern k_rtsigset_t *compel_task_sigmask(struct parasite_ctl *ctl);<br>
-<br>
-struct rt_sigframe;<br>
-<br>
-struct infect_ctx {<br>
-       int     *p_sock;<br>
-<br>
-       /*<br>
-        * Regs manipulation context.<br>
-        */<br>
-       int (*save_regs)(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
-       int (*make_sigframe)(void *, struct rt_sigframe *, struct rt_sigframe *, k_rtsigset_t *);<br>
-       void *regs_arg;<br>
-<br>
-       unsigned long           syscall_ip;                             /* entry point of infection */<br>
-       unsigned long           flags;                  /* fine-tune (e.g. faults) */<br>
-<br>
-       void (*child_handler)(int, siginfo_t *, void *);        /* hander for SIGCHLD deaths */<br>
-};<br>
-<br>
-extern struct infect_ctx *compel_infect_ctx(struct parasite_ctl *);<br>
-<br>
-#define INFECT_NO_MEMFD                0x1     /* don&#39;t use memfd() */<br>
-#define INFECT_FAIL_CONNECT    0x2     /* make parasite connect() fail */<br>
-#define INFECT_NO_BREAKPOINTS  0x4     /* no breakpoints in pie tracking */<br>
-<br>
-typedef int (*save_regs_t)(void *, user_regs_struct_t *, user_fpregs_struct_t *);<br>
-extern int compel_get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t, void *);<br>
-<br>
-#endif<br>
diff --git a/criu/include/parasite-<wbr>syscall.h b/criu/include/parasite-<wbr>syscall.h<br>
index e172789a0f15..ac39e375df7e 100644<br>
--- a/criu/include/parasite-<wbr>syscall.h<br>
+++ b/criu/include/parasite-<wbr>syscall.h<br>
@@ -22,11 +22,6 @@ struct pid;<br>
 struct parasite_dump_cgroup_args;<br>
 struct rt_sigframe;<br>
<br>
-struct thread_ctx {<br>
-       k_rtsigset_t            sigmask;<br>
-       user_regs_struct_t      regs;<br>
-};<br>
-<br>
 struct parasite_ctl;<br>
<br>
 extern int parasite_dump_sigacts_seized(<wbr>struct parasite_ctl *ctl, struct cr_imgset *cr_imgset);<br>
diff --git a/criu/include/parasite.h b/criu/include/parasite.h<br>
index f7daa095371f..e1f4ded8ec47 100644<br>
--- a/criu/include/parasite.h<br>
+++ b/criu/include/parasite.h<br>
@@ -1,9 +1,6 @@<br>
 #ifndef __CR_PARASITE_H__<br>
 #define __CR_PARASITE_H__<br>
<br>
-#define PARASITE_STACK_SIZE    (16 &lt;&lt; 10)<br>
-#define PARASITE_START_AREA_MIN        (4096)<br>
-<br>
 #define PARASITE_MAX_SIZE      (64 &lt;&lt; 10)<br>
<br>
 #ifndef __ASSEMBLY__<br>
@@ -13,6 +10,8 @@<br>
 #include &lt;time.h&gt;<br>
 #include &lt;signal.h&gt;<br>
<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;image.h&quot;<br>
 #include &quot;util-pie.h&quot;<br>
 #include &quot;lock.h&quot;<br>
@@ -28,17 +27,7 @@<br>
  * alternative type for compatible tasks in parasite-compat.h<br>
  */<br>
 enum {<br>
-       PARASITE_CMD_IDLE               = 0,<br>
-       PARASITE_CMD_ACK,<br>
-<br>
-       PARASITE_CMD_INIT_DAEMON,<br>
-       PARASITE_CMD_DUMP_THREAD,<br>
-       PARASITE_CMD_UNMAP,<br>
-<br>
-       /*<br>
-        * This must be greater than INITs.<br>
-        */<br>
-       PARASITE_CMD_FINI,<br>
+       PARASITE_CMD_DUMP_THREAD        = COMPEL_PARASITE_CMD_USR_BASE,<br>
<br>
        PARASITE_CMD_MPROTECT_VMAS,<br>
        PARASITE_CMD_DUMPPAGES,<br>
@@ -57,20 +46,6 @@ enum {<br>
        PARASITE_CMD_MAX,<br>
 };<br>
<br>
-struct parasite_init_args {<br>
-       s32                             h_addr_len;<br>
-       struct sockaddr_un              h_addr;<br>
-       s32                             log_level;<br>
-       u64                             sigreturn_addr;<br>
-       u64                             sigframe; /* pointer to sigframe */<br>
-       futex_t                         daemon_connected;<br>
-};<br>
-<br>
-struct parasite_unmap_args {<br>
-       u64             parasite_start;<br>
-       u64             parasite_len;<br>
-};<br>
-<br>
 struct parasite_vma_entry<br>
 {<br>
        u64             start;<br>
diff --git a/criu/include/proc_parse.h b/criu/include/proc_parse.h<br>
index cabd90b12ea0..38e79b43f6f1 100644<br>
--- a/criu/include/proc_parse.h<br>
+++ b/criu/include/proc_parse.h<br>
@@ -2,8 +2,10 @@<br>
 #define __CR_PROC_PARSE_H__<br>
<br>
 #include &lt;sys/types.h&gt;<br>
+<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;asm/types.h&quot;<br>
-#include &quot;infect.h&quot;<br>
 #include &quot;images/seccomp.pb-c.h&quot;<br>
<br>
 #define PROC_TASK_COMM_LEN     32<br>
diff --git a/criu/mem.c b/criu/mem.c<br>
index 248c6ef8986f..67f0d53403c2 100644<br>
--- a/criu/mem.c<br>
+++ b/criu/mem.c<br>
@@ -5,6 +5,8 @@<br>
 #include &lt;fcntl.h&gt;<br>
 #include &lt;sys/syscall.h&gt;<br>
<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;cr_options.h&quot;<br>
 #include &quot;servicefd.h&quot;<br>
 #include &quot;mem.h&quot;<br>
@@ -26,8 +28,6 @@<br>
 #include &quot;files-reg.h&quot;<br>
 #include &quot;pagemap-cache.h&quot;<br>
 #include &quot;fault-injection.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
<br>
 #include &quot;protobuf.h&quot;<br>
 #include &quot;images/pagemap.pb-c.h&quot;<br>
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c<br>
index c5bf365f902c..74d1e2c37c61 100644<br>
--- a/criu/parasite-syscall.c<br>
+++ b/criu/parasite-syscall.c<br>
@@ -5,6 +5,7 @@<br>
 #include &lt;sys/wait.h&gt;<br>
 #include &lt;sys/mman.h&gt;<br>
<br>
+#include &lt;compel/compel.h&gt;<br>
 #include &lt;compel/plugins/std/syscall-<wbr>codes.h&gt;<br>
 #include &lt;compel/asm/processor-flags.h&gt;<br>
<br>
@@ -18,6 +19,7 @@<br>
 #include &quot;imgset.h&quot;<br>
 #include &quot;ptrace.h&quot;<br>
 #include &quot;parasite-syscall.h&quot;<br>
+#include &quot;parasite-blob.h&quot;<br>
 #include &quot;parasite.h&quot;<br>
 #include &quot;crtools.h&quot;<br>
 #include &quot;namespaces.h&quot;<br>
@@ -36,14 +38,10 @@<br>
 #include &lt;stdlib.h&gt;<br>
 #include &lt;elf.h&gt;<br>
<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
 #include &quot;asm/dump.h&quot;<br>
 #include &quot;asm/restorer.h&quot;<br>
 #include &quot;pie/pie-relocs.h&quot;<br>
<br>
-#include &quot;infect.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
-<br>
 unsigned long get_exec_start(struct vm_area_list *vmas)<br>
 {<br>
        struct vma_area *vma_area;<br>
@@ -534,6 +532,26 @@ static int make_sigframe(void *arg, struct rt_sigframe *sf, struct rt_sigframe *<br>
        return construct_sigframe(sf, rtsf, bs, (CoreEntry *)arg);<br>
 }<br>
<br>
+static unsigned long get_parasite_ip(void *remote_map)<br>
+{<br>
+       return (unsigned long)parasite_sym(remote_map, native, __export_parasite_head_start);<br>
+}<br>
+<br>
+static unsigned int *get_addr_cmd(void *local_map)<br>
+{<br>
+       return parasite_sym(local_map, native, __export_parasite_cmd);<br>
+}<br>
+<br>
+static void *get_addr_args(void *local_map)<br>
+{<br>
+       return parasite_sym(local_map, native, __export_parasite_args);<br>
+}<br>
+<br>
+static void postproc(void *local_map, void *remote_map)<br>
+{<br>
+       ELF_RELOCS_APPLY(parasite_<wbr>native, local_map, remote_map);<br>
+}<br>
+<br>
 struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,<br>
                struct vm_area_list *vma_area_list)<br>
 {<br>
@@ -541,6 +559,8 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,<br>
        struct infect_ctx *ictx;<br>
        unsigned long p;<br>
<br>
+       parasite_blob_desc_t d;<br>
+<br>
        BUG_ON(item-&gt;threads[0].real != pid);<br>
<br>
        p = get_exec_start(vma_area_list);<br>
@@ -573,7 +593,15 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,<br>
        parasite_ensure_args_size(<wbr>dump_pages_args_size(vma_area_<wbr>list));<br>
        parasite_ensure_args_size(aio_<wbr>rings_args_size(vma_area_list)<wbr>);<br>
<br>
-       if (compel_infect(ctl, item-&gt;nr_threads, parasite_args_size) &lt; 0) {<br>
+       d.blob                  = (void *)parasite_native_blob;<br>
+       d.blob_size             = sizeof(parasite_native_blob);<br>
+       d.pie_size              = pie_size(parasite_native);<br>
+       d.get_parasite_ip       = get_parasite_ip;<br>
+       d.get_addr_cmd          = get_addr_cmd;<br>
+       d.get_addr_args         = get_addr_args;<br>
+       d.postproc              = postproc;<br>
+<br>
+       if (compel_infect(ctl, &amp;d, item-&gt;nr_threads, parasite_args_size) &lt; 0) {<br>
                compel_cure(ctl);<br>
                return NULL;<br>
        }<br>
diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c<br>
index 48ce705b9d49..3722050c0a31 100644<br>
--- a/criu/pie/parasite.c<br>
+++ b/criu/pie/parasite.c<br>
@@ -7,6 +7,7 @@<br>
 #include &lt;stdarg.h&gt;<br>
 #include &lt;sys/ioctl.h&gt;<br>
<br>
+#include &lt;compel/compel.h&gt;<br>
 #include &lt;compel/plugins/std/syscall.h&gt;<br>
<br>
 #include &quot;parasite.h&quot;<br>
@@ -18,7 +19,6 @@<br>
 #include &quot;log.h&quot;<br>
 #include &quot;tty.h&quot;<br>
 #include &quot;aio.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
<br>
 #include &quot;asm/types.h&quot;<br>
 #include &quot;asm/parasite.h&quot;<br>
@@ -643,7 +643,7 @@ static noinline __used int noinline parasite_daemon(void *args)<br>
        pr_debug(&quot;Running daemon thread leader\n&quot;);<br>
<br>
        /* Reply we&#39;re alive */<br>
-       if (__parasite_daemon_reply_ack(<wbr>PARASITE_CMD_INIT_DAEMON, 0))<br>
+       if (__parasite_daemon_reply_ack(<wbr>COMPEL_PARASITE_CMD_INIT_<wbr>DAEMON, 0))<br>
                goto out;<br>
<br>
        ret = 0;<br>
@@ -652,13 +652,13 @@ static noinline __used int noinline parasite_daemon(void *args)<br>
                if (__parasite_daemon_wait_msg(&amp;<wbr>m))<br>
                        break;<br>
<br>
-               if (ret &amp;&amp; m.cmd != PARASITE_CMD_FINI) {<br>
+               if (ret &amp;&amp; m.cmd != COMPEL_PARASITE_CMD_FINI) {<br>
                        pr_err(&quot;Command rejected\n&quot;);<br>
                        continue;<br>
                }<br>
<br>
                switch (m.cmd) {<br>
-               case PARASITE_CMD_FINI:<br>
+               case COMPEL_PARASITE_CMD_FINI:<br>
                        goto out;<br>
                case PARASITE_CMD_DUMPPAGES:<br>
                        ret = dump_pages(args);<br>
@@ -785,9 +785,9 @@ int __used __parasite_entry parasite_service(unsigned int cmd, void *args)<br>
        switch (cmd) {<br>
        case PARASITE_CMD_DUMP_THREAD:<br>
                return dump_thread(args);<br>
-       case PARASITE_CMD_INIT_DAEMON:<br>
+       case COMPEL_PARASITE_CMD_INIT_<wbr>DAEMON:<br>
                return parasite_init_daemon(args);<br>
-       case PARASITE_CMD_UNMAP:<br>
+       case COMPEL_PARASITE_CMD_UNMAP:<br>
                return unmap_itself(args);<br>
        }<br>
<br>
diff --git a/criu/seize.c b/criu/seize.c<br>
index 638f7a3f4f12..837750a99e78 100644<br>
--- a/criu/seize.c<br>
+++ b/criu/seize.c<br>
@@ -9,6 +9,8 @@<br>
 #include &lt;sys/wait.h&gt;<br>
 #include &lt;time.h&gt;<br>
<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;compiler.h&quot;<br>
 #include &quot;cr_options.h&quot;<br>
 #include &quot;cr-errno.h&quot;<br>
@@ -19,7 +21,6 @@<br>
 #include &quot;stats.h&quot;<br>
 #include &quot;xmalloc.h&quot;<br>
 #include &quot;util.h&quot;<br>
-#include &quot;infect.h&quot;<br>
<br>
 #define NR_ATTEMPTS 5<br>
<br>
diff --git a/criu/vdso.c b/criu/vdso.c<br>
index 41df3c9b0e57..9ffb73d83591 100644<br>
--- a/criu/vdso.c<br>
+++ b/criu/vdso.c<br>
@@ -9,8 +9,9 @@<br>
 #include &lt;sys/stat.h&gt;<br>
 #include &lt;sys/mman.h&gt;<br>
<br>
+#include &lt;compel/compel.h&gt;<br>
+<br>
 #include &quot;asm/types.h&quot;<br>
-#include &quot;asm/parasite-syscall.h&quot;<br>
<br>
 #include &quot;parasite-syscall.h&quot;<br>
 #include &quot;parasite.h&quot;<br>
@@ -21,8 +22,6 @@<br>
 #include &quot;log.h&quot;<br>
 #include &quot;mem.h&quot;<br>
 #include &quot;vma.h&quot;<br>
-#include &quot;infect.h&quot;<br>
-#include &quot;infect-rpc.h&quot;<br>
<br>
 #ifdef LOG_PREFIX<br>
 # undef LOG_PREFIX<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
CRIU mailing list<br>
<a href="mailto:CRIU@openvz.org">CRIU@openvz.org</a><br>
<a href="https://lists.openvz.org/mailman/listinfo/criu" rel="noreferrer" target="_blank">https://lists.openvz.org/<wbr>mailman/listinfo/criu</a><br>
</font></span></blockquote></div><br></div>