[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230503170651.cw5omegmm3piumxf@google.com>
Date: Wed, 3 May 2023 17:06:51 +0000
From: Shakeel Butt <shakeelb@...gle.com>
To: Roman Gushchin <roman.gushchin@...ux.dev>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Muchun Song <muchun.song@...ux.dev>,
linux-kernel@...r.kernel.org, Dmitry Vyukov <dvyukov@...gle.com>,
Yosry Ahmed <yosryahmed@...gle.com>
Subject: Re: [PATCH v2 2/2] mm: memcg: use READ_ONCE()/WRITE_ONCE() to access stock->cached
On Tue, May 02, 2023 at 09:08:39AM -0700, Roman Gushchin wrote:
> A memcg pointer in the percpu stock can be accessed by drain_all_stock()
> from another cpu in a lockless way.
> In theory it might lead to an issue, similar to the one which has been
> discovered with stock->cached_objcg, where the pointer was zeroed
> between the check for being NULL and dereferencing.
> In this case the issue is unlikely a real problem, but to make it
> bulletproof and similar to stock->cached_objcg, let's annotate all
> accesses to stock->cached with READ_ONCE()/WTRITE_ONCE().
>
> Signed-off-by: Roman Gushchin <roman.gushchin@...ux.dev>
> Cc: Dmitry Vyukov <dvyukov@...gle.com>
> Cc: Yosry Ahmed <yosryahmed@...gle.com>
> Cc: Shakeel Butt <shakeelb@...gle.com>
Acked-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists