linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Denys Vlasenko <vda.linux@googlemail.com>,
	Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Add new PTRACE_O_TRACESTOP option, make it control new ptrace behavior.
Date: Tue, 6 Sep 2011 22:08:18 +0200	[thread overview]
Message-ID: <20110906200818.GA28349@redhat.com> (raw)
In-Reply-To: <1315242384.1888.64.camel@dhcp-25-63.brq.redhat.com>

On 09/05, Denys Vlasenko wrote:
>
> Add new PTRACE_O_TRACESTOP option, make it control new ptrace behavior.
>
> Introduce new ptrace option, PTRACE_O_TRACESTOP. This makes API
> more symmetric: every PTRACE_EVENT_event has corresponding PTRACE_O_TRACEevent now,
> as it used to have before PTRACE_SEIZE was introduced.
>
> PTRACE_SEIZE does not assume PTRACE_O_TRACESTOP, but with this patch
> it allows any PTRACE_O_opts to be set at attach time

Well. This assumes that the only difference with PTRACE_SEIZE is the
new stop/interrupt behaviour. I am not sure this is "safe" to assume.

Tejun, what do you think?

>From the correctness pov, the patch is mostly correct. but you forgot
to update ptrace_init_task(). I bet you didn't try to test the patch ;)

>  int ptrace_request(struct task_struct *child, long request,
>  		   unsigned long addr, unsigned long data)
>  {
> -	bool seized = child->ptrace & PT_SEIZED;
> +	bool stop_events_enabled = child->ptrace & PT_TRACE_STOP;

May be ptrace_event_enabled(child, PTRACE_EVENT_STOP) looks better...
The same about other PT_TRACE_STOP checks, although this is cosmetic.


And. Given that you can set/clear PT_TRACE_STOP in ptrace_setoptions(),
you need the locking.

Just for example. do_signal_stop() calls ptrace_trap_notify() and hits
WARN_ON_ONCE(!PT_TRACE_STOP) because it was cleared in between.

Oleg.


  reply	other threads:[~2011-09-06 20:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04 21:11 RFC: PTRACE_SEIZE needs API cleanup? Denys Vlasenko
2011-09-05  1:15 ` Indan Zupancic
2011-09-05  9:24   ` Denys Vlasenko
2011-09-05 13:08     ` Indan Zupancic
2011-09-05 14:06       ` Denys Vlasenko
2011-09-05 17:21         ` Indan Zupancic
2011-09-06  0:59           ` Denys Vlasenko
2011-09-06 17:08             ` Indan Zupancic
2011-09-07  2:34               ` Denys Vlasenko
2011-09-07 17:15                 ` Indan Zupancic
2011-09-05 17:44         ` Indan Zupancic
2011-09-06  1:05           ` Denys Vlasenko
2011-09-06 17:19             ` Indan Zupancic
2011-09-07  2:47               ` Denys Vlasenko
2011-09-07 14:24                 ` Indan Zupancic
2011-09-05 14:54 ` Denys Vlasenko
2011-09-05 16:51 ` [PATCH 1/2] Fix pollution of task->ptrace if PTRACE_SETOPTIONS fails Denys Vlasenko
2011-09-05 17:01 ` [PATCH 2/2] Denys Vlasenko
2011-09-05 17:06 ` [PATCH 2/2] Add new PTRACE_O_TRACESTOP option, make it control new ptrace behavior Denys Vlasenko
2011-09-06 20:08   ` Oleg Nesterov [this message]
2011-09-06 23:06     ` Tejun Heo
2011-09-07  4:55     ` Denys Vlasenko
2011-09-07 16:37       ` Oleg Nesterov
2011-09-06 16:52 ` [PATCH v2] Fix clearing of task->ptrace if PTRACE_SETOPTIONS fails Denys Vlasenko
2011-09-06 18:43   ` Oleg Nesterov
2011-09-07  4:44     ` Denys Vlasenko
2011-09-07  4:45     ` [PATCH v3] " Denys Vlasenko
2011-09-07 20:35       ` 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=20110906200818.GA28349@redhat.com \
    --to=oleg@redhat.com \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=vda.linux@googlemail.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 NNTP newsgroup(s).