mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 12:57:57 +00:00
dump: Let task handle signals on seize
When seizing a task and waiting for it to stop, we can receive an event from kernel, that the task didn't stop, but caught a signal. Don't treat this as an error, let the victim handle it and proceed. The transition/fork test should work OK now. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
parent
1e98f53cca
commit
cb0eb0b31e
16
ptrace.c
16
ptrace.c
@ -70,7 +70,7 @@ int seize_task(pid_t pid, pid_t ppid)
|
||||
pid, ppid, ps.ppid);
|
||||
goto err;
|
||||
}
|
||||
|
||||
try_again:
|
||||
ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
|
||||
if (ret < 0) {
|
||||
pr_perror("SEIZE %d: can't interrupt task", pid);
|
||||
@ -100,11 +100,21 @@ int seize_task(pid_t pid, pid_t ppid)
|
||||
}
|
||||
|
||||
if ((si.si_code >> 8) != PTRACE_EVENT_STOP) {
|
||||
pr_err("SEIZE %d: wrong stop event received 0x%x\n", pid,
|
||||
(unsigned int)si.si_code);
|
||||
/*
|
||||
* Kernel notifies us about the task being seized received some
|
||||
* event other than the STOP, i.e. -- a signal. Let the task
|
||||
* handle one and repeat.
|
||||
*/
|
||||
|
||||
if (ptrace(PTRACE_CONT, pid, NULL,
|
||||
(void *)(unsigned long)si.si_signo)) {
|
||||
pr_perror("Can't continue signal handling. Aborting.");
|
||||
goto err;
|
||||
}
|
||||
|
||||
goto try_again;
|
||||
}
|
||||
|
||||
if (si.si_signo == SIGTRAP)
|
||||
return TASK_ALIVE;
|
||||
else if (si.si_signo == SIGSTOP)
|
||||
|
Loading…
x
Reference in New Issue
Block a user