[CRIU] [PATCH] compel: new catch and "release at" helpers added

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu Mar 16 04:43:04 PDT 2017


These helpers are compel_run_at split result. IOW, it's an asynchronious way
of calling some binary code in remote process and cathing it after it's done.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 compel/include/uapi/infect.h |    2 ++
 compel/src/lib/infect.c      |   14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h
index da0ca3a..aebb77c 100644
--- a/compel/include/uapi/infect.h
+++ b/compel/include/uapi/infect.h
@@ -66,6 +66,8 @@ extern int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
 		unsigned long arg6);
 extern int compel_run_in_thread(struct parasite_thread_ctl *tctl, unsigned int cmd);
 extern int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t *ret_regs);
+extern int compel_release_at(struct parasite_ctl *ctl, unsigned long ip);
+extern int compel_catch(struct parasite_ctl *ctl, user_regs_struct_t *ret_regs);
 
 /*
  * The PTRACE_SYSCALL will trap task twice -- on
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index c024250..a2cb5d6 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -581,6 +581,20 @@ int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t
 	return ret;
 }
 
+int compel_release_at(struct parasite_ctl *ctl, unsigned long ip)
+{
+	user_regs_struct_t regs = ctl->orig.regs;
+
+	return parasite_run(ctl->rpid, PTRACE_CONT, ip, 0, &regs, &ctl->orig);
+}
+
+int compel_catch(struct parasite_ctl *ctl, user_regs_struct_t *ret_regs)
+{
+	user_regs_struct_t regs;
+
+	return parasite_trap(ctl, ctl->rpid, ret_regs ? ret_regs : &regs, &ctl->orig);
+}
+
 static int accept_tsock(struct parasite_ctl *ctl)
 {
 	int sock;



More information about the CRIU mailing list