[CRIU] [PATCH 8/8] zdtm: check that pid-reuse does not break iterative memory dump
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Wed Feb 14 14:36:58 MSK 2018
>> + 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.
>
> 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.
> 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