[CRIU] crash in pb_read_one?

Pavel Emelyanov xemul at parallels.com
Wed Sep 17 07:27:14 PDT 2014


On 09/17/2014 06:05 PM, Tycho Andersen wrote:
> Hi Pavel,
> 
> On Tue, Sep 16, 2014 at 02:50:09PM -0500, Tycho Andersen wrote:
>>
>> Yes, this is very sticky.
> 
> I think I've finally gotten it to a state where I understand
> everything about the synchronization. I am having problems using
> rst_mem_alloc and friends, though. The top two patches here are the
> ones that are causing problems:
> 
> https://github.com/tych0/criu/commits/missing-pid
> 
> The one that segfaults is (I think?) closer to the right way to do
> things, but the pointer in task_args is bad, so when we call
> wait_helpers it segfaults.

You misuse the rst-mem API. The proper usage is:

In CRIU:

	foo_pos = rst_mem_cpos(type);
	while (...) {
		foo = rst_mem_alloc(type, size);
		init_foo(foo);
	}

	/* after rst_mem_remap() */

	task_args->foo = rst_mem_remap_ptr(foo_pos, type);

In restorer blob:

	use_foo(task_args->foo);


In your patch you call rst_mem_remap_ptr not on _pos, but
on the allocated mem.

And one more thing -- the rst_mem_grow_last is not required for
the usage described, as you pin the beginning of your buffer
first (with the rst_mem_cpos()), then grow it.


> Any thoughts are much appreciated,
> 
> Tycho
> 



More information about the CRIU mailing list