[CRIU] [PATCH] parasite-syscall: Don't invert the sign of parasite return code

Cyrill Gorcunov gorcunov at openvz.org
Tue Nov 6 07:35:15 EST 2012


On Tue, Nov 06, 2012 at 04:25:49PM +0400, Cyrill Gorcunov wrote:
> On Tue, Nov 06, 2012 at 04:17:11PM +0400, Pavel Emelyanov wrote:
> > On 11/06/2012 04:10 PM, Cyrill Gorcunov wrote:
> > > This sneaked during parasite error handling code rework.
> > > When parasite returned negative error code we should not
> > > invert it.
> > > 
> > > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > > ---
> > >  parasite-syscall.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/parasite-syscall.c b/parasite-syscall.c
> > > index a60c84e..0675e2d 100644
> > > --- a/parasite-syscall.c
> > > +++ b/parasite-syscall.c
> > > @@ -225,7 +225,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
> > >  
> > >  	ret = __parasite_execute(ctl, pid, &regs);
> > >  	if (ret == 0)
> > > -		ret = -(int)regs.ax;
> > > +		ret = (int)regs.ax;
> > 
> > Every single caller of parasite_ececute() checks for ret to be less than zero for
> > error. Are they broken now, or will be broken after your patch?
> 
> They are broken as far as I can tell, but letme re-check prcisely.

yes, we need to merge this patch. without it not always the error is
tested properly

Test: zdtm/live/static/pty00
====================== ERROR ======================
Dump log   : /home/crtools/test/dump/pty00/3352/1/dump.log
(00.009291) Error (parasite-syscall.c:231): Parasite exited with 1
(00.009564) Error (parasite-syscall.c:231): Parasite exited with 1
Restore log: /home/crtools/test/dump/pty00/3352/1/restore.log
(00.003486)   3352: Error (tty.c:870): tty: Corrupted master peer 4
(00.003920) Error (cr-restore.c:643): 3352 exited, status=255
(00.003975) Error (cr-restore.c:926): Someone can't be restored

but with the fix we detect it well

Test: zdtm/live/static/pty00
====================== ERROR ======================
Dump log   : /home/crtools/test/dump/pty00/4208/1/dump.log
(00.008432) Error (parasite-syscall.c:231): Parasite exited with -1
(00.008459) Error (cr-dump.c:1563): Dump files (pid: 4208) failed with -1

(note it's not a real problem in tty test, I just injected error code there to
 check)


More information about the CRIU mailing list