public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Tim Bird <tim.bird@am.sony.com>
Cc: Roland McGrath <roland@redhat.com>,
	Denys Vlasenko <vda.linux@googlemail.com>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Questions about ptrace on a dying process
Date: Wed, 29 Feb 2012 19:50:56 +0100	[thread overview]
Message-ID: <20120229185056.GA11757@redhat.com> (raw)
In-Reply-To: <4F4E6915.1010209@am.sony.com>

On 02/29, Tim Bird wrote:
>
> ptrace maintainers (and interested parties)...
>
> I'm working on a crash handler for Linux, which uses ptrace to retrieve information
> about a process during it's coredump.  Specifically, from within a core handler
> program (started within do_coredump() as a user_mode_helper), I would like to make
> ptrace calls against the dying process.

Which calls? just curious.

> My problem is that the process state is not entering into TASK_TRACED, when
> I do an PTRACE_ATTACH against it.

Yes, it can never do ptrace_stop() in do_coredump() paths.

Perhaps you can use PTRACE_O_TRACEEXIT. PTRACE_EVENT_EXIT will be reported
after the coredumping. I think the core handler should close the pipe first,
otherwise the dumping tracee will wait for the handler forever.

However. You need PTRACE_SEIZE, not PTRACE_ATTACH. And this can only work
with the recent patch from Denys which allows to pass PTRACE_O_TRACEEXIT
with PTRACE_SEIZE (currently in -mm tree).

Just in case, it could have other threads sleeping in TASK_UNINTERRUPTIBLE
until do_coredump() completes. But these threads have already passed
ptrace_event(PTRACE_EVENT_EXIT).

Oleg.


  reply	other threads:[~2012-02-29 18:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 18:06 Questions about ptrace on a dying process Tim Bird
2012-02-29 18:50 ` Oleg Nesterov [this message]
2012-02-29 20:53   ` Tim Bird
2012-02-29 19:12 ` Andi Kleen
2012-02-29 20:45   ` Tim Bird
2012-03-01  7:12     ` Denys Vlasenko
2012-03-01 18:18       ` Tim Bird
2012-03-02  1:29         ` Denys Vlasenko
2012-03-01 18:30       ` Tim Bird
2012-03-01 19:02         ` Denys Vlasenko

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=20120229185056.GA11757@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=tim.bird@am.sony.com \
    --cc=vda.linux@googlemail.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