[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130605230625.GN10693@mtj.dyndns.org>
Date: Wed, 5 Jun 2013 16:06:25 -0700
From: Tejun Heo <tj@...nel.org>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.cz>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch 1/2] mm: memcontrol: fix lockless reclaim hierarchy
iterator
On Wed, Jun 05, 2013 at 06:53:45PM -0400, Johannes Weiner wrote:
> The lockless reclaim hierarchy iterator currently has a misplaced
> barrier that can lead to use-after-free crashes.
>
> The reclaim hierarchy iterator consist of a sequence count and a
> position pointer that are read and written locklessly, with memory
> barriers enforcing ordering.
>
> The write side sets the position pointer first, then updates the
> sequence count to "publish" the new position. Likewise, the read side
> must read the sequence count first, then the position. If the
> sequence count is up to date, it's guaranteed that the position is up
> to date as well:
>
> writer: reader:
> iter->position = position if iter->sequence == expected:
> smp_wmb() smp_rmb()
> iter->sequence = sequence position = iter->position
>
> However, the read side barrier is currently misplaced, which can lead
> to dereferencing stale position pointers that no longer point to valid
> memory. Fix this.
>
> Reported-by: Tejun Heo <tj@...nel.org>
> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
> Cc: stable@...nel.org [3.10+]
Reviewed-by: Tejun Heo <tj@...nel.org>
Oops, right, the references were reversed too.
Thanks.
--
tejun
--
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