From: Andi Kleen <ak@suse.de>
To: eranian@hpl.hp.com
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
akpm@linux-foundation.org, tony.luck@intel.com
Subject: Re: debug registers and fork
Date: Mon, 5 Mar 2007 18:25:16 +0100 [thread overview]
Message-ID: <200703051825.16473.ak@suse.de> (raw)
In-Reply-To: <20070226235154.GB19630@frankl.hpl.hp.com>
On Tuesday 27 February 2007 00:51, Stephane Eranian wrote:
> Hello,
>
> I have come across an issue with a monitoring using the
> hardware debug registers on ia64/i386/x86-64.
>
> It seems that the way debug registers are inherited across fork
> differs between ia-64 and i386/x86-64. On ia-64, the debug registers
> are NEVER inherited in the child. The copy_thread() routine clears
> the necessary thread flags to avoid reloading the debug registers in
> the child.
>
> Now, on x86-64, it appears that the TIF_DEBUG flag is inherited via
> setup_thread_stack(). By virtue of dup_task_struct() the debug registers
> get copied into the child task on fork. So the child has active breakpoints,
> unless I am mistaken somewhere.
>
> Given the way the ptrace() interface works, I would tend to
> think that the ia-64 way is the correct one. Any comment?
IA64 is probably correct, but changing this might break existing programs.
Would that be worth the change? What advantage would you have from it.
> Furthermore, on i386/x86-64, when switching out from a task with TIF_DEBUG
> enabled to another which does not, it seems we do not clear the debug
> registers (at least dr7) so they become inactive.
You mean they leak? Perhaps they should be cleared.
-Andi
next prev parent reply other threads:[~2007-03-05 17:29 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
2007-03-05 17:25 ` Andi Kleen [this message]
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=200703051825.16473.ak@suse.de \
--to=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=eranian@hpl.hp.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.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