[CRIU] [PATCH 5/8] parasite: restore registers after each parasite command

Pavel Emelyanov xemul at parallels.com
Tue Jul 16 06:59:03 EDT 2013


On 07/16/2013 02:50 PM, Andrew Vagin wrote:
> On Tue, Jul 16, 2013 at 01:47:53PM +0400, Pavel Emelyanov wrote:
>> On 07/11/2013 01:46 PM, Andrey Vagin wrote:
>>> Currenly we can restore blocking signals with help ptrace,
>>> so if registers are restored after command, a process state
>>> will not be corrupted if criu crashes.
>>
>> This doesn't look symmetrical to sigblock restore in parasite_daemonize --
>> you restore the sigblock mask _after_ daemonize command (on err path),
>> but not the registers.
> 
> Sorry I don't understand what do you mean. Pls, look at this code and
> point a place. If a process can't be executed, sigmask and registers
> will be restored. Here are another order of setting and restoring regs
> and sigblock and maybe it's a reason why this looks wrong for you. I can
> fix that.
> 
> static int parasite_init_daemon(struct parasite_ctl *ctl)

There's no such call in crtools, neither you introduce it in this series.
I'm talking about parasite_daemonize() function, but I've already found
out an answer. The SETREGS is rolled back under if (ptrace(CONT)) branch,
not in the function roll-back ending. I expected to see it symmetrical.

> ...
>         if (ptrace(PTRACE_CONT, pid, NULL, NULL)) {
>                 pr_perror("Can't continue (pid: %d)\n", pid);
>                 goto err_mask;
>         }
> 
> ....
> 
> err_mask:
>         ptrace(PTRACE_SETSIGMASK, pid, sizeof(k_rtsigset_t),
>                                 &RT_SIGFRAME_UC(ctl->sigframe).uc_sigmask);
> err_regs:
>         ptrace(PTRACE_SETREGS, pid, NULL, ctl->regs_orig);
> err:
>         return -1;


More information about the CRIU mailing list