mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 20:42:49 +00:00
criu: check: don't leak the child if PTRACE_ATTACH fails
PS: never ever use PTRACE_KILL. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
5d9c83cf88
commit
40ae0fa35a
1 changed files with 7 additions and 4 deletions
11
cr-check.c
11
cr-check.c
|
|
@ -548,8 +548,11 @@ static int check_ptrace_peeksiginfo()
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1)
|
||||
return -1;
|
||||
if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) {
|
||||
pr_perror("Unable to ptrace the child");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
waitpid(pid, NULL, 0);
|
||||
|
||||
|
|
@ -567,8 +570,8 @@ static int check_ptrace_peeksiginfo()
|
|||
ret = -1;
|
||||
}
|
||||
|
||||
ptrace(PTRACE_KILL, pid, NULL, NULL);
|
||||
|
||||
out:
|
||||
kill(pid, SIGKILL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue