[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPbs_cu261GnQgcu@hyeyoo>
Date: Tue, 21 Oct 2025 11:16:29 +0900
From: Harry Yoo <harry.yoo@...cle.com>
To: Hao Ge <hao.ge@...ux.dev>
Cc: Vlastimil Babka <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...two.org>,
David Rientjes <rientjes@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Suren Baghdasaryan <surenb@...gle.com>,
Shakeel Butt <shakeel.butt@...ux.dev>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Hao Ge <gehao@...inos.cn>,
stable@...r.kernel.org
Subject: Re: [PATCH v3] slab: Avoid race on slab->obj_exts in
alloc_slab_obj_exts
On Tue, Oct 21, 2025 at 09:03:53AM +0800, Hao Ge wrote:
> From: Hao Ge <gehao@...inos.cn>
>
> If two competing threads enter alloc_slab_obj_exts() and one of them
> fails to allocate the object extension vector, it might override the
> valid slab->obj_exts allocated by the other thread with
> OBJEXTS_ALLOC_FAIL. This will cause the thread that lost this race and
> expects a valid pointer to dereference a NULL pointer later on.
>
> Update slab->obj_exts atomically using cmpxchg() to avoid
> slab->obj_exts overrides by racing threads.
>
> Thanks for Vlastimil and Suren's help with debugging.
>
> Fixes: f7381b911640 ("slab: mark slab->obj_exts allocation failures unconditionally")
> Cc: <stable@...r.kernel.org>
> Suggested-by: Suren Baghdasaryan <surenb@...gle.com>
> Signed-off-by: Hao Ge <gehao@...inos.cn>
> ---
> v3: According to Suren's suggestion, simplify the commit message and the code comments.
> Thanks for Suren.
>
> v2: Incorporate handling for the scenario where, if mark_failed_objexts_alloc wins the race,
> the other process (that previously succeeded in allocation) will lose the race, based on Suren's suggestion.
> Add Suggested-by: Suren Baghdasaryan <surenb@...gle.com>
> ---
Looks good to me, thanks for fixing this!
Reviewed-by: Harry Yoo <harry.yoo@...cle.com>
--
Cheers,
Harry / Hyeonggon
Powered by blists - more mailing lists