<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="auto">
<div>Args are used to get function result<br>
<div class="gmail_extra"><br>
<div class="gmail_quote">5 дек. 2016 г. 10:53 PM пользователь Pavel Emelianov <xemul@virtuozzo.com> написал:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font size="2"><span style="font-size:10pt"></span></font>
<div>On 12/06/2016 12:15 AM, Cyrill Gorcunov wrote:<br>
> Simply run tracee from specfied IP assuming<br>
> it's arelady have trapping instruction in<br>
> stream.<br>
> <br>
> It's unsafe low-level function use with caution.<br>
> <br>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org><br>
> ---<br>
> compel/include/uapi/infect.h | 1 +<br>
> compel/src/lib/infect.c | 11 +++++++++++<br>
> 2 files changed, 12 insertions(+)<br>
> <br>
> diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h<br>
> index 174c197bba1c..7b88a5634c5e 100644<br>
> --- a/compel/include/uapi/infect.h<br>
> +++ b/compel/include/uapi/infect.h<br>
> @@ -73,6 +73,7 @@ extern int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret,<br>
> unsigned long arg5,<br>
> unsigned long arg6);<br>
> extern int compel_run_in_thread(struct parasite_thread_ctl *tctl, unsigned int cmd);<br>
> +extern int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t *ret_regs);<br>
> <br>
> /*<br>
> * The PTRACE_SYSCALL will trap task twice -- on<br>
> diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c<br>
> index fd92ee5d1da6..72cf20cdcba1 100644<br>
> --- a/compel/src/lib/infect.c<br>
> +++ b/compel/src/lib/infect.c<br>
> @@ -590,6 +590,17 @@ int compel_execute_syscall(struct parasite_ctl *ctl,<br>
> return err;<br>
> }<br>
> <br>
> +int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t *ret_regs)<br>
<br>
What's the use in ret_regs argument for a caller?<br>
<br>
> +{<!-- --><br>
> + user_regs_struct_t regs = ctl->orig.regs;<br>
> + int ret;<br>
> +<br>
> + ret = parasite_run(ctl->rpid, PTRACE_CONT, ip, 0, &regs, &ctl->orig);<br>
> + if (!ret)<br>
> + ret = parasite_trap(ctl, ctl->rpid, ret_regs ? ret_regs : &regs, &ctl->orig);<br>
> + return ret;<br>
> +}<br>
> +<br>
> static int accept_tsock(struct parasite_ctl *ctl)<br>
> {<!-- --><br>
> int sock;<br>
> <br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>