[Devel] [PATCH vz7-u5 v2 1/2] mount: restore_task_mnt_ns - Lookup for mount namespace conditionally

Andrey Vagin avagin at virtuozzo.com
Tue Jul 25 20:27:24 MSK 2017


On Sun, Jul 23, 2017 at 04:40:06PM +0300, Cyrill Gorcunov wrote:
> In case if our parent is a dead task (zombie) we should lookup
> for parent ids which will be inherited on restore. Otherwise
> parent->ids may be nil and SIGSEGV produced.
> 
> https://jira.sw.ru/browse/PSBM-68062
> 
> v2:
>  - make sure the ids is inherited if zombie met
>

Acked-by: Andrey Vagin <avagin at virtuozzo.com>

> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> ---
>  criu/mount.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index 2ec94b3..7acfed6 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -3069,6 +3069,7 @@ int restore_task_mnt_ns(struct pstree_item *current)
>  		return 0;
>  
>  	if (current->ids && current->ids->has_mnt_ns_id) {
> +		struct pstree_item *next = current->parent;
>  		unsigned int id = current->ids->mnt_ns_id;
>  		struct ns_id *nsid;
>  
> @@ -3081,8 +3082,14 @@ int restore_task_mnt_ns(struct pstree_item *current)
>  		 * already there, otherwise it will have to do
>  		 * setns().
>  		 */
> -		if (current->parent && id == current->parent->ids->mnt_ns_id)
> -			return 0;
> +		for (; next; next = next->parent) {
> +			if (!next->ids)
> +			       continue;
> +			if (id == next->ids->mnt_ns_id)
> +				return 0;
> +			else
> +				break;
> +		}
>  
>  		nsid = lookup_ns_by_id(id, &mnt_ns_desc);
>  		if (nsid == NULL) {
> -- 
> 2.7.5
> 


More information about the Devel mailing list