[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1202231536240.13554@router.home>
Date: Thu, 23 Feb 2012 15:41:50 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Dave Hansen <dave@...ux.vnet.ibm.com>
cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [RFC][PATCH] fix move/migrate_pages() race on task struct
On Thu, 23 Feb 2012, Dave Hansen wrote:
> > We may at this point be getting a reference to a task struct from another
> > process not only from the current process (where the above procedure is
> > valid). You rightly pointed out that the slab rcu free mechanism allows a
> > free and a reallocation within the RCU period.
>
> I didn't _mean_ to point that out, but I think I realize what you're
> talking about. What we have before this patch is this:
>
> rcu_read_lock();
> task = pid ? find_task_by_vpid(pid) : current;
We take a refcount here on the mm ... See the code. We could simply take a
refcount on the task as well if this is considered safe enough. If we have
a refcount on the task then we do not need the refcount on the mm. Thats
was your approach...
> rcu_read_unlock();
> > Is that a real difference or are you just playing with words?
>
> I think we're talking about two different things:
> 1. does RCU protect the pid->task lookup sufficiently?
I dont know
> 2. Can the task simply go away in the move/migrate_pages() calls?
The task may go away but we need the mm to stay for migration.
That is why a refcount is taken on the mm.
The bug in migrate_pages() is that we do a rcu_unlock and a rcu_lock. If
we drop those then we should be safe if the use of a task pointer within a
rcu section is safe without taking a refcount.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists