Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: Shakeel Butt <shakeel.butt@linux.dev>
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>,
	Suren Baghdasaryan <surenb@google.com>, Hao Ge <hao.ge@linux.dev>,
	Kees Cook <kees@kernel.org>, Pedro Falcato <pfalcato@suse.de>,
	Danielle Constantino <dcostantino@meta.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH slab/for-next-fixes v3 0/4] mm/slab: fix unbounded recursion in free path with memalloc profiling
Date: Fri, 17 Jul 2026 13:10:21 +0900	[thread overview]
Message-ID: <2bbebbfc-fd00-4744-9775-5ba35788b535@kernel.org> (raw)
In-Reply-To: <alkypcRUZa_r6uGV@linux.dev>


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



On 7/17/26 4:37 AM, Shakeel Butt wrote:
> On Mon, Jul 13, 2026 at 11:28:48PM +0900, Harry Yoo (Oracle) wrote:
>> This is a follow-up fix after the recent discussion [1].
>> See patch 4 for the detailed description on the bug.
>>
>> Based on slab/for-next-fixes (af9ea231c0b45) and is available at
>> git.kernel.org [2].
>>
>> Instead preventing cycles by bumping up the allocation size of obj_exts
>> arrays, it introduces a new kmalloc type called KMALLOC_NO_OBJ_EXT and
>> disallow formation of cycles between kmalloc types when allocating
>> obj_exts arrays. obj_exts arrays of normal kmalloc caches are served
>> from KMALLOC_NO_OBJ_EXT caches (that don't have obj_exts), and all other
>> obj_exts arrays are served from normal kmalloc caches.
>>
>> I tried to reuse SLAB_ALLOC_NO_RECURSE to make kmalloc_slab() select
>> KMALLOC_NO_OBJ_EXT, but it was not great because it does not allow
>> sheaves for those caches. So I introduced a new slab alloc flag
>> SLAB_ALLOC_NO_OBJ_EXT.
>>
>> To avoid huge confusion, I had to decouple "disallowing sheaves"
>> semantics from SLAB_NO_OBJ_EXT and introduced SLAB_NO_SHEAVES.
>>
>> While this cannot be directly backported to v6.18 and v6.12 due to lack
>> of SLAB_ALLOC_* flags and kmalloc_flags(), I don't this will be
>> particularily challenging to backport it. Instead of a new slab alloc
>> flag, we can use __GFP_NO_OBJ_EXT to select KMALLOC_NO_OBJ_EXT as
>> kmalloc caches don't have sheaves in v6.18 anyway.
>>
>> [1] https://lore.kernel.org/linux-mm/9a139365-28e6-4f1e-b35b-7f6091e9aa14@kernel.org
>>
>> [2] https://git.kernel.org/pub/scm/linux/kernel/git/harry/linux.git/log/?h=kmalloc-no-objext-v3r1
>>
>> To: Vlastimil Babka <vbabka@kernel.org>
>> To: Andrew Morton <akpm@linux-foundation.org>
>> To: Hao Li <hao.li@linux.dev>
>> To: Christoph Lameter <cl@gentwo.org>
>> To: David Rientjes <rientjes@google.com>
>> To: Roman Gushchin <roman.gushchin@linux.dev>
>> To: Suren Baghdasaryan <surenb@google.com>
>> To: Hao Ge <hao.ge@linux.dev>
>> To: Kees Cook <kees@kernel.org>
>> To: Pedro Falcato <pfalcato@suse.de>
>> To: Shakeel Butt <shakeel.butt@linux.dev>
>> To: Danielle Constantino <dcostantino@meta.com>
>> To: Liam R. Howlett <liam@infradead.org>
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Harry Yoo (Oracle) <harry@kernel.org>
> 
> I tested next-20260716 which has this series against next-20260707 which does
> not have the fix. The reproducer were able to trigger the leak/recursion on
> next-20260707 but not on next-20260716. So, you can add:
> 
> Tested-by: Shakeel Butt <shakeel.butt@linux.dev>

Thanks a lot for testing, Shakeel!

-- 
Cheers,
Harry / Hyeonggon


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

      parent reply	other threads:[~2026-07-17  4:10 UTC|newest]

Thread overview: 21+ 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
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)
2026-07-16 18:05 ` Shakeel Butt
2026-07-17  4:09   ` Harry Yoo
2026-07-16 19:37 ` Shakeel Butt
2026-07-17  1:16   ` Hao Ge
2026-07-17  4:10   ` Harry Yoo [this message]

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=2bbebbfc-fd00-4744-9775-5ba35788b535@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