linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Matthew Dempsky <mdempsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>,
	Julien Tinnes <jln@chromium.org>,
	Roland McGrath <mcgrathr@chromium.org>,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] ptrace: Fix fork event messages across pid namespaces
Date: Mon, 7 Apr 2014 21:06:10 +0200	[thread overview]
Message-ID: <20140407190610.GA24607@redhat.com> (raw)
In-Reply-To: <CAF52+S5aTOJL-Xn-yji3RmCS60=R7qaLqzADbdSH91oLPPYOug@mail.gmail.com>

On 04/03, Matthew Dempsky wrote:
>
> On Thu, Apr 3, 2014 at 8:44 AM, Oleg Nesterov <oleg@redhat.com> wrote:
>
> > Some notes for potential future changes...
> >
> >         - I do not not see any potential user of ptrace_event_pid() outside
> >           of fork.c, so perhaps this helper should not be exported.
> >
> >           In fact I wouldn't mind if you send v5 which moves it into fork.c ;)
>
> Like you mentioned, it's potentially used by fs/exec.c too, which I
> was intending to send a followup patch for.

OK, agreed. Probably we can tolerate the extra get/put_pid() but make
this code look better.

> >         - OTOH, calculating pid_nr in the namespace of ->parent can probably
> >           go into another simple (exported) helper. do_notify_parent_*() and
> >           exec_binprm() could use it, even they do not have the problem with
> >           task_active_pid_ns(parent) == NULL. Not sure.
>
> I think do_notify_parent_*() are safe from task_active_pid_ns(parent)
> == NULL because they're under tasklist_lock,

Yes, they are fine correctness-wise, just this task_pid_nr_ns(...) doesn't
look readable. OK, please forget, from_kuid_munged() doesn't look better.

> but it looks like
> exec_binprm() is theoretically racy

No (if you meant task_pid_nr_ns() == NULL). Note that __task_pid_nr_ns()
checks ns != NULL. In fact this is bad, this just reminds that we have
too many helpers with the subtle differences ;)

But if you meant that it can report the wrong pid then yes, of course,
it can race with detach/attach too.

Oleg.


  reply	other threads:[~2014-04-07 19:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1396288478-1314-1-git-send-email-mdempsky@chromium.org>
     [not found] ` <20140331181651.GA27686@redhat.com>
     [not found]   ` <CAF52+S5i7oqJnJ1NN0bk5Vg=CiYrussw0AunteE72kMMcWkeJA@mail.gmail.com>
2014-04-01 18:52     ` [PATCH v2] Fix ptrace events across pid namespaces Oleg Nesterov
2014-04-01 20:44       ` Matthew Dempsky
2014-04-01 22:29         ` [PATCH v3] ptrace: Fix fork event messages " Matthew Dempsky
2014-04-02  0:39           ` Matthew Dempsky
2014-04-02 14:58           ` Oleg Nesterov
2014-04-02 15:44             ` [PATCH 0/1] pid_namespace: pidns_get() should check task_active_pid_ns() != NULL Oleg Nesterov
2014-04-02 15:45               ` [PATCH 1/1] " Oleg Nesterov
2014-04-02 16:53                 ` Eric W. Biederman
2014-04-02 15:58                   ` Oleg Nesterov
2014-04-02 22:01                     ` Eric W. Biederman
2014-04-02 21:58             ` [PATCH v3] ptrace: Fix fork event messages across pid namespaces Matthew Dempsky
2014-04-02 22:37               ` Matthew Dempsky
2014-04-07 19:24                 ` Oleg Nesterov
2014-04-03  2:26           ` [PATCH v4] " Matthew Dempsky
2014-04-03 15:44             ` Oleg Nesterov
2014-04-03 16:13               ` Oleg Nesterov
2014-04-03 18:07               ` Matthew Dempsky
2014-04-07 19:06                 ` Oleg Nesterov [this message]
2014-04-29 20:20             ` [RESEND PATCH " Matthew Dempsky
2014-04-29 22:11               ` Andrew Morton
2014-04-30  0:34               ` [PATCH v5] " Matthew Dempsky
2014-04-30 11:51                 ` Oleg Nesterov
2014-04-30 20:16                 ` Andrew Morton

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=20140407190610.GA24607@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=jln@chromium.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrathr@chromium.org \
    --cc=mdempsky@chromium.org \
    /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).