linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Maneesh Soni <maneesh@linux.vnet.ibm.com>,
	Prasad <prasad@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] ptrace/x86: simplify ptrace_write_dr7()
Date: Sun, 14 Apr 2013 21:40:49 +0200	[thread overview]
Message-ID: <20130414194049.GA29540@redhat.com> (raw)
In-Reply-To: <20130414193021.GA20962@host2.jankratochvil.net>

On 04/14, Jan Kratochvil wrote:
>
> On Sun, 14 Apr 2013 21:12:05 +0200, Oleg Nesterov wrote:
> > Jan, Frederic, et all. What do you think we should do?
> >
> > 	1. Change ptrace_write_dr7() to do register_user_hw_breakpoint()
> > 	   if necessary.
> >
> > 	   This is what I was going to do, but I am no longer sure
> > 	   we want this. For what? Unlikely it is very useful to use
> > 	   the "default" addr == 0 for debugging.
>
> I do not understand how these functions map to the PTRACE_* syscall.
>
> But this was a regression from the application point of view as some
> application did/do:
> 	* waitpid - get the process to: t (tracing stop)
> 	* PTRACE_POKEUSER DR7, enableDR0
> 	* PTRACE_POKEUSER DR0, address
> 	* PTRACE_CONT
>
> This was perfectly valid before, there is no "default" addr == 0 used for any
> debugging.  Just the applications did not care about PTRACE_POKEUSER ordering.
> This is also how the bug was found.

Yes, exactly.

Except 'there is no "default" addr == 0', the first
"PTRACE_POKEUSER DR7, enableDR0" used addr == 0 and then it was
changed by "PTRACE_POKEUSER DR0".

And once again, I am ready to make the patch, it should be simple.
Just I am not sure it worth the trouble, so I decided to ask first.
Nobody noticed this problem(?) except you, and this was broken a
long ago.

	PTRACE_POKEUSER DR0, address
	PTRACE_POKEUSER DR7, enableDR0

should work and this looks better, we do not enable bp until it
has the correct address set.  Of course this doesn't really matter
if the tracee doesn't not run in between, but still...

Oleg.


  reply	other threads:[~2013-04-14 19:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 19:12 [PATCH 0/2] ptrace/x86: simplify ptrace_write_dr7() Oleg Nesterov
2013-04-14 19:12 ` [PATCH 1/2] ptrace/x86: simplify the "disable" logic in ptrace_write_dr7() Oleg Nesterov
2013-04-16  0:03   ` Frederic Weisbecker
2013-04-14 19:12 ` [PATCH 2/2] ptrace/x86: dont delay perf_event_disable() till second pass " Oleg Nesterov
2013-04-16  0:44   ` Frederic Weisbecker
2013-04-16 13:30     ` Oleg Nesterov
2013-04-16 22:00       ` Frederic Weisbecker
2013-04-17 12:40         ` Oleg Nesterov
2013-04-14 19:30 ` [PATCH 0/2] ptrace/x86: simplify ptrace_write_dr7() Jan Kratochvil
2013-04-14 19:40   ` Oleg Nesterov [this message]
2013-04-15 23:36 ` Frederic Weisbecker
2013-04-16 13:25   ` Oleg Nesterov
2013-04-17  4:57     ` Jan Kratochvil

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=20130414194049.GA29540@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@linux.vnet.ibm.com \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=stern@rowland.harvard.edu \
    /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 NNTP newsgroup(s).