[CRIU] About re-parenting

Pavel Emelyanov xemul at parallels.com
Tue Mar 25 10:30:48 PDT 2014


On 03/25/2014 09:21 PM, Adrian Reber wrote:

>>> At the end it should look like this:
>>>
>>>     12 open-mpi-engine
>>>     13  `- my-openmpi-process
>>
>> Hm, but the pid of my-openmpi-process should be not generated, but
>> restored to the exact value it used to have, i.e. the tree should
>> look like
>>
>>      12 open-mpi-engine
>>      125  `- my-openmpi-process
> 
> Yes, of course. The PID should be the same as previously.
> 
>> I see. In other words the orte-restore should transform itself into the
>> process we want to restore, right?
> 
> Correct.

And this all means, that either the orte-restore should be created by
open-mpi-engine with the desired pid right from the very beginning,
or open-mpi-engine should fork criu, then criu forks my-process with the
pid it wants, then criu dies and my-process gets re-parented to the
open-mpi-engine, which is the subreaper case.

Since fork-with-pid can only work for root, and open-mpi-engine can
be run from any user, I think the only way we can go is

1. open-mpi-engine sets sub-reaper on himself
2. open-mpi-engine calls fork, then exec("criu", "restore", "--restore-detached");
3. criu (with suid bit) restores tasks and dies
4. tasks get reparented to sub-reaper, that is -- open-mpi-engine

If we ignore the fact, that fork-with-pid is likely to fail without
pid namespaces due to pids conflicts, would that be a working solution?

Thanks,
Pavel



More information about the CRIU mailing list