All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Chris Wright <chrisw@sous-sol.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] ptrace: cleanup check/set of PT_PTRACED during attach
Date: Thu, 7 May 2009 01:30:27 +0200	[thread overview]
Message-ID: <20090506233027.GB3756@redhat.com> (raw)
In-Reply-To: <20090506074421.GE17457@elte.hu>

On 05/06, Ingo Molnar wrote:
>
> * Oleg Nesterov <oleg@redhat.com> wrote:
>
> > ptrace_attach() and ptrace_traceme() are the last functions which 
> > look as if the untraced task can have task->ptrace != 0, this must 
> > not be possible. Change the code to just check ->ptrace != 0 and 
> > s/|=/=/ to set PT_PTRACED.
> >
> > Also, a couple of trivial whitespace cleanups in ptrace_attach().
> >
> > And move ptrace_traceme() up near ptrace_attach() to keep them 
> > close to each other.
>
> btw., while at it, please also fix the typos in 
> include/linux/ptrace.h's PT_* flags section:
>
> /*
>  * Ptrace flags
>  *
>  * The owner ship rules for task->ptrace which holds the ptrace
>  * flags is simple.  When a task is running it owns it's task->ptrace
>  * flags.  When the a task is stopped the ptracer owns task->ptrace.
>  */
>
> s/owner ship/ownership
> s/it's/its

Yes, thanks.

We should change this comment anyway, because it is not right.

The only case when a task owns (iow, can change it safely) its ->ptrace
is: it is running _and_ traced. I think this is what the comment tried
to say.

But this doesn't really matter, because afaics the correct comment
should say: the task should never touch its ->ptrace, ptracer always
owns it.

There is only one exception afaics, de_thread() or do_wait() can call
release_task()->ptrace_unlink() and clear ->ptrace on behalve of
another (not ptracer) task.

Roland, what do you think?

Oleg.


  reply	other threads:[~2009-05-06 23:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-05 22:47 [PATCH 2/3] ptrace: cleanup check/set of PT_PTRACED during attach Oleg Nesterov
2009-05-06  2:07 ` Roland McGrath
2009-05-06  7:44 ` Ingo Molnar
2009-05-06 23:30   ` Oleg Nesterov [this message]
2009-05-07  0:31     ` Roland McGrath

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=20090506233027.GB3756@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.