[CRIU] [PATCH] user_ns: Block SIGCHLD during namespaces generation

Kirill Tkhai ktkhai at virtuozzo.com
Sat Apr 1 06:03:45 PDT 2017


Ignore this.

On 01.04.2017 15:06, Kirill Tkhai wrote:
> We don't want asynchronous signal handler does wait()
> as we do that synchronous. So block the signal.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/namespaces.c |   21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/namespaces.c b/criu/namespaces.c
> index 6637abcb..2e8ad452 100644
> --- a/criu/namespaces.c
> +++ b/criu/namespaces.c
> @@ -2257,7 +2257,26 @@ static int create_user_ns_hierarhy_fn(void *in_arg)
>  static int create_user_ns_hierarhy(void)
>  {
>  	struct ns_arg arg = { .me = root_user_ns };
> -	return create_user_ns_hierarhy_fn(&arg);
> +	sigset_t blockmask, oldmask;
> +	int ret;
> +
> +	sigemptyset(&blockmask);
> +	sigaddset(&blockmask, SIGCHLD);
> +
> +	if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) == -1) {
> +		pr_perror("Can not set mask of blocked signals");
> +		return -1;
> +	}
> +
> +	if (create_user_ns_hierarhy_fn(&arg))
> +		ret = -1;
> +
> +	if (sigprocmask(SIG_SETMASK, &oldmask, NULL) == -1) {
> +		pr_perror("Can not unset mask of blocked signals");
> +		ret = -1;
> +	}
> +
> +	return ret;
>  }
>  
>  int prepare_namespace(struct pstree_item *item, unsigned long clone_flags)
> 


More information about the CRIU mailing list