[CRIU] [PATCH 08/10] restore: set up a handler for collecting signals from zombies

Pavel Emelyanov xemul at parallels.com
Thu Mar 14 12:15:08 EDT 2013


On 03/05/2013 06:54 PM, Andrey Vagin wrote:
> All pending signals are restored by another code.
> 
> Cc: Alexander Kartashov <alekskartashov at parallels.com>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  arch/x86/include/asm/types.h |  2 ++
>  pie/restorer.c               | 21 +++++++++++++++++++++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
> index d33dfb5..2361a57 100644
> --- a/arch/x86/include/asm/types.h
> +++ b/arch/x86/include/asm/types.h
> @@ -103,6 +103,8 @@ typedef struct {
>  	rt_sigset_t	rt_sa_mask;
>  } rt_sigaction_t;
>  
> +#define SA_RESTORER     0x04000000
> +
>  #define _KNSIG           64
>  # define _NSIG_BPW      64
>  
> diff --git a/pie/restorer.c b/pie/restorer.c
> index d88fc7b..9f04f1b 100644
> --- a/pie/restorer.c
> +++ b/pie/restorer.c
> @@ -11,6 +11,7 @@
>  #include <unistd.h>
>  #include <sched.h>
>  #include <sys/resource.h>
> +#include <signal.h>
>  
>  #include "compiler.h"
>  #include "asm/types.h"
> @@ -39,6 +40,20 @@
>  static struct task_entries *task_entries;
>  static futex_t thread_inprogress;
>  
> +asm (								\
> +	"nop\n"							\
> +	".align 16\n"						\
> +	"__cr_restore_rt:\n"					\
> +	"       movq $"__stringify(__NR_rt_sigreturn)", %rax\n"	\
> +	"       syscall"					\
> +);
> +extern void cr_restore_rt (void) asm ("__cr_restore_rt")
> +			__attribute__ ((visibility ("hidden")));
> +
> +static void sigzombie_handler(int signal, siginfo_t *siginfo, void *data)
> +{
> +}
> +
>  static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
>  {
>  	char *r;
> @@ -727,6 +742,12 @@ long __export_restore_task(struct task_restore_core_args *args)
>  
>  	restore_finish_stage(CR_STATE_RESTORE);
>  
> +	sys_sigaction(SIGCHLD, NULL, &act, sizeof(rt_sigset_t));

What is this "get" for?

> +	act.rt_sa_handler = sigzombie_handler;
> +	act.rt_sa_flags |= SA_SIGINFO;
> +	act.rt_sa_restorer = cr_restore_rt;
> +	sys_sigaction(SIGCHLD, &act, NULL, sizeof(rt_sigset_t));
> +
>  	sys_sigaction(SIGCHLD, &args->sigchld_act, NULL, sizeof(rt_sigset_t));
>  
>  	ret = restore_signals(args->siginfo, args->siginfo_nr, 1);
> 




More information about the CRIU mailing list