public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry.yoo@oracle.com>
To: Qing Wang <wangqing7171@gmail.com>
Cc: syzbot+cae7809e9dc1459e4e63@syzkaller.appspotmail.com,
	Liam.Howlett@oracle.com, akpm@linux-foundation.org,
	chao@kernel.org, jaegeuk@kernel.org, jannh@google.com,
	linkinjeon@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, lorenzo.stoakes@oracle.com, pfalcato@suse.de,
	sj1557.seo@samsung.com, syzkaller-bugs@googlegroups.com,
	vbabka@suse.cz
Subject: Re: [syzbot] [mm?] [f2fs?] [exfat?] memory leak in __kfree_rcu_sheaf
Date: Wed, 11 Mar 2026 20:23:31 +0900	[thread overview]
Message-ID: <abFQsxz6pp8H63Te@hyeyoo> (raw)
In-Reply-To: <20260311104855.102050-1-wangqing7171@gmail.com>

On Wed, Mar 11, 2026 at 06:48:55PM +0800, Qing Wang wrote:
> #syz test
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 20cb4f3b636d..73b2cfd0e123 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2797,6 +2797,7 @@ static void free_empty_sheaf(struct kmem_cache *s, struct slab_sheaf *sheaf)
>  	if (s->flags & SLAB_KMALLOC)
>  		mark_obj_codetag_empty(sheaf);
>  
> +	WARN_ON(sheaf->size > 0);
>  	kfree(sheaf);
>  
>  	stat(s, SHEAF_FREE);
> @@ -2828,6 +2829,7 @@ static int refill_sheaf(struct kmem_cache *s, struct slab_sheaf *sheaf,
>  	return 0;
>  }
>  
> +static void sheaf_flush_unused(struct kmem_cache *s, struct slab_sheaf *sheaf);
>  
>  static struct slab_sheaf *alloc_full_sheaf(struct kmem_cache *s, gfp_t gfp)
>  {
> @@ -2837,6 +2839,7 @@ static struct slab_sheaf *alloc_full_sheaf(struct kmem_cache *s, gfp_t gfp)
>  		return NULL;
>  
>  	if (refill_sheaf(s, sheaf, gfp | __GFP_NOMEMALLOC | __GFP_NOWARN)) {
> +		sheaf_flush_unused(s, sheaf);
>  		free_empty_sheaf(s, sheaf);
>  		return NULL;
>  	}
> @@ -4623,6 +4626,7 @@ __pcs_replace_empty_main(struct kmem_cache *s, struct slub_percpu_sheaves *pcs,
>  			 * we must be very low on memory so don't bother
>  			 * with the barn
>  			 */
> +			sheaf_flush_unused(s, empty);
>  			free_empty_sheaf(s, empty);
>  		}
>  	} else {

This won't fix any kmemleak reports because kmemleak couldn't detect this
in the first place. kmemleak doesn't know that those objects exist
until they are allocated and kmemleak_alloc() is called for them.

-- 
Cheers,
Harry / Hyeonggon

  parent reply	other threads:[~2026-03-11 11:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09 18:26 [syzbot] [mm?] [f2fs?] [exfat?] memory leak in __kfree_rcu_sheaf syzbot
2026-03-02  3:41 ` Qing Wang
2026-03-02  3:57   ` syzbot
2026-03-02  8:39   ` Vlastimil Babka (SUSE)
2026-03-04  1:30     ` Harry Yoo
2026-03-04 13:39       ` Vlastimil Babka (SUSE)
2026-03-06 19:35         ` Catalin Marinas
2026-03-08 11:02           ` Catalin Marinas
2026-03-08 12:31             ` syzbot
2026-03-08 11:04           ` Catalin Marinas
2026-03-08 12:42             ` syzbot
2026-03-09 10:46           ` Harry Yoo
2026-03-09 11:11             ` syzbot
2026-03-09 12:17           ` Harry Yoo
2026-03-09 20:31             ` Catalin Marinas
2026-03-11  3:04               ` Harry Yoo
2026-03-11  3:20                 ` Harry Yoo
2026-03-10  3:39           ` Harry Yoo
2026-03-10  3:54             ` syzbot
2026-03-10  6:11               ` Harry Yoo
2026-03-10  6:29                 ` syzbot
2026-03-10  8:10                   ` Harry Yoo
2026-03-10  9:40                     ` syzbot
2026-03-18  2:34                     ` Harry Yoo
2026-03-18  3:08                       ` syzbot
2026-03-18  4:10                     ` Harry Yoo
2026-03-18  5:02                       ` syzbot
2026-03-11  9:57 ` Qing Wang
2026-03-11 10:17   ` syzbot
2026-03-11 10:48 ` Qing Wang
2026-03-11 11:03   ` syzbot
2026-03-11 11:23   ` Harry Yoo [this message]
2026-03-20  0:06 ` Harry Yoo
2026-03-20 10:34   ` syzbot
2026-03-20 11:20 ` Harry Yoo

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=abFQsxz6pp8H63Te@hyeyoo \
    --to=harry.yoo@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=jannh@google.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=pfalcato@suse.de \
    --cc=sj1557.seo@samsung.com \
    --cc=syzbot+cae7809e9dc1459e4e63@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=vbabka@suse.cz \
    --cc=wangqing7171@gmail.com \
    /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