[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <504A7C5C.1000706@jp.fujitsu.com>
Date: Fri, 07 Sep 2012 18:59:40 -0400
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: mgorman@...e.de
CC: akpm@...ux-foundation.org, kosaki.motohiro@...fujitsu.com,
davej@...hat.com, cl@...ux.com, ben@...adent.org.uk,
ak@...ux.intel.com, hughd@...gle.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 3/5] mempolicy: fix a race in shared_policy_replace()
First off, thank you very much for reworking this for me. I haven't got a chance
to get a test machine for this.
> shared_policy_replace() use of sp_alloc() is unsafe. 1) sp_node cannot
> be dereferenced if sp->lock is not held and 2) another thread can modify
> sp_node between spin_unlock for allocating a new sp node and next spin_lock.
> The bug was introduced before 2.6.12-rc2.
>
> Kosaki's original patch for this problem was to allocate an sp node and policy
> within shared_policy_replace and initialise it when the lock is reacquired. I
> was not keen on this approach because it partially duplicates sp_alloc(). As
> the paths were sp->lock is taken are not that performance critical this
> patch converts sp->lock to sp->mutex so it can sleep when calling sp_alloc().
Looks make sense.
Acked-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
--
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