[CRIU] mount namespace in criu

Pavel Emelyanov xemul at parallels.com
Thu Jun 28 07:03:50 EDT 2012


On 06/27/2012 11:48 PM, Cyrill Gorcunov wrote:
> On Wed, Jun 27, 2012 at 09:01:45PM +0400, Pavel Emelyanov wrote:
>> Hi guys.
>>
>> An first step of the subj is on repo. All zdtms are passing OK. Only virtual proc
>> and sysfs filesystems are supported, no bindmounts for now and no fixes for
>> paths-vs-namespaceroot in the code. Just plain simple tree recreation.
>>
>> Andrey, there's a problem with our test_init in zdtm -- it uses system() call
>> to run make stop, but strictly speaking this doesn't work -- this test_init
>> stuff doesn't have any fds open (image is empty) and if on restore I explicitly
>> close them (we should do it) the system() just fails :(
>>
>> Let's discuss this tomorrow.
> 
> Huston, it seems we've a mem leaks here.
> 
> b5803455181b5f3b289834f6453c00c4bac5024c
> 
> @@ -603,18 +603,26 @@ static int parse_mountinfo_ent(char *str, struct proc_mountinfo *new)
>  	...
> -	ret = sscanf(str, "%31s %53s %63s", new->fstype, new->source, opt);
> +	ret = sscanf(str, "%ms %ms %ms", &new->fstype, &new->source, &opt);
>  	if (ret != 3)
>  		return -1;
>  
> +	new->options = xmalloc(strlen(opt));
> +	if (!new->options)
> 
> should not we have free(opt) here too? Not a big deal actually since
> we usually exit on error and OS does free this memory anyway ;)
> 
> +		return -1;
> +
>  	if (parse_sb_opt(opt, &new->flags, new->options))
>  		return -1;

And free new->options here ;) I don't consider xfree miss on error path which leads
to ap termination as critical.

> +	free(opt);
> +
> .
> 



More information about the CRIU mailing list