Messages in this thread | | | Date | Wed, 3 May 2023 17:06:51 +0000 | Subject | Re: [PATCH v2 2/2] mm: memcg: use READ_ONCE()/WRITE_ONCE() to access stock->cached | From | Shakeel Butt <> |
| |
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@linux.dev> > Cc: Dmitry Vyukov <dvyukov@google.com> > Cc: Yosry Ahmed <yosryahmed@google.com> > Cc: Shakeel Butt <shakeelb@google.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
| |