[CRIU] [PATCH 8/8] zdtm: check that pid-reuse does not break iterative memory dump

Andrew Vagin avagin at virtuozzo.com
Wed Feb 14 21:00:21 MSK 2018


On Wed, Feb 14, 2018 at 02:36:58PM +0300, Pavel Tikhomirov wrote:
> > > +		wpid = waitpid(pid, &status, 0);
> > > +		if (wpid <= 0) {
> > > +			pr_perror("waitpid");
> > > +			return 1;
> > > +		}
> > > +
> > > +		if (!WIFEXITED(status)) {
> > > +			fail("Task %d didn't exit", wpid);
> > 
> > The process can be killed (WIFSIGNALED()) >
> > Pls, don't decode status, it is enough to check whether status is
> > zero of not.
> 
> These seem an undocumented behaviour to me, but it will work.

A lot of things are not documented, but they are parts of API by
historical reasons.

> 
> > 
> > 	if (status) {
> > 		fail("The task %d exited with %x", wpid, status);
> 
> From man: "WIFEXITED(wstatus) - returns true if the child terminated
> normally", meaning "exited" == "terminated". Also obviousely "terminated" !=
> "killed by signal". So, for the sake of clarity, we can't say "The task %d
> exited with %x" as it does not cover signals, but may be something like
> "Task %d died with exit status %x" will be sutable here.

For me, it doesn't matter how you call this. I want to have status in a
test log. Your original message doesn't contain it. It was only a
reason, why I left this comment ;)

I suggest to not deode status, because I want to minimize a test code. I
have seen this code a lot of time and I think it is useless. I want to
know about all non-zero status, and they all means errors.

> 
> > 		return 1;
> > 	}
> > 
> > > +			return 1;
> > > +		}
> > > +
> > > +		if (WEXITSTATUS(status) != 0) {
> > > +			fail("Task %d exited with wrong code %d", wpid, WEXITSTATUS(status));
> > > +			return 1;
> > > +		}
> > > +
> > > +		overwrite = false;
> > > +	}
> > > +	pass();
> > > +	return 0;
> > > +}
> 
> I sent v3 fixed version with fixes.


More information about the CRIU mailing list