[CRIU] [PATCH v5 3/5] Try to include userfaultfd with criu (part 1)

Pavel Emelyanov xemul at virtuozzo.com
Fri Mar 11 07:25:52 PST 2016


On 03/11/2016 06:03 PM, Adrian Reber wrote:
> On Fri, Mar 11, 2016 at 04:08:10PM +0300, Pavel Emelyanov wrote:
>>
>>> +static void criu_init()
>>> +{
>>> +	/* TODO: return code checking */
>>> +	check_img_inventory();
>>> +	prepare_task_entries();
>>> +	prepare_pstree();
>>> +	collect_remaps_and_regfiles();
>>> +	prepare_shared_reg_files();
>>> +	prepare_remaps();
>>> +	prepare_mm_pid(root_item);
>>> +
>>> +	/* We found a PID */
>>> +	pr_debug("root_item->pid.virt %d\n", root_item->pid.virt);
>>> +	pr_debug("root_item->pid.real %d\n", root_item->pid.real);
>>> +}
>>
>> This portion should be really resolved before merging. All of the above
>> has nothing to do with the page_read, so please, find the reason for
>> page read engine non working due to absence of this. If you need help
>> with the code, just drop me an e-mail, I'll help.
> 
> I had a quick look, but need to look a bit in more detail.
> 
> If I leave away all those lines I get a segfault, I haven't checked yet
> but I think when accessing root_item->pid.virt.

Ah! Indeed. You open the page read for init task only. I believe the proper
fix would be to pass the pid of the process via socket you use to pass uffd.

Since we'll have to do it anyway in the future, I think this is worth doing
from the very beginning. And the lazy pages daemon should accept only one
such message (for you initial case).

> I tried a few combinations and it seems I can leave away:
> 
> prepare_remaps();
> 
> Leaving check_img_inventory() away I get:
> 
> (02.714381) Error (pstree.c:711): No kIDs provided, image corruption
> 
> without collect_remaps_and_regfiles() and/or prepare_shared_reg_files()
> I get:
> 
> (02.706343) Error (files-reg.c:1616): No entry for reg-file-ID 0x2
> 
> Leaving away the line prepare_mm_pid(); it seems to be working but
> the loop to detect which pages should be handled by userfaultfd does not
> work correctly. So it is needed somehow.
> 
> Only leaving the last three lines
> 
> prepare_shared_reg_files();
> prepare_remaps();
> prepare_mm_pid(root_item);
> 
> I also get a segfault accessing root_item->pid.virt. So I am not sure
> what and why is needed. I will look more in the next few days, but if
> you have an idea, that would be great. Thanks.
> 
> 		Adrian
> .
> 



More information about the CRIU mailing list