mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
parasite-syscall: describe task's state on trap failure
I think we can improve error messages to distinguish task's kills from segfaults from ptrace failures & etc. Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
f6cc277cad
commit
7171f7f45d
1 changed files with 22 additions and 6 deletions
|
|
@ -932,6 +932,26 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool task_is_trapped(int status, pid_t pid)
|
||||
{
|
||||
if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP)
|
||||
return true;
|
||||
|
||||
pr_err("Task %d is in unexpected state: %x\n", pid, status);
|
||||
if (WIFEXITED(status))
|
||||
pr_err("Task exited with %d\n", WEXITSTATUS(status));
|
||||
if (WIFSIGNALED(status))
|
||||
pr_err("Task signaled with %d: %s\n",
|
||||
WTERMSIG(status), strsignal(WTERMSIG(status)));
|
||||
if (WIFSTOPPED(status))
|
||||
pr_err("Task stopped with %d: %s\n",
|
||||
WSTOPSIG(status), strsignal(WSTOPSIG(status)));
|
||||
if (WIFCONTINUED(status))
|
||||
pr_err("Task continued\n");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Trap tasks on the exit from the specified syscall
|
||||
*
|
||||
|
|
@ -955,10 +975,8 @@ int parasite_stop_on_syscall(int tasks, const int sys_nr, enum trace_flags trace
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!WIFSTOPPED(status) || WSTOPSIG(status) != SIGTRAP) {
|
||||
pr_err("Task is in unexpected state: %x\n", status);
|
||||
if (!task_is_trapped(status, pid))
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_debug("%d was trapped\n", pid);
|
||||
|
||||
|
|
@ -994,10 +1012,8 @@ int parasite_stop_on_syscall(int tasks, const int sys_nr, enum trace_flags trace
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!WIFSTOPPED(status) || WSTOPSIG(status) != SIGTRAP) {
|
||||
pr_err("Task is in unexpected state: %x\n", status);
|
||||
if (!task_is_trapped(status, pid))
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_debug("%d was stopped\n", pid);
|
||||
tasks--;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue