criu icon indicating copy to clipboard operation
criu copied to clipboard

Using Compel with PTRACE_TRACEME

Open abiabilesh opened this issue 3 years ago • 3 comments

Hello Team,

I have been using compel for my project lately & it ran fine as I just had to inject code during the runtime of the victim, basically at any convenient point of time post victim's execution. However, now I'm in a situation where I have to ptrace the victim, right from the beginning of its execution & at the same time do parasite injection during its runtime. Hence, I have no choice than to use PTRACE_TRACEME right before execve and use compel apis at runtime for injection. Since compel_stop_task uses PTRACE_SEIZE and PTRACE_INTERRUPT for stopping the application and for other things, it gives me a hard time to ptrace victim from beginning & do parasitic injection during runtime. I tried tweaking the code in infect.c of compel, but couldn't succeed as I am fully not aware of the compel code.

Is it possible to use compel in such cases?? Like having the victim being traced right from the beginning of its execution & use compel apis for code injection during runtime?? or am I missing some documentation that suggest how to use compel apis in such cases?? Kindly help me with is issue here.

Thanks in advance, Abilesh Sundarasamy

abiabilesh avatar Jul 26 '22 23:07 abiabilesh

cc @cyrillos

rppt avatar Jul 27 '22 10:07 rppt

Hi guys, Would somebody kindly comment on this, please fyi @rppt

abiabilesh avatar Jul 29 '22 13:07 abiabilesh

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Aug 29 '22 01:08 github-actions[bot]

@abiabilesh If I understand your problem correctly. You can detach your ptrace from task leaving it stopped by signal, then inject via compel which also uses ptrace and which also should be able to leave task stopped after it finished, then you can grab it back with ptrace by your main task...

See https://github.com/checkpoint-restore/criu/issues/1960#issuecomment-1220043721.

Snorch avatar Sep 27 '22 16:09 Snorch

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Oct 29 '22 00:10 github-actions[bot]