[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y0pddw5m.fsf@linux.dev>
Date: Tue, 14 Oct 2025 14:13:25 -0700
From: Roman Gushchin <roman.gushchin@...ux.dev>
To: Hao Ge <hao.ge@...ux.dev>
Cc: Vlastimil Babka <vbabka@...e.cz>, Alexei Starovoitov <ast@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>, Johannes Weiner
<hannes@...xchg.org>, Shakeel Butt <shakeel.butt@...ux.dev>, Michal
Hocko <mhocko@...nel.org>, Muchun Song <muchun.song@...ux.dev>, Suren
Baghdasaryan <surenb@...gle.com>, Harry Yoo <harry.yoo@...cle.com>,
cgroups@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Hao Ge <gehao@...inos.cn>
Subject: Re: [PATCH v3] slab: Add check for memcg_data != OBJEXTS_ALLOC_FAIL
in folio_memcg_kmem
Hao Ge <hao.ge@...ux.dev> writes:
> From: Hao Ge <gehao@...inos.cn>
>
> Since OBJEXTS_ALLOC_FAIL and MEMCG_DATA_OBJEXTS currently share
> the same bit position, we cannot determine whether memcg_data still
> points to the slabobj_ext vector simply by checking
> folio->memcg_data & MEMCG_DATA_OBJEXTS.
>
> If obj_exts allocation failed, slab->obj_exts is set to OBJEXTS_ALLOC_FAIL,
> and during the release of the associated folio, the BUG check is triggered
> because it was mistakenly assumed that a valid folio->memcg_data
> was not cleared before freeing the folio.
>
> So let's check for memcg_data != OBJEXTS_ALLOC_FAIL in folio_memcg_kmem.
>
> Fixes: 7612833192d5 ("slab: Reuse first bit for OBJEXTS_ALLOC_FAIL")
> Suggested-by: Harry Yoo <harry.yoo@...cle.com>
> Signed-off-by: Hao Ge <gehao@...inos.cn>
> ---
> v3: Simplify the solution, per Harry's suggestion in the v1 comments
> Add Suggested-by: Harry Yoo <harry.yoo@...cle.com>
Acked-by: Roman Gushchin <roman.gushchin@...ux.dev>
Thanks!
Powered by blists - more mailing lists