[CRIU] [PATCH 4/4] parasite: Do not get task regs twice on start

Dmitry Safonov 0x7f454c46 at gmail.com
Sun Oct 30 05:21:17 PDT 2016


2016-10-30 10:37 GMT+03:00 Pavel Emelyanov <xemul at virtuozzo.com>:
> First time regs are saved on ctl->orig.regs in parasite_prep_ctl,
> the 2nd time regs are got inside x86/arch_task_compatible, while
> it can use the on-ctl copy.

Reviewed-by: Dmitry Safonov <dsafonov at virtuozzo.com>

Yep, that perfectly makes sence. I remember, I also wanted to do
this, but by some reason I didn't want to move the check futher in
parasite_infect_seized().
Don't remember the reason -- will check it on Monday.

> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> ---
>  criu/arch/x86/crtools.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
> index f301679..7f8ab66 100644
> --- a/criu/arch/x86/crtools.c
> +++ b/criu/arch/x86/crtools.c
> @@ -95,16 +95,9 @@ int kdat_compat_sigreturn_test(void)
>  }
>  #endif /* CONFIG_X86_64 */
>
> -int ptrace_get_regs(pid_t pid, user_regs_struct_t *regs);
> -static int arch_task_compatible(pid_t pid)
> +static int arch_task_compatible(struct parasite_ctl *ctl)
>  {
> -       user_regs_struct_t r;
> -       int ret = ptrace_get_regs(pid, &r);
> -
> -       if (ret)
> -               return -1;
> -
> -       return !user_regs_native(&r);
> +       return !user_regs_native(&ctl->orig.regs);
>  }
>
>  #define USER32_CS      0x23
> @@ -133,7 +126,7 @@ bool arch_can_dump_task(struct parasite_ctl *ctl)
>         pid_t pid = ctl->rpid;
>         int ret;
>
> -       ret = arch_task_compatible(pid);
> +       ret = arch_task_compatible(ctl);
>         if (ret < 0)
>                 return false;
>
> --
> 2.5.0
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu



-- 
             Dmitry


More information about the CRIU mailing list