[CRIU] [PATCH 2/2] restore: compare whole k_rtsigset on inherite check

Christopher Covington cov at codeaurora.org
Tue Jun 21 05:15:26 PDT 2016


On 06/21/2016 07:41 AM, Dmitry Safonov wrote:
> k_rtsigset_t has two words on ARM32.
> That for-cycle should be optimized to no-op on other archs by compiler
> where _KNSIG_WORDS is 1.
> 
> So, if a child blocks the signal which number is > 32 in this mask,
> and other signals properties are the same - it will not have it blocked
> after C/R.
> 
> Impact: fix for signals restoring on ARM32.
> 
> Cc: Christopher Covington <cov at codeaurora.org>
> Cc: Cyrill Gorcunov <gorcunov at openvz.org>
> Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>

Reviewed-by: Christopher Covington <cov at codeaurora.org>

>  criu/cr-restore.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 2d22f9988a4e..d390ea365abc 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -279,15 +279,20 @@ static rt_sigaction_t parent_act[SIGMAX];
>  static bool sa_inherited(int sig, rt_sigaction_t *sa)
>  {
>  	rt_sigaction_t *pa;
> +	int i;
>  
>  	if (current == root_item)
>  		return false; /* XXX -- inherit from CRIU? */
>  
>  	pa = &parent_act[sig];
> +
> +	for (i = 0; i < _KNSIG_WORDS; i++)
> +		if (pa->rt_sa_mask.sig[i] != sa->rt_sa_mask.sig[i])
> +			return false;
> +
>  	return pa->rt_sa_handler == sa->rt_sa_handler &&
>  		pa->rt_sa_flags == sa->rt_sa_flags &&
> -		pa->rt_sa_restorer == sa->rt_sa_restorer &&
> -		pa->rt_sa_mask.sig[0] == sa->rt_sa_mask.sig[0];
> +		pa->rt_sa_restorer == sa->rt_sa_restorer;
>  }
>  
>  /* Returns nr of prepared signals -- 1 in success, <= 0 on fault */
> 


-- 
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


More information about the CRIU mailing list