Commit cb0eb0b3 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

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: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 1e98f53c
...@@ -70,7 +70,7 @@ int seize_task(pid_t pid, pid_t ppid) ...@@ -70,7 +70,7 @@ int seize_task(pid_t pid, pid_t ppid)
pid, ppid, ps.ppid); pid, ppid, ps.ppid);
goto err; goto err;
} }
try_again:
ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL); ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
if (ret < 0) { if (ret < 0) {
pr_perror("SEIZE %d: can't interrupt task", pid); pr_perror("SEIZE %d: can't interrupt task", pid);
...@@ -100,9 +100,19 @@ int seize_task(pid_t pid, pid_t ppid) ...@@ -100,9 +100,19 @@ int seize_task(pid_t pid, pid_t ppid)
} }
if ((si.si_code >> 8) != PTRACE_EVENT_STOP) { 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
goto err; * 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) if (si.si_signo == SIGTRAP)
......
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