public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	Project Archer <archer@sourceware.org>
Subject: Re: ptrace improvement ideas
Date: Tue, 08 Feb 2011 21:07:00 -0000	[thread overview]
Message-ID: <20110208205953.GA15932@redhat.com> (raw)
In-Reply-To: <20110208015844.B994A1814A4@magilla.sf.frob.com>

On 02/07, Roland McGrath wrote:
>
> > There is already AFAIK some abstraction of DR regiters inside kernel so maybe
> > userland could get access to this abstraction to resolve these two issues.
>
> Indeed, there is now a layer called hw_breakpoint, with in-kernel APIs that
> are largely machine-independent.  The legacy arch-specific ptrace interface
> for x86 is implemented on top of that (not purely so, but rather supported
> by that infrastructure as special cases).  I think Oleg knows the details
> of that stuff better than I do at this point.

Yes, and hw_breakpoint is implemented on top of perf counters.

> I think the desireable approach is to figure out a new interface (ptrace
> extension, presumably) to use those new facilities directly from user
> space.  It should be possible for such a new interface to be largely
> machine-independent too.

Probably yes... but it is not clear to me how exactly the new interface
should look. And it should coexist with the current ->ptrace_bps[] code.

And while register_user_hw_breakpoint() itself is arch independent, there
are still some details. Say, if the tracee traps, the tracer should know
somehow which bp was the reason.

But I agree it would be nice to have the simple "abstract" interface.
Jan, if you have any idea about how it should look - please tell us.
I _think_ that the actual implementation shoudn't be very very difficult,
although I can't say I understand this code in details.

> > It must explicitly require debug registers (hw watchpoints) inheritance.
> > Which happened before but it no longer happens in recent upstream kernels
> > (NOTABUG RH#660003).
>
> That is a good point and one I had not been thinking of,

Oh, yes, I missed this too.

> It's my feeling that the
> right way to approach this is to focus on a new set of interfaces built on
> the kernel's hw_breakpoint facility (that infrastructure may well need
> extending to deal well with userland better).  Those can be defined with
> the inheritance and process-wide sharing issues in mind,

Hmm. This is also not clear to me...

Oleg.

  parent reply	other threads:[~2011-02-08 21:07 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 22:39 Roland McGrath
2011-02-04 18:56 ` Oleg Nesterov
2011-02-04 18:58   ` Roland McGrath
2011-02-07 21:11 ` Jan Kratochvil
2011-02-08  1:58   ` Roland McGrath
2011-02-08 20:41     ` Jan Kratochvil
2011-02-09  2:48       ` Roland McGrath
2011-02-08 21:07     ` Oleg Nesterov [this message]
2011-02-08 23:18       ` hw_breakpoint userland interface Roland McGrath
2011-02-10 21:03         ` Oleg Nesterov
2011-02-10 21:14           ` Roland McGrath
2011-02-11 20:17             ` Oleg Nesterov
2011-02-10 20:00 ` ptrace improvement: PTRACE_O_INHERIT Oleg Nesterov
2011-02-11 19:24   ` Roland McGrath
2011-02-11 20:46     ` Oleg Nesterov
2011-02-12  0:59       ` Roland McGrath
2011-02-12 19:11         ` Oleg Nesterov
2011-02-14 19:31           ` Roland McGrath
2011-02-14 19:46             ` Oleg Nesterov
2011-02-15  0:36               ` Roland McGrath
2011-02-15 13:16                 ` Oleg Nesterov
2011-02-15 21:43                   ` Jan Kratochvil
2011-02-15 21:56                     ` Roland McGrath
2011-02-16 19:42                       ` Oleg Nesterov
2011-02-16 19:45                         ` Roland McGrath
2011-02-16 20:09                           ` Oleg Nesterov
2011-02-16 20:16                             ` Roland McGrath
2011-02-19 19:48                             ` Jan Kratochvil
2011-02-19 20:37                               ` Oleg Nesterov
2011-02-20  8:18                                 ` Jan Kratochvil
2011-02-20 21:05                                   ` Oleg Nesterov
2011-02-21 19:54                                 ` Roland McGrath
2011-02-22 19:39                                   ` Oleg Nesterov
2011-02-22 20:49                                     ` Roland McGrath
2011-02-22 21:10                                       ` Oleg Nesterov
2011-02-22 22:16                                         ` Roland McGrath
2011-02-21 19:44                               ` Roland McGrath
2011-02-15 22:02                     ` Roland McGrath
2011-02-16 16:02                       ` Jan Kratochvil
2011-02-16 18:28                         ` Roland McGrath
2011-02-16 20:00                           ` Oleg Nesterov
2011-02-16 20:07                             ` Roland McGrath
2011-02-16 20:32                               ` Oleg Nesterov
2011-02-16 19:48                       ` Oleg Nesterov
2011-02-16 20:02                         ` Roland McGrath
2011-02-16 20:15                           ` Oleg Nesterov
2011-02-16 20:31                             ` Roland McGrath
2011-02-16 21:04                               ` Oleg Nesterov
2011-02-16 21:51                                 ` Roland McGrath
2011-02-16 19:38                     ` Oleg Nesterov
2011-02-16 19:40                       ` Roland McGrath
2011-02-15 22:17                   ` Roland McGrath
2011-02-16 20:48                     ` Oleg Nesterov
2011-02-16 11:31 ` ptrace improvement ideas (QPassSignals) Jan Kratochvil
2011-02-16 18:36   ` Roland McGrath
2011-02-16 20:21     ` Oleg Nesterov
2011-02-18 20:24       ` 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=20110208205953.GA15932@redhat.com \
    --to=oleg@redhat.com \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=roland@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 read-only IMAP folder(s) and NNTP newsgroup(s).