[CRIU] [PATCH 06/14] crtools: restore pending signals (v4)
Andrew Vagin
avagin at parallels.com
Mon Mar 25 15:28:41 EDT 2013
On Mon, Mar 25, 2013 at 11:07:40PM +0400, Pavel Emelyanov wrote:
> > @@ -155,6 +155,37 @@ static void restore_rlims(struct task_restore_core_args *ta)
> > }
> > }
> >
> > +static int restore_signals(siginfo_t *ptr, int nr, int group)
>
> bool group
ok
>
> > +{
> > + int ret, i;
> > + k_rtsigset_t to_block;
> > +
> > + ksigfillset(&to_block);
> > + ret = sys_sigprocmask(SIG_SETMASK, &to_block, NULL, sizeof(k_rtsigset_t));
> > + if (ret) {
> > + pr_err("Unable to block signals %d", ret);
> > + return -1;
> > + }
> > +
> > + for (i = 0; i < nr; i++) {
> > + siginfo_t *info = ptr + i;
> > +
> > + pr_info("Restore signal %d group %d\n", info->si_signo, group);
> > + if (group)
> > + ret = sys_rt_sigqueueinfo(sys_getpid(), info->si_signo, info);
> > + else
> > + ret = sys_rt_tgsigqueueinfo(sys_getpid(),
> > + sys_gettid(), info->si_signo, info);
> > + if (ret) {
> > + pr_err("Unable to send siginfo %d %x with code %d\n",
> > + info->si_signo, info->si_code, ret);
> > + return -1;;
> > + }
> > + }
> > +
> > + return 0;
> > +}
> > +
> > static int restore_thread_common(struct rt_sigframe *sigframe,
> > struct thread_restore_args *args)
> > {
> > @@ -210,8 +241,11 @@ long __export_restore_thread(struct thread_restore_args *args)
> > pr_info("%ld: Restored\n", sys_gettid());
> >
> > restore_finish_stage(CR_STATE_RESTORE);
> > - restore_finish_stage(CR_STATE_RESTORE_SIGCHLD);
> >
> > + if (restore_signals(args->siginfo, args->siginfo_nr, 0))
> > + goto core_restore_end;
>
> Why isn't it in restore_thread_common ?
The state should be CR_STATE_RESTORE_SIGCHLD, because restore_signals
blocks all siganls.
>
> > +
> > + restore_finish_stage(CR_STATE_RESTORE_SIGCHLD);
> > futex_dec_and_wake(&thread_inprogress);
> >
> > new_sp = (long)rt_sigframe + SIGFRAME_OFFSET;
More information about the CRIU
mailing list