Commit 40ae0fa3 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

criu: check: don't leak the child if PTRACE_ATTACH fails

PS: never ever use PTRACE_KILL.
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5d9c83cf
...@@ -548,8 +548,11 @@ static int check_ptrace_peeksiginfo() ...@@ -548,8 +548,11 @@ static int check_ptrace_peeksiginfo()
exit(1); exit(1);
} }
if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) {
return -1; pr_perror("Unable to ptrace the child");
ret = -1;
goto out;
}
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
...@@ -567,8 +570,8 @@ static int check_ptrace_peeksiginfo() ...@@ -567,8 +570,8 @@ static int check_ptrace_peeksiginfo()
ret = -1; ret = -1;
} }
ptrace(PTRACE_KILL, pid, NULL, NULL); out:
kill(pid, SIGKILL);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment