Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	"Liam R. Howlett" <liam@infradead.org>, Hao Ge <hao.ge@linux.dev>,
	Kees Cook <kees@kernel.org>, Pedro Falcato <pfalcato@suse.de>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Danielle Constantino <dcostantino@meta.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH slab/for-next-fixes v3 1/4] mm/slab: fix a memory leak due to bootstrapping sheaves twice
Date: Thu, 16 Jul 2026 11:31:45 +0900	[thread overview]
Message-ID: <093c6dbe-6ca3-47cd-bf8d-3cc85c13f7ac@kernel.org> (raw)
In-Reply-To: <CAJuCfpF3vRftgrQGYhRZk7B9Z+GuG9eM5Cx7HehBaaafH+R==Q@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1306 bytes --]



On 7/14/26 12:30 AM, Suren Baghdasaryan wrote:
> On Mon, Jul 13, 2026 at 7:29 AM Harry Yoo (Oracle) <harry@kernel.org> 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@vger.kernel.org
>> Fixes: 913ffd3a1bf5 ("slab: handle kmalloc sheaves bootstrap")
>> Signed-off-by: Harry Yoo (Oracle) <harry@kernel.org>
> 
> 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@google.com>

Thanks!

-- 
Cheers,
Harry / Hyeonggon

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2026-07-16  2:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260713-kmalloc-no-objext-v3-0-47c7bd138de7@kernel.org>
2026-07-13 14:28 ` [PATCH slab/for-next-fixes v3 1/4] mm/slab: fix a memory leak due to bootstrapping sheaves twice Harry Yoo (Oracle)
     [not found]   ` <CAJuCfpF3vRftgrQGYhRZk7B9Z+GuG9eM5Cx7HehBaaafH+R==Q@mail.gmail.com>
2026-07-16  2:31     ` Harry Yoo [this message]
2026-07-13 14:28 ` [PATCH slab/for-next-fixes v3 2/4] mm/slab: decouple SLAB_NO_SHEAVES from SLAB_NO_OBJ_EXT Harry Yoo (Oracle)
2026-07-13 15:37   ` Suren Baghdasaryan
2026-07-13 14:28 ` [PATCH slab/for-next-fixes v3 3/4] lib/alloc_tag: introduce mem_alloc_profiling_permanently_disabled() Harry Yoo (Oracle)
2026-07-13 15:43   ` Suren Baghdasaryan
2026-07-13 16:15     ` Vlastimil Babka (SUSE)
2026-07-13 16:28       ` Harry Yoo
2026-07-14 14:37         ` Suren Baghdasaryan
2026-07-16  2:34           ` Harry Yoo
2026-07-13 14:28 ` [PATCH slab/for-next-fixes v3 4/4] mm/slab: prevent unbounded recursion in free path with new kmalloc type Harry Yoo (Oracle)
2026-07-13 17:08   ` Suren Baghdasaryan
2026-07-14  5:17     ` Harry Yoo
     [not found]       ` <87f607bb-3766-4b90-b3cc-a98d3cadf760@kernel.org>
2026-07-14 14:27         ` Suren Baghdasaryan
2026-07-14 15:21   ` Vlastimil Babka (SUSE)
2026-07-14 15:42 ` [PATCH slab/for-next-fixes v3 0/4] mm/slab: fix unbounded recursion in free path with memalloc profiling Vlastimil Babka (SUSE)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=093c6dbe-6ca3-47cd-bf8d-3cc85c13f7ac@kernel.org \
    --to=harry@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=dcostantino@meta.com \
    --cc=hao.ge@linux.dev \
    --cc=hao.li@linux.dev \
    --cc=kees@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pfalcato@suse.de \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox