[CRIU] [PATCH 08/13] dump: Checkpoint per-thread blocked signals

Pavel Emelyanov xemul at parallels.com
Wed Nov 7 05:07:43 EST 2012


On 11/06/2012 08:53 PM, Cyrill Gorcunov wrote:
> 
> A small nit -- I had to move dump_thread helper
> a bit lower in parasite.c 'cause it's static,
> but at least it should be easier for review.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-dump.c                  |    4 +++-
>  include/parasite-syscall.h |    3 ++-
>  include/parasite.h         |    2 ++
>  parasite-syscall.c         |    5 ++++-
>  parasite.c                 |   34 +++++++++++++++++++++-------------
>  5 files changed, 32 insertions(+), 16 deletions(-)
> 
> @@ -101,6 +101,8 @@ struct parasite_dump_creds {
>  struct parasite_dump_thread {
>  	unsigned int		*tid_addr;
>  	pid_t			tid;
> +	pid_t			tid_real;

Same here -- thread can call gettid() himself. And it does this BTW.

> +	k_rtsigset_t		blocked;
>  };
>  
>  #define PARASITE_MAX_FDS	(PAGE_SIZE / sizeof(int))

> @@ -364,6 +351,27 @@ static struct tid_state_s *find_thread_state(pid_t tid)
>  	return NULL;
>  }
>  
> +static int dump_thread(struct parasite_dump_thread *args)

Why did you move this function?

> +{
> +	struct tid_state_s *s = find_thread_state(args->tid_real);

Don't init vars at declaration with function call.

> +	int ret;
> +
> +	if (!s)
> +		return -ENOENT;
> +
> +	ret = sys_prctl(PR_GET_TID_ADDRESS, (unsigned long) &args->tid_addr, 0, 0, 0);
> +	if (ret)
> +		return ret;
> +
> +	if (!s->use_sig_blocked)
> +		return -EINVAL;

This should be the first thing checked.

> +
> +	args->blocked = s->sig_blocked;
> +	args->tid = sys_gettid();
> +
> +	return 0;
> +}
> +
>  static int init_thread(struct parasite_thread_args *args)
>  {
>  	k_rtsigset_t to_block;


More information about the CRIU mailing list