Re: [PATCH slab/for-next-fixes v3 1/4] mm/slab: fix a memory leak due to bootstrapping sheaves twice
From: Harry Yoo
Date: Wed Jul 15 2026 - 22:31:58 EST
On 7/14/26 12:30 AM, Suren Baghdasaryan wrote:
> On Mon, Jul 13, 2026 at 7:29 AM Harry Yoo (Oracle) <harry@xxxxxxxxxx> wrote:
>>
>> When kmalloc caches are aliased, multiple cache pointers reference
>> the same kmem_cache. As a result, iterating over kmalloc indices and
>> bootstrapping sheaves can bootstrap the same cache more than once and
>> leak memory.
>>
>> Currently, this could happen when the architecture specifies
>> minimum alignment for slab caches that is larger than
>> ARCH_KMALLOC_MINALIGN.
>>
>> Bootstrap sheaves only when the cache does not have them already.
>> Add a warning when bootstrap_cache_sheaves() is called for a cache
>> that already has sheaves enabled.
>>
>> Cc: stable@xxxxxxxxxxxxxxx
>> Fixes: 913ffd3a1bf5 ("slab: handle kmalloc sheaves bootstrap")
>> Signed-off-by: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
>
> nit: Don't know if we really need a warning...
Hehe, at least the warning allowed me to confirm that this is not an
oversight and the patch fixed it :)
> I would just do an
> early return from bootstrap_cache_sheaves() if cache_has_sheaves() is
> true. But that's not critical.
But yeah, no strong opinion on this.
> Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
Thanks!
--
Cheers,
Harry / Hyeonggon
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature