<div dir="ltr">Alright. Let's say we do "LD_PRELOAD=/lib/libcriume.so ./process_to_be_checkpointed arg1 arg2" with libcriume.so containing function pre_restore_plugin(). You are suggesting that criu code will parse ELF libcriume.so to get address of the symbol "pre_restore_plugin" and look at calculate the load address looking at /proc/<pid>/maps? Let me know if my understanding is correct. Thanks!<div><br></div><div>-Lilo<br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 11, 2015 at 4:11 AM, Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@parallels.com" target="_blank">xemul@parallels.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 08/10/2015 09:42 PM, CRIU criu wrote:<br>
> Can we also use the plugin to call a specific function in the target process?<br>
<br>
</span>Sure.<br>
<span class=""><br>
> If yes, does it have to be a fixed address or the plugin could be made aware of<br>
> the function address dynamically (linking?)<br>
<br>
</span>Depends on how you write the plugin code. For ELF binaries it's<br>
typically possible to resolve a routine address by its name.<br>
<br>
If we're starting to talk about making criu communicate to the<br>
process it dumps/restores, I would go the other way -- I'd make<br>
a library (libcriume.so or smth like this) with which a binary<br>
can be linked. In this library there should be a pre-defined set<br>
of symbols that will be called/used by criu on dump/restore.<br>
IOW -- it will be a plugin to programs, not to criu itself.<br>
<span class="im HOEnZb"><br>
> On Thu, Jun 11, 2015 at 11:27 AM, CRIU criu <<a href="mailto:criuport@gmail.com">criuport@gmail.com</a> <mailto:<a href="mailto:criuport@gmail.com">criuport@gmail.com</a>>> wrote:<br>
><br>
> Thanks! Let me take a look.<br>
><br>
</span><div class="HOEnZb"><div class="h5">> On Thu, Jun 11, 2015 at 6:01 AM, Pavel Emelyanov <<a href="mailto:xemul@parallels.com">xemul@parallels.com</a> <mailto:<a href="mailto:xemul@parallels.com">xemul@parallels.com</a>>> wrote:<br>
><br>
> On 06/11/2015 05:06 AM, CRIU criu wrote:<br>
> > Hi,<br>
> ><br>
> > How can I add custom initialization code to restorer before unmap and sigreturn?<br>
> > I'm trying to checkpoint /restore a single Android process. For external dependencies, I<br>
> > need to initialize Java objects collected as a part of memory dump by CRIU. The<br>
> > initialization code involves making a bunch of syscalls. Can I do this by creating a<br>
> > custom restorer blob or inside cr_restore_tasks() in cr-restore.c? Thanks!<br>
><br>
> Hm :) Nice request. Right now there's no such ability in CRIU and I don't<br>
> see _easy_ solution. Complex solution can be plugin, that gets loaded into<br>
> restorer blob and that's called at the very end of restorer, but this would<br>
> require non-trivial preparation of the plugin itself. We've played with<br>
> such things before, you can dig deep into the pie/ code and into the<br>
> compel project (<a href="https://github.com/xemul/compel" rel="noreferrer" target="_blank">https://github.com/xemul/compel</a>) for details :)<br>
><br>
> -- Pavel<br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>