[CRIU] [PATCH 09/10] restore: Add restoration of alternative signal stack

Pavel Emelyanov xemul at parallels.com
Thu Jul 4 04:25:17 EDT 2013


On 07/04/2013 01:04 PM, Cyrill Gorcunov wrote:
> 
> [alekskartashov@: use RT_SIGFRAME_UC]
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> CC: Alexander Kartashov <alekskartashov at parallels.com>
> ---
>  cr-restore.c       |  7 +++++++
>  include/restorer.h |  3 +++
>  include/sigframe.h | 16 ++++++++++++++++
>  pie/restorer.c     |  9 +++++++++
>  sigframe.c         | 12 ++++++++++++
>  5 files changed, 47 insertions(+)
> 

> @@ -2153,6 +2153,13 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
>  	if (prepare_rlimits(pid, task_args))
>  		goto err;
>  
> +	if (core->thread_core->sas) {
> +		task_args->has_sas = true;
> +		task_args->sas = *core->thread_core->sas;

Can we avoid has_sas bool and reuse some sas's field invalid value for that?
E.g. ss_sp == NULL means no stack looks valid to me.

> +	} else {
> +		task_args->has_sas = false;
> +	}
> +
>  	/*
>  	 * Fill up per-thread data.
>  	 */




> @@ -31,5 +31,17 @@ int construct_sigframe(struct rt_sigframe *sigframe,
>  	if (restore_gpregs(sigframe, CORE_THREAD_ARCH_INFO(core)->gpregs))
>  		return -1;
>  
> +	/*
> +	 * On restore we have 2 ways for sas
> +	 * - either call for sigaltstack explicitly in restorer.c right before
> +	 *   we call for sigreturn
> +	 *
> +	 * - either pass stack value to sigreturn call and allow the kernel to
> +	 *   restore stack for us
> +	 *
> +	 * Second way looks more clean and simple, and here we go.
> +	 */

I asked this text in "patch comment", not "code comment". Please :)

> +	setup_sas(sigframe, core->thread_core->sas);
> +
>  	return 0;
>  }


More information about the CRIU mailing list