From: Stephane Eranian <eranian@hpl.hp.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Roland McGrath <roland@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
ak@suse.de, tony.luck@intel.com,
William Cohen <wcohen@redhat.com>
Subject: Re: debug registers and fork
Date: Thu, 01 Mar 2007 00:27:58 +0000 [thread overview]
Message-ID: <20070301002758.GF23543@frankl.hpl.hp.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0702281847330.24215-100000@netrider.rowland.org>
Alan,
On Wed, Feb 28, 2007 at 07:01:17PM -0500, Alan Stern wrote:
> On Wed, 28 Feb 2007, Roland McGrath wrote:
>
> > It is true that debug registers are inherited by fork and clone.
> > I am 99% sure that this was never specifically intended, but it
> > has been this way for a long time (since 2.4 at least). It's an
> > implicit consequence of the do_fork implementation style, which
> > does a blind copy of the whole task_struct and then explicitly
> > reinitializes some individual fields. I suppose this has some
> > benefit or other, but it is very prone to new pieces of state
> > getting implicitly copied without the person adding that new state
> > ever consciously deciding what its inheritance semantics should be.
> >
> > Alan Stern is working on a revamp of the x86 debug register
> > support. This is a fine opportunity to clean this area up and
> > decide positively what the semantics ought to be.
>
> Absolutely. Right now I just have a placeholder function with a note
> about checking for CLONE_PTRACE. The cleanest solution, far and away,
> would be to have the child process inherit no breakpoints and no debug
> register values.
>
I agree and that is how we have it on IA-64. With debugging, there is
always another process involved and no matter what I think it needs to
be aware of the new child. I don't think autoamtic inheritance is good.
It should always be trigger by the controlling process (e.g., debugger).
There is enough support in ptrace to catch the fork/vfork/pthread_create
and decide what to do. This is how I have coded perfmon so that hardware
performance counters are never automatically inherited.
--
-Stephane
next prev parent reply other threads:[~2007-03-01 0:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-26 23:51 debug registers and fork Stephane Eranian
2007-02-27 20:24 ` Andrew Morton
2007-02-28 21:25 ` Roland McGrath
2007-03-01 0:01 ` Alan Stern
2007-03-01 0:27 ` Stephane Eranian [this message]
2007-03-05 17:25 ` Andi Kleen
2007-03-05 20:05 ` Stephane Eranian
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=20070301002758.GF23543@frankl.hpl.hp.com \
--to=eranian@hpl.hp.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=stern@rowland.harvard.edu \
--cc=tony.luck@intel.com \
--cc=wcohen@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