[CRIU] Re: [PATCH 14/16] parasite: To execute parasite blob we need prepare regs

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 14 05:49:44 EST 2012


On Tue, Feb 14, 2012 at 02:47:05PM +0400, Pavel Emelyanov wrote:
> > +static void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs)
> > +{
> > +	regs->ip = new_ip;
> > +
> > +	/* Avoid end of syscall processing */
> > +	regs->orig_ax = -1;
> > +
> > +	/* Make sure flags are in known state */
> > +	regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF);
> 
> Why these flags?
> 

The most important one is X86_EFLAGS_DF, we never knew what exatly the
program we're injecting to is doing with it, thus it's possible DF
will be cleaned and all ours "stos" instructions might be completely
broken. So better to be on safe side and clean it explicitly. The
two more flags just to be sure as well (not they really affect any
generated instruction, but just to be sure).

	Cyrill


More information about the CRIU mailing list