From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>,
linux-kernel@vger.kernel.org, dvlasenk@redhat.com
Subject: Re: [PATCH v2] Make PTRACE_SEIZE set ptrace options specified in 'data' parameter
Date: Thu, 8 Sep 2011 20:17:47 +0200 [thread overview]
Message-ID: <20110908181747.GA28120@redhat.com> (raw)
In-Reply-To: <20110908004438.GC3987@mtj.dyndns.org>
On 09/08, Tejun Heo wrote:
>
> On Wed, Sep 07, 2011 at 11:40:31PM +0200, Denys Vlasenko wrote:
> > + if (seize) {
> > + if (addr != 0)
> > + goto out;
> > + if ((flags & ~(long)PTRACE_O_MASK) != PTRACE_SEIZE_DEVEL)
>
> Please use (unsigned long). Also, wouldn't it be better to do the
> following instead?
>
> if (!(flags & PTRACE_SEIZE_DEVEL))
> goto out;
> flags &= ~PTRACE_SEIZE_DEVEL;
>
> if ((flags & ~(unsigned long(PTRACE_O_MASK))))
> goto out;
>
> Then, we can later just delete the first three lines when removing
> SEIZE_DEVEL.
>
> > @@ -263,11 +272,9 @@ static int ptrace_attach(struct task_struct *task, long request,
> > if (task->ptrace)
> > goto unlock_tasklist;
> >
> > - task->ptrace = PT_PTRACED;
> > - if (seize)
> > - task->ptrace |= PT_SEIZED;
> > if (task_ns_capable(task, CAP_SYS_PTRACE))
> > - task->ptrace |= PT_PTRACE_CAP;
> > + flags |= PT_PTRACE_CAP;
> > + task->ptrace = flags;
>
> Can you please put this in a separate patch?
Yes.
> Hmm... also I think we
> probably want to set ->ptrace while holding siglock too.
I thought about this too, and I agree this makes sense
> There are
> places which assume ->ptrace is protected by siglock.
Really? Once again, I agree. But _afaics_ currently this is not strictly
needed. PT_PTRACED/PT_SEIZED should not go away under ->siglock, yes, but
it seems that it is fine to set them.
> and linking are
> protected by siglock
Hmm. Could you explain this? Why do want __ptrace_link under ->siglock ?
Oleg.
next prev parent reply other threads:[~2011-09-08 23:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 21:40 [PATCH v2] Make PTRACE_SEIZE set ptrace options specified in 'data' parameter Denys Vlasenko
2011-09-07 23:55 ` Pedro Alves
2011-09-08 0:44 ` Tejun Heo
2011-09-08 18:17 ` Oleg Nesterov [this message]
2011-09-11 2:05 ` Tejun Heo
2011-09-11 18:14 ` Oleg Nesterov
2011-09-13 8:00 ` Tejun Heo
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=20110908181747.GA28120@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).