linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Igor Zhbanov <i.zhbanov@omprussia.ru>
To: <linux-trace-devel@vger.kernel.org>, Oleg Nesterov <oleg@redhat.com>
Subject: Mutual debugging of 2 processes can stuck in unkillable stopped state
Date: Mon, 29 Mar 2021 18:28:19 +0300	[thread overview]
Message-ID: <f2f32ffa-52ad-ff67-19d8-95305a70a6f8@omprussia.ru> (raw)

Mutual debugging of 2 processes can stuck in unkillable stopped state

Hi!

When one process, let's say "A", is tracing the another process "B", and the
process "B" is trying to attach to the process "A", then both of them are
getting stuck in the "t+" state. And they are ignoring all of the signals
including the SIGKILL, so it is not possible to terminate them without
a reboot.

To reproduce:
1) Run two terminals
2) Attach with "strace -p ..." from the first terminal to the shell (bash) of
    the second terminal.
3) In the second terminal run "exec strace -p ..." to attach to the PID of the
    first strace.

Then you'll see that the second strace is hanging without any output. And the
first strace will output following and hang too:
ptrace(PTRACE_SEIZE, 11795, NULL,
        PTRACE_O_TRACESYSGOOD|PTRACE_O_TRACEEXEC|PTRACE_O_TRACEEXIT

(The 11795 is the PID of the first strace itself.)

And in the process list you will see following:
ps awux | grep strace
user   11776  0.0  0.0  24752  2248 pts/3    t+   13:53   0:00 strace -p 11795
user   11795  0.0  0.0  24752  3888 pts/1    t+   13:54   0:00 strace -p 11776

I suppose that there should be some way to break the deadlocked debug. And the
system administrator must be able to terminate non-privileged processes.

Thank you.

             reply	other threads:[~2021-03-29 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 15:28 Igor Zhbanov [this message]
2021-03-29 16:49 ` Mutual debugging of 2 processes can stuck in unkillable stopped state Oleg Nesterov
2021-03-29 17:01   ` Igor Zhbanov
2021-03-29 17:38     ` Oleg Nesterov
2021-03-29 17:44       ` Igor Zhbanov
2021-04-12  7:25         ` Igor Zhbanov
2021-04-13 17:17           ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2f32ffa-52ad-ff67-19d8-95305a70a6f8@omprussia.ru \
    --to=i.zhbanov@omprussia.ru \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).