[CRIU] custom initialization during restore

CRIU criu criuport at gmail.com
Tue Aug 11 11:12:45 PDT 2015


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!

-Lilo


On Tue, Aug 11, 2015 at 4:11 AM, Pavel Emelyanov <xemul at parallels.com>
wrote:

> On 08/10/2015 09:42 PM, CRIU criu wrote:
> > Can we also use the plugin to call a specific function in the target
> process?
>
> Sure.
>
> > If yes, does it have to be a fixed address or the plugin could be made
> aware of
> > the function address dynamically (linking?)
>
> Depends on how you write the plugin code. For ELF binaries it's
> typically possible to resolve a routine address by its name.
>
> If we're starting to talk about making criu communicate to the
> process it dumps/restores, I would go the other way -- I'd make
> a library (libcriume.so or smth like this) with which a binary
> can be linked. In this library there should be a pre-defined set
> of symbols that will be called/used by criu on dump/restore.
> IOW -- it will be a plugin to programs, not to criu itself.
>
> > On Thu, Jun 11, 2015 at 11:27 AM, CRIU criu <criuport at gmail.com <mailto:
> criuport at gmail.com>> wrote:
> >
> >     Thanks! Let me take a look.
> >
> >     On Thu, Jun 11, 2015 at 6:01 AM, Pavel Emelyanov <
> xemul at parallels.com <mailto:xemul at parallels.com>> wrote:
> >
> >         On 06/11/2015 05:06 AM, CRIU criu wrote:
> >         > Hi,
> >         >
> >         > How can I add custom initialization code to restorer before
> unmap and sigreturn?
> >         > I'm trying to checkpoint /restore a single Android process.
> For external dependencies, I
> >         > need to initialize Java objects collected as a part of memory
> dump by CRIU. The
> >         > initialization code involves making a bunch of syscalls. Can I
> do this by creating a
> >         > custom restorer blob or inside cr_restore_tasks() in
> cr-restore.c? Thanks!
> >
> >         Hm :) Nice request. Right now there's no such ability in CRIU
> and I don't
> >         see _easy_ solution. Complex solution can be plugin, that gets
> loaded into
> >         restorer blob and that's called at the very end of restorer, but
> this would
> >         require non-trivial preparation of the plugin itself. We've
> played with
> >         such things before, you can dig deep into the pie/ code and into
> the
> >         compel project (https://github.com/xemul/compel) for details :)
> >
> >         -- Pavel
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150811/b4b8f2ad/attachment-0001.html>


More information about the CRIU mailing list