[CRIU] [PATCH 2/2] ptrace: wait when queued SIGSTOP signals will be handled

Pavel Emelyanov xemul at parallels.com
Thu Nov 19 04:37:24 PST 2015


On 11/15/2015 03:08 PM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
> 
> SIGSTOP can't be blocked, so we need to wait when it will be handled.
> 
> Reported-by: Mr Jenkins
> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
>  ptrace.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/ptrace.c b/ptrace.c
> index b28824b..af85c05 100644
> --- a/ptrace.c
> +++ b/ptrace.c
> @@ -190,6 +190,29 @@ try_again:
>  		goto err;
>  	}
>  
> +	if (cr.sigpnd & (1 << (SIGSTOP - 1))) {

Can't we distinguish SIGSTOP-in-progress by using si.si_code from PTRACE_SIGINFO
or wait status from previous wait()?

> +		/*
> +		 * SIGSTOP can't be blocked, so we need
> +		 * to wait when it will be handled.
> +		 */
> +		pr_debug("SIGSTOP is queued\n");
> +
> +		ret = ptrace(PTRACE_CONT, pid, 0, 0);
> +		if (ret) {
> +			pr_perror("Unable to start process");
> +			goto err;
> +		}
> +
> +		ret = wait4(pid, &status, __WALL, NULL);
> +		if (ret) {
> +			pr_perror("Unable to wait %d", pid);
> +			goto err;
> +		}
> +
> +		(*creds)->state = 'T';
> +		return TASK_STOPPED;
> +	}
> +
>  	if (cr.seccomp_mode != SECCOMP_MODE_DISABLED && suspend_seccomp(pid) < 0)
>  		goto err;
>  
> 



More information about the CRIU mailing list