<p dir="ltr">We actually need to update both lxc_conf->mount_list and lxc_conf->unexpanded_config to ensure that both are synchronized when we clone a container... Expanded patch will follow tonight or tomorrow...</p>
<p dir="ltr">On Oct 9, 2015 14:50, "Christian Brauner" <<a href="mailto:christianvanbrauner@gmail.com">christianvanbrauner@gmail.com</a>> wrote:<br>
><br>
> When using overlay and aufs mounts with lxc.mount.entry users have to specify<br>
> absolute paths for upperdir and workdir which will then get created<br>
> automatically by mount_entry_create_overlay_dirs() and<br>
> mount_entry_create_aufs_dirs() in conf.c. When we clone a container with<br>
> overlay or aufs lxc.mount.entry entries we need to update these absolute paths.<br>
> In order to do this we add the function update_union_mount_entry_paths() in<br>
> lxccontainer.c. The function operates on c->lxc_conf->unexpanded_config instead<br>
> of the intuitively plausible c->lxc_conf->mount_list because the latter also<br>
> contains mounts from other files as well as generic mounts.<br>
><br>
> NOTE: This function does not sanitize paths apart from removing trailing<br>
> slashes. (So when a user specifies //home//someone/// it will be cleaned to<br>
> //home//someone. This is the minimal path cleansing which is also done by<br>
> lxc_container_new().) But the mount_entry_create_overlay_dirs() and<br>
> mount_entry_create_aufs_dirs() functions both try to be extremely strict about<br>
> when to create upperdirs and workdirs. They will only accept sanitized paths,<br>
> i.e. they require /home/someone. I think this is a (safety) virtue and we<br>
> should consider sanitizing paths in general. In short:<br>
> update_union_mount_entry_paths() does update all absolute paths to the new<br>
> container but mount_entry_create_overlay_dirs() and<br>
> mount_entry_create_aufs_dirs() will still refuse to create upperdir and workdir<br>
> when the updated path is unclean. This happens easily when e.g. a user calls<br>
> lxc-clone -o OLD -n NEW -P //home//chb///.<br>
></p>
<p dir="ltr"><snip></p>