[CRIU] [PATCH] Action scripts should be invoked with normal signal behavior

Andrei Vagin avagin at gmail.com
Wed Oct 30 10:08:21 MSK 2019


Applied, thanks!

On Thu, Oct 24, 2019 at 07:39:39PM +0000, Nicolas Viennot wrote:
> Signal masks propagate through execve, so we need to clear them before
> invoking the action scripts as it may want to handle SIGCHLD, or SIGSEGV.
> 
> Signed-off-by: Nicolas Viennot <nicolas.viennot at twosigma.com>
> ---
>  criu/util.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/util.c b/criu/util.c
> index 0761ec04..9c0653ed 100644
> --- a/criu/util.c
> +++ b/criu/util.c
> @@ -558,7 +558,7 @@ int cr_system_userns(int in, int out, int err, char *cmd,
>  	sigemptyset(&blockmask);
>  	sigaddset(&blockmask, SIGCHLD);
>  	if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) == -1) {
> -		pr_perror("Can not set mask of blocked signals");
> +		pr_perror("Cannot set mask of blocked signals");
>  		return -1;
>  	}
>  
> @@ -567,6 +567,12 @@ int cr_system_userns(int in, int out, int err, char *cmd,
>  		pr_perror("fork() failed");
>  		goto out;
>  	} else if (pid == 0) {
> +		sigemptyset(&blockmask);
> +		if (sigprocmask(SIG_SETMASK, &blockmask, NULL) == -1) {
> +			pr_perror("Cannot clear blocked signals");
> +			goto out_chld;
> +		}
> +
>  		if (userns_pid > 0) {
>  			if (switch_ns(userns_pid, &user_ns_desc, NULL))
>  				goto out_chld;
> -- 
> 2.19.1
> 
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list