[syzbot] [f2fs?] kernel BUG in folio_end_read (2)

syzbot
2025-09-18T13:13:29Z

Hello,

syzbot found the following issue on:

HEAD commit: f83a4f2a4d8c Merge tag 'erofs-for-6.17-rc6-fixes' of git:/..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16830762580000
kernel config: https://syzkaller.appspot.com/x/.config?x=bf99f2510ef92ba5
dashboard link: https://syzkaller.appspot.com/bug?extid=3686758660f980b402dc
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-f83a4f2a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3e6c4d9a21b6/vmlinux-f83a4f2a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7bbbc8ebb9ba/bzImage-f83a4f2a.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3686758660f980b402dc@syzkaller.appspotmail.com

page: refcount:2 mapcount:0 mapping:ffff888043b30220 index:0x1201 pfn:0x1145b
memcg:ffff88801c6a8d00
aops:f2fs_meta_aops ino:2
flags: 0xfff200000000a9(locked|waiters|uptodate|lru|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff200000000a9 ffffea00006927c8 ffffea0000472b08 ffff888043b30220
raw: 0000000000001201 0000000000000000 00000002ffffffff ffff88801c6a8d00
page dumped because: VM_BUG_ON_FOLIO(success && folio_test_uptodate(folio))
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x40c40(GFP_NOFS|__GFP_COMP), pid 5369, tgid 5367 (syz.0.0), ts 88439663476, free_ts 88354226936
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
alloc_frozen_pages_noprof mm/mempolicy.c:2487 [inline]
alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2507
folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2517
filemap_alloc_folio_noprof+0xdf/0x470 mm/filemap.c:1007
__filemap_get_folio+0x3f2/0xaf0 mm/filemap.c:1981
pagecache_get_page+0x2a/0x130 mm/folio-compat.c:81
f2fs_pagecache_get_page fs/f2fs/f2fs.h:2908 [inline]
ra_data_block+0x505/0xc90 fs/f2fs/gc.c:1266
gc_data_segment fs/f2fs/gc.c:1630 [inline]
do_garbage_collect+0x2f1f/0x6410 fs/f2fs/gc.c:1826
f2fs_gc+0xc87/0x2590 fs/f2fs/gc.c:1931
f2fs_balance_fs+0x5f7/0x7f0 fs/f2fs/segment.c:466
f2fs_write_single_data_page+0xfaf/0x16a0 fs/f2fs/data.c:2906
f2fs_write_cache_pages fs/f2fs/data.c:3141 [inline]
__f2fs_write_data_pages fs/f2fs/data.c:3290 [inline]
f2fs_write_data_pages+0x195b/0x3000 fs/f2fs/data.c:3317
do_writepages+0x32b/0x550 mm/page-writeback.c:2634
page last free pid 4841 tgid 4841 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895
__slab_free+0x303/0x3c0 mm/slub.c:4606
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:340
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4191 [inline]
slab_alloc_node mm/slub.c:4240 [inline]
__kmalloc_cache_noprof+0x1be/0x3d0 mm/slub.c:4402
kmalloc_noprof include/linux/slab.h:905 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
nsim_fib6_rt_create drivers/net/netdevsim/fib.c:547 [inline]
nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:752 [inline]
nsim_fib6_event drivers/net/netdevsim/fib.c:856 [inline]
nsim_fib_event drivers/net/netdevsim/fib.c:889 [inline]
nsim_fib_event_work+0x1174/0x3180 drivers/net/netdevsim/fib.c:1493
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x436/0x7d0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
------------[ cut here ]------------
kernel BUG at mm/filemap.c:1525!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 3024 Comm: kworker/u4:11 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: loop0 loop_workfn
RIP: 0010:folio_end_read+0x22e/0x230 mm/filemap.c:1525
Code: a5 c7 ff 48 89 df 48 c7 c6 c0 4f b4 8b e8 aa d3 2f ff 90 0f 0b e8 d2 a5 c7 ff 48 89 df 48 c7 c6 20 48 b4 8b e8 93 d3 2f ff 90 <0f> 0b 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa
RSP: 0018:ffffc9000daa7328 EFLAGS: 00010246
RAX: 914fe16334449200 RBX: ffffea00004516c0 RCX: 0000000000000000
RDX: 0000000000000006 RSI: ffffffff8dbbcae2 RDI: 00000000ffffffff
RBP: 0000000000000001 R08: ffffffff8fc3c537 R09: 1ffffffff1f878a6
R10: dffffc0000000000 R11: fffffbfff1f878a7 R12: 1ffffd400008a2d9
R13: 1ffffd400008a2d8 R14: ffffea00004516c8 R15: 0000000000000008
FS: 0000000000000000(0000) GS:ffff88808d00a000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200001000000 CR3: 0000000011f6e000 CR4: 0000000000352ef0
Call Trace:
<TASK>
f2fs_finish_read_bio+0x2e1/0x3e0 fs/f2fs/data.c:154
f2fs_read_end_io+0x360/0x980 fs/f2fs/data.c:-1
blk_update_request+0x57e/0xe60 block/blk-mq.c:989
blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1151
lo_rw_aio_complete drivers/block/loop.c:337 [inline]
lo_rw_aio+0xd75/0xfa0 drivers/block/loop.c:411
do_req_filebacked drivers/block/loop.c:-1 [inline]
loop_handle_cmd drivers/block/loop.c:1919 [inline]
loop_process_work+0x835/0xf90 drivers/block/loop.c:1954
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x436/0x7d0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:folio_end_read+0x22e/0x230 mm/filemap.c:1525
Code: a5 c7 ff 48 89 df 48 c7 c6 c0 4f b4 8b e8 aa d3 2f ff 90 0f 0b e8 d2 a5 c7 ff 48 89 df 48 c7 c6 20 48 b4 8b e8 93 d3 2f ff 90 <0f> 0b 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa
RSP: 0018:ffffc9000daa7328 EFLAGS: 00010246
RAX: 914fe16334449200 RBX: ffffea00004516c0 RCX: 0000000000000000
RDX: 0000000000000006 RSI: ffffffff8dbbcae2 RDI: 00000000ffffffff
RBP: 0000000000000001 R08: ffffffff8fc3c537 R09: 1ffffffff1f878a6
R10: dffffc0000000000 R11: fffffbfff1f878a7 R12: 1ffffd400008a2d9
R13: 1ffffd400008a2d8 R14: ffffea00004516c8 R15: 0000000000000008
FS: 0000000000000000(0000) GS:ffff88808d00a000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200001000000 CR3: 00000000114b2000 CR4: 0000000000352ef0

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup