public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* debug registers and fork
@ 2007-02-26 23:51 Stephane Eranian
  2007-02-27 20:24 ` Andrew Morton
  2007-03-05 17:25 ` Andi Kleen
  0 siblings, 2 replies; 7+ messages in thread
From: Stephane Eranian @ 2007-02-26 23:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-ia64, Stephane Eranian, ak, akpm, tony.luck

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?

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.

-- 
-Stephane

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-05 20:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-03-05 20:05   ` Stephane Eranian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox