All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: harry.yoo@oracle.com
Cc: akpm@linux-foundation.org, cl@gentwo.org, coregee2000@gmail.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	rientjes@google.com, roman.gushchin@linux.dev,
	syzkaller@googlegroups.com, vbabka@suse.cz, vernon2gm@gmail.com,
	Lance Yang <lance.yang@linux.dev>
Subject: Re: [Kernel Bug] WARNING in mempool_alloc_noprof
Date: Tue,  3 Feb 2026 14:44:59 +0800	[thread overview]
Message-ID: <20260203064505.47693-1-lance.yang@linux.dev> (raw)
In-Reply-To: <aYBiza9L1hmhmXbb@hyeyoo>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 4965 bytes --]


On Mon, 2 Feb 2026 17:39:41 +0900, Harry Yoo wrote:
> On Mon, Feb 02, 2026 at 02:40:14PM +0800, 李龙兴 wrote:
> > Dear Linux kernel developers and maintainers,
> > 
> > We would like to report a new kernel bug found by our tool. WARNING in
> > mempool_alloc_noprof. Details are as follows.
> > 
> > Kernel commit: v6.12.11
> > Kernel config: see attachment
> > report: see attachment
> > 
> > We are currently analyzing the root cause and  working on a
> > reproducible PoC. We will provide further updates in this thread as
> > soon as we have more information.
> > 
> > Best regards,
> > Longxing Li
> > 
> > ------------[ cut here ]------------
> > WARNING: CPU: 1 PID: 362734 at mm/page_alloc.c:4234
> > __alloc_pages_slowpath mm/page_alloc.c:4234 [inline]
> > WARNING: CPU: 1 PID: 362734 at mm/page_alloc.c:4234
> > __alloc_pages_noprof+0x2025/0x25a0 mm/page_alloc.c:4766
> > Modules linked in:
> > CPU: 1 UID: 0 PID: 362734 Comm: syz-executor.5 Not tainted 6.12.11 #1
> > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> > RIP: 0010:__alloc_pages_slowpath mm/page_alloc.c:4234 [inline]
> > RIP: 0010:__alloc_pages_noprof+0x2025/0x25a0 mm/page_alloc.c:4766
> 
> page allocator triggers a warning when __GFP_NOFAIL is set but
> __GFP_DIRECT_RECLAIM is not set.

Good catch!

> 
> > Code: 10 00 00 00 44 8b 74 24 48 41 89 c5 0f b6 c0 44 8b a4 24 84 00
> > 00 00 89 44 24 28 e9 e5 f6 ff ff 90 0f 0b 90 e9 f1 f6 ff ff 90 <0f> 0b
> > 90 e9 1e fb ff ff e8 2e a4 38 09 e9 5e ed ff ff 4c 89 f7 e8
> > RSP: 0000:ffffc9003ce9e7d0 EFLAGS: 00010246
> > RAX: 0000000000008000 RBX: 0000000000000000 RCX: ffffc9003ce9e8fc
> > RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff88813fff99c8
> > RBP: 0000000000000000 R08: 000000000000028d R09: 0000000000000000
> > R10: ffff88807fffbc17 R11: 0000000000000000 R12: 000000000009a800
> > R13: 000000000009a800 R14: 1ffff920079d3d0e R15: 0000000000000001
> > FS:  00007f1784eff640(0000) GS:ffff888135e00000(0000) knlGS:0000000000000000
> > CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 000055bb25a85a28 CR3: 0000000096938000 CR4: 0000000000752ef0
> > PKRU: 55555554
> > Call Trace:
> >  <TASK>
> >  alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2269
> >  mempool_alloc_noprof+0x176/0x390 mm/mempool.c:402
> 
> the user of the mempool (f2fs_encrypt_one_page) passed __GFP_DIRECT_RECLAIM,
> but mempool temporarily cleared it, but not __GFP_NOFAIL:
>    gfp_temp = gfp_mask & ~(__GFP_DIRECT_RECLAIM|__GFP_IO)
> 
> Hmm perhaps mempool should clear __GFP_NOFAIL as well when clearing
> __GFP_DIRECT_RECLAIM?

Right. Clearing __GFP_NOFAIL together with __GFP_DIRECT_RECLAIM should fix
it, IIUC.

I saw that Vernon's patch does exactly that.

> 
> >  fscrypt_alloc_bounce_page+0x28/0x60 fs/crypto/crypto.c:59
> >  fscrypt_encrypt_pagecache_blocks.cold+0x567/0x6da fs/crypto/crypto.c:202
> >  f2fs_encrypt_one_page+0x187/0x630 fs/f2fs/data.c:2516
> >  f2fs_do_write_data_page+0x7b4/0x1900 fs/f2fs/data.c:2706
> >  f2fs_write_single_data_page+0x1454/0x1c30 fs/f2fs/data.c:2872
> >  f2fs_write_cache_pages+0xd6e/0x24e0 fs/f2fs/data.c:3166
> >  __f2fs_write_data_pages fs/f2fs/data.c:3321 [inline]
> >  f2fs_write_data_pages+0x4af/0xdd0 fs/f2fs/data.c:3348
> >  do_writepages+0x1a3/0x7f0 mm/page-writeback.c:2683
> >  filemap_fdatawrite_wbc mm/filemap.c:398 [inline]
> >  filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388
> >  __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431
> >  file_write_and_wait_range+0xca/0x140 mm/filemap.c:788
> >  f2fs_do_sync_file+0x2dc/0x1ed0 fs/f2fs/file.c:278
> >  f2fs_sync_file+0x13a/0x1a0 fs/f2fs/file.c:395
> >  vfs_fsync_range+0x136/0x220 fs/sync.c:188
> >  generic_write_sync include/linux/fs.h:2871 [inline]
> >  f2fs_file_write_iter+0x12ba/0x2370 fs/f2fs/file.c:5057
> >  new_sync_write fs/read_write.c:590 [inline]
> >  vfs_write+0x5ae/0x1150 fs/read_write.c:683
> >  ksys_write+0x12f/0x260 fs/read_write.c:736
> >  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> >  do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
> >  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > RIP: 0033:0x471ecd
> > Code: c3 e8 17 28 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48
> > 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
> > 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
> > RSP: 002b:00007f1784eff058 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
> > RAX: ffffffffffffffda RBX: 000000000059bf80 RCX: 0000000000471ecd
> > RDX: 0000000000000002 RSI: 00000000200003c0 RDI: 0000000000000004
> > RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
> > R10: 0000000000000000 R11: 0000000000000246 R12: 000000000059bf8c
> > R13: 000000000000000b R14: 000000000059bf80 R15: 00007f1784edf000
> >  </TASK>
> > 
> > https://drive.google.com/file/d/17HbDTI_iPjA72SkV5MnO-_w7IQZ9HIHW/view?usp=drive_link
> > 
> > https://drive.google.com/file/d/19pMiWedcVz8nFrj9jiJXuCjyPbNjYQqq/view?usp=drive_link
> 


  parent reply	other threads:[~2026-02-03  6:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  6:40 [Kernel Bug] WARNING in mempool_alloc_noprof 李龙兴
2026-02-02  8:39 ` Harry Yoo
2026-02-03  3:47   ` Vernon Yang
2026-02-03  9:52     ` Harry Yoo
2026-02-03 16:27       ` Christoph Hellwig
2026-02-03 16:55         ` Vlastimil Babka
2026-02-03 16:59           ` Christoph Hellwig
2026-02-03 18:30             ` [f2fs-dev] " Vlastimil Babka
2026-02-03 18:30               ` Vlastimil Babka
2026-02-03 23:01               ` [f2fs-dev] " Eric Biggers via Linux-f2fs-devel
2026-02-03 23:01                 ` Eric Biggers
2026-02-03  6:44   ` Lance Yang [this message]
2026-02-03  8:44 ` Vlastimil Babka

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=20260203064505.47693-1-lance.yang@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=coregee2000@gmail.com \
    --cc=harry.yoo@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=syzkaller@googlegroups.com \
    --cc=vbabka@suse.cz \
    --cc=vernon2gm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.