restore: attach to threads of the root task in case of rst_sibling

In case of rst_sibling, we are tracing the root task, but we are tracing
only the leader thread, so we must attach to other threads to stop them.

Reported-by: Ross Boucher <rboucher@gmail.com>
Cc: Ross Boucher <rboucher@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Tested-by:  Ross Boucher <rboucher@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2015-04-23 14:23:00 +03:00 committed by Pavel Emelyanov
parent 02dff55113
commit 3364b10bbb

View file

@ -1582,7 +1582,7 @@ static int attach_to_tasks(bool root_seized, enum trace_flags *flag)
for (i = 0; i < item->nr_threads; i++) {
pid = item->threads[i].real;
if (item != root_item || !root_seized) {
if (item != root_item || !root_seized || i != 0) {
if (ptrace(PTRACE_ATTACH, pid, 0, 0)) {
pr_perror("Can't attach to %d", pid);
return -1;