2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

compel: Add compel_run_at helper

Simply run tracee from specfied IP assuming
it's arelady have trapping instruction in
stream.

It's unsafe low-level function use with caution.

travis-ci: success for compel: A fix and new helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov
2016-12-06 00:15:00 +03:00
committed by Andrei Vagin
parent d4c02f2eb1
commit 403c96ad17
2 changed files with 12 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ extern int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,
unsigned long arg5,
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);
/*
* The PTRACE_SYSCALL will trap task twice -- on

View File

@@ -590,6 +590,17 @@ int compel_execute_syscall(struct parasite_ctl *ctl,
return err;
}
int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t *ret_regs)
{
user_regs_struct_t regs = ctl->orig.regs;
int ret;
ret = parasite_run(ctl->rpid, PTRACE_CONT, ip, 0, &regs, &ctl->orig);
if (!ret)
ret = parasite_trap(ctl, ctl->rpid, ret_regs ? ret_regs : &regs, &ctl->orig);
return ret;
}
static int accept_tsock(struct parasite_ctl *ctl)
{
int sock;