linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Christoph Lameter <cl@linux.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC][PATCH] fix move/migrate_pages() race on task struct
Date: Sat, 25 Feb 2012 04:13:44 -0800	[thread overview]
Message-ID: <87sjhzun47.fsf@xmission.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1202241131400.3726@router.home> (Christoph Lameter's message of "Fri, 24 Feb 2012 11:32:59 -0600 (CST)")

Christoph Lameter <cl@linux.com> writes:

> On Fri, 24 Feb 2012, Dave Hansen wrote:
>
>> > Is that all safe? If not then we need to take a refcount on the task
>> > struct after all.
>>
>> Urg, no we can't sleep under an rcu_read_lock().
>
> Ok so take a count and drop it before entering the main migration
> function?

For correct operation of kernel code a count sounds fine.

If you are going to allow sleeping how do you ensure that an exec that
happens between the taking of the reference count and checking the
permissions does not mess things up.

At the very least the patch description needs an explanation of what
the thinking will be in that case.

At the moment I suspect the permissions checks are not safe unless
performed under both rcu_read_lock and task_lock to ensure that
the task<->mm association does not change on us while we are
working.  Even with that the cred can change under us but at least
we know the cred will be valid until rcu_read_unlock happens.

This entire thinhg of modifying another process is a pain.

Perhaps you can play with task->self_exec_id to detect an exec and fail
the system call if there was an exec in between when we find the task
and when we drop the task reference.

Eric


  parent reply	other threads:[~2012-02-25 12:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 18:07 [RFC][PATCH] fix move/migrate_pages() race on task struct Dave Hansen
2012-02-23 18:45 ` Andi Kleen
2012-02-23 18:45 ` Christoph Lameter
2012-02-23 19:10   ` Dave Hansen
2012-02-23 19:40     ` Christoph Lameter
2012-02-23 20:04       ` Dave Hansen
2012-02-23 21:41         ` Christoph Lameter
2012-02-24  3:14           ` Eric W. Biederman
2012-02-24 15:20             ` Christoph Lameter
2012-02-24 15:41               ` Eric W. Biederman
2012-02-24 16:48               ` Dave Hansen
2012-02-24 16:54                 ` Christoph Lameter
2012-02-24 17:04                   ` Dave Hansen
2012-02-24 17:08                   ` Christoph Lameter
2012-02-24 17:25                     ` Dave Hansen
2012-02-24 17:32                       ` Christoph Lameter
2012-02-24 21:37                         ` Dave Hansen
2012-02-24 23:12                         ` Eric W. Biederman
2012-02-27 16:43                           ` Christoph Lameter
2012-02-25 12:13                         ` Eric W. Biederman [this message]
2012-02-27 19:01                           ` Christoph Lameter
2012-02-27 20:15                             ` Eric W. Biederman
2012-02-27 22:39                               ` Christoph Lameter
2012-02-28 19:30                                 ` Christoph Lameter
2012-02-29 20:31                                   ` Andrew Morton
2012-02-29 20:33                                     ` Christoph Lameter
2012-02-29 20:36                                     ` Dave Hansen
2012-02-24 17:07               ` KOSAKI Motohiro

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=87sjhzun47.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=cl@linux.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).