[CRIU] [PATCH 3/3] x86: use breakpoints instead of tracing syscalls

Andrew Vagin avagin at parallels.com
Wed Sep 17 07:25:54 PDT 2014


On Wed, Sep 17, 2014 at 05:07:14PM +0400, Pavel Emelyanov wrote:
> On 09/17/2014 12:10 PM, Andrey Vagin wrote:
> 
> > @@ -868,6 +869,12 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
> >  	if (ret)
> >  		return -1;
> >  
> > +	/* Go to sigreturn as closer as we can */
> > +	ret = parasite_stop_before_sigreturn(pid, ctl);
> > +	if (ret)
> > +		return ret;
> 
> Can we reshuffle the code, so that the one below doesn't even
> compile on x86?

This code is executed. I'm going to send you a new version, which
uses breakpoint to catch sigreturn in restorer too.

> 
> > +
> > +	/* Start tracing syscalls */
> >  	ret = ptrace(PTRACE_SYSCALL, pid, NULL, NULL);
> >  	if (ret) {
> >  		pr_perror("ptrace");
> > diff --git a/pie/parasite.c b/pie/parasite.c
> > index c30a7fb..bab67f8 100644
> > --- a/pie/parasite.c
> > +++ b/pie/parasite.c
> > @@ -438,6 +438,11 @@ static int __parasite_daemon_wait_msg(struct ctl_msg *m)
> >  	return -1;
> >  }
> >  
> > +static noinline void fini_sigreturn(unsigned long new_sp)
> > +{
> > +	ARCH_RT_SIGRETURN(new_sp);
> > +}
> > +
> >  static int fini()
> >  {
> >  	unsigned long new_sp;
> > @@ -454,7 +459,7 @@ static int fini()
> >  	sys_close(tsock);
> >  	log_set_fd(-1);
> >  
> > -	ARCH_RT_SIGRETURN(new_sp);
> > +	fini_sigreturn(new_sp);
> >  
> >  	BUG();
> >  
> > @@ -561,6 +566,7 @@ static noinline __used int parasite_init_daemon(void *data)
> >  	struct parasite_init_args *args = data;
> >  	int ret;
> >  
> > +	args->sigreturn_addr = fini_sigreturn;
> >  	sigframe = args->sigframe;
> >  
> >  	tsock = sys_socket(PF_UNIX, SOCK_SEQPACKET, 0);
> > 
> 


More information about the CRIU mailing list