mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
ptrace: Be more verbose on seize failure
The ptrace seize may fail for various reasons. E.g. -- no enough perms to get the ptrace access to the tasks, or various selinux restrictions. Print what exactly has happened when ptrace failed. Reported-by: Kevin Wilson <wkevils@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
7
ptrace.c
7
ptrace.c
@@ -48,10 +48,11 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
|
|||||||
{
|
{
|
||||||
siginfo_t si;
|
siginfo_t si;
|
||||||
int status;
|
int status;
|
||||||
int ret, ret2;
|
int ret, ret2, ptrace_errno;
|
||||||
struct proc_pid_stat_small ps;
|
struct proc_pid_stat_small ps;
|
||||||
|
|
||||||
ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
|
ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
|
||||||
|
ptrace_errno = errno;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's ugly, but the ptrace API doesn't allow to distinguish
|
* It's ugly, but the ptrace API doesn't allow to distinguish
|
||||||
@@ -71,8 +72,8 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
|
|||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ps.state != 'Z') {
|
if (ps.state != 'Z') {
|
||||||
pr_err("Unseizeable non-zombie %d found, state %c\n",
|
pr_err("Unseizeable non-zombie %d found, state %c, err %d/%d\n",
|
||||||
pid, ps.state);
|
pid, ps.state, ret, ptrace_errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user