syzbot


KASAN: slab-use-after-free Read in gfs2_invalidate_folio

Status: upstream: reported on 2025/08/04 00:39
Reported-by: syzbot+3e3a6a1d24303b7797e2@syzkaller.appspotmail.com
First crash: 123d, last: 7d10h
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in gfs2_invalidate_folio gfs2 19 C error 127 5h45m 602d 0/29 upstream: reported C repro on 2024/04/11 16:17
linux-6.1 KASAN: use-after-free Read in gfs2_invalidate_folio 19 16 7d08h 202d 0/3 upstream: reported on 2025/05/16 19:32

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in list_empty include/linux/list.h:373 [inline]
BUG: KASAN: slab-use-after-free in gfs2_discard fs/gfs2/aops.c:622 [inline]
BUG: KASAN: slab-use-after-free in gfs2_invalidate_folio+0x463/0xa50 fs/gfs2/aops.c:660
Read of size 8 at addr ffff88805d02b088 by task syz-executor/15037

CPU: 1 PID: 15037 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xac/0x220 mm/kasan/report.c:468
 kasan_report+0x117/0x150 mm/kasan/report.c:581
 list_empty include/linux/list.h:373 [inline]
 gfs2_discard fs/gfs2/aops.c:622 [inline]
 gfs2_invalidate_folio+0x463/0xa50 fs/gfs2/aops.c:660
 folio_invalidate mm/truncate.c:158 [inline]
 truncate_cleanup_folio+0x220/0x5c0 mm/truncate.c:178
 truncate_inode_pages_range+0x229/0xf00 mm/truncate.c:392
 gfs2_evict_inode+0x3d8/0x1220 fs/gfs2/super.c:1537
 evict+0x486/0x870 fs/inode.c:705
 gfs2_evict_inodes fs/gfs2/ops_fstype.c:1770 [inline]
 gfs2_kill_sb+0x230/0x320 fs/gfs2/ops_fstype.c:1796
 deactivate_locked_super+0x97/0x100 fs/super.c:481
 cleanup_mnt+0x429/0x4c0 fs/namespace.c:1259
 task_work_run+0x1ce/0x250 kernel/task_work.c:239
 exit_task_work include/linux/task_work.h:43 [inline]
 do_exit+0x90b/0x23c0 kernel/exit.c:883
 do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
 __do_sys_exit_group kernel/exit.c:1035 [inline]
 __se_sys_exit_group kernel/exit.c:1033 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1033
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f6db0b8f749
Code: Unable to access opcode bytes at 0x7f6db0b8f71f.
RSP: 002b:00007ffde087da08 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f6db0c13da2 RCX: 00007f6db0b8f749
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000005 R08: 00007ffde087b7a7 R09: 00007ffde087ec60
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffde087ec60
R13: 00007f6db0c13d7d R14: 0000000000239b16 R15: 00007ffde087eca0
 </TASK>

Allocated by task 26012:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3495 [inline]
 slab_alloc mm/slub.c:3503 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3510 [inline]
 kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3519
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 gfs2_alloc_bufdata fs/gfs2/trans.c:168 [inline]
 gfs2_trans_add_data+0x1ff/0x620 fs/gfs2/trans.c:209
 gfs2_trans_add_databufs+0x15a/0x1c0 fs/gfs2/aops.c:57
 gfs2_iomap_put_folio+0x1be/0x400 fs/gfs2/bmap.c:988
 iomap_write_end+0x631/0xb90 fs/iomap/buffered-io.c:860
 iomap_write_iter fs/iomap/buffered-io.c:926 [inline]
 iomap_file_buffered_write+0x710/0xd10 fs/iomap/buffered-io.c:975
 gfs2_file_buffered_write+0x4bd/0x820 fs/gfs2/file.c:1060
 gfs2_file_write_iter+0x427/0xe10 fs/gfs2/file.c:1158
 do_iter_readv_writev fs/read_write.c:-1 [inline]
 do_iter_write+0x79a/0xc70 fs/read_write.c:860
 vfs_writev fs/read_write.c:933 [inline]
 do_pwritev+0x205/0x340 fs/read_write.c:1030
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 26012:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1811 [inline]
 slab_free_freelist_hook+0x130/0x1b0 mm/slub.c:1837
 slab_free mm/slub.c:3830 [inline]
 kmem_cache_free+0xf8/0x280 mm/slub.c:3852
 trans_drain fs/gfs2/log.c:1022 [inline]
 gfs2_log_flush+0x18d1/0x24b0 fs/gfs2/log.c:1162
 gfs2_jdata_writepages+0xf9/0x150 fs/gfs2/aops.c:398
 do_writepages+0x3a2/0x600 mm/page-writeback.c:2575
 filemap_fdatawrite_wbc+0x122/0x180 mm/filemap.c:390
 __filemap_fdatawrite_range mm/filemap.c:423 [inline]
 filemap_fdatawrite_range+0xce/0x120 mm/filemap.c:441
 gfs2_fsync+0xdf/0x350 fs/gfs2/file.c:751
 generic_write_sync include/linux/fs.h:2651 [inline]
 gfs2_file_write_iter+0xc72/0xe10 fs/gfs2/file.c:1160
 do_iter_readv_writev fs/read_write.c:-1 [inline]
 do_iter_write+0x79a/0xc70 fs/read_write.c:860
 vfs_writev fs/read_write.c:933 [inline]
 do_pwritev+0x205/0x340 fs/read_write.c:1030
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88805d02b070
 which belongs to the cache gfs2_bufdata of size 80
The buggy address is located 24 bytes inside of
 freed 80-byte region [ffff88805d02b070, ffff88805d02b0c0)

The buggy address belongs to the physical page:
page:ffffea0001740ac0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5d02b
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000800 ffff8881432bf500 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080240024 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 26012, tgid 25961 (syz.5.4866), ts 2333282741712, free_ts 2332436771983
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
 prep_new_page mm/page_alloc.c:1561 [inline]
 get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
 __alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
 alloc_slab_page+0x5d/0x170 mm/slub.c:1881
 allocate_slab mm/slub.c:2028 [inline]
 new_slab+0x87/0x2e0 mm/slub.c:2081
 ___slab_alloc+0xc6d/0x1300 mm/slub.c:3253
 __slab_alloc mm/slub.c:3339 [inline]
 __slab_alloc_node mm/slub.c:3392 [inline]
 slab_alloc_node mm/slub.c:3485 [inline]
 slab_alloc mm/slub.c:3503 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3510 [inline]
 kmem_cache_alloc+0x1b7/0x2e0 mm/slub.c:3519
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 gfs2_alloc_bufdata fs/gfs2/trans.c:168 [inline]
 gfs2_trans_add_meta+0x30c/0xc20 fs/gfs2/trans.c:251
 init_dinode+0x92/0xa70 fs/gfs2/inode.c:500
 gfs2_create_inode+0xf32/0x1430 fs/gfs2/inode.c:776
 gfs2_atomic_open+0xd2/0x220 fs/gfs2/inode.c:1315
 atomic_open fs/namei.c:3359 [inline]
 lookup_open fs/namei.c:3467 [inline]
 open_last_lookups fs/namei.c:3564 [inline]
 path_openat+0xf27/0x3190 fs/namei.c:3794
 do_filp_open+0x1c5/0x3d0 fs/namei.c:3824
 do_sys_openat2+0x12c/0x1c0 fs/open.c:1421
 do_sys_open fs/open.c:1436 [inline]
 __do_sys_openat fs/open.c:1452 [inline]
 __se_sys_openat fs/open.c:1447 [inline]
 __x64_sys_openat+0x139/0x160 fs/open.c:1447
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1154 [inline]
 free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
 free_unref_page_list+0xbe/0x860 mm/page_alloc.c:2475
 release_pages+0x1fa0/0x2220 mm/swap.c:1022
 tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
 tlb_flush_mmu+0x368/0x4f0 mm/mmu_gather.c:300
 tlb_finish_mmu+0xc3/0x1d0 mm/mmu_gather.c:392
 exit_mmap+0x3f0/0xb50 mm/mmap.c:3315
 __mmput+0x118/0x3c0 kernel/fork.c:1355
 exit_mm+0x1da/0x2c0 kernel/exit.c:569
 do_exit+0x88e/0x23c0 kernel/exit.c:870
 do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
 get_signal+0x12fc/0x1400 kernel/signal.c:2902
 arch_do_signal_or_restart+0x9c/0x7b0 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
 exit_to_user_mode_prepare+0xf6/0x180 kernel/entry/common.c:210
 irqentry_exit_to_user_mode+0x9/0x40 kernel/entry/common.c:315
 exc_page_fault+0x8f/0x110 arch/x86/mm/fault.c:1524

Memory state around the buggy address:
 ffff88805d02af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88805d02b000: fa fb fb fb fb fb fb fb fb fb fc fc fc fc fa fb
>ffff88805d02b080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                      ^
 ffff88805d02b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805d02b180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/11/27 16:11 linux-6.6.y 1e89a1be4fe9 d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/11/25 19:42 linux-6.6.y 1e89a1be4fe9 64219f15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/11/24 21:02 linux-6.6.y 1e89a1be4fe9 bf6fe8fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/11/24 20:59 linux-6.6.y 1e89a1be4fe9 bf6fe8fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/11/09 16:43 linux-6.6.y 0a805b6ea8cd 4e1406b4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/24 01:21 linux-6.6.y 4a243110dc88 c0460fcd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/13 07:30 linux-6.6.y 655054d2c3c1 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/10 22:30 linux-6.6.y e617101e5626 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/10 22:29 linux-6.6.y e617101e5626 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/10 22:26 linux-6.6.y e617101e5626 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/10 22:23 linux-6.6.y e617101e5626 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/10/07 20:23 linux-6.6.y e617101e5626 8ef35d49 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/08/04 00:41 linux-6.6.y 3a8ababb8b6a 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
2025/08/04 00:38 linux-6.6.y 3a8ababb8b6a 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in gfs2_invalidate_folio
* Struck through repros no longer work on HEAD.