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: 185d, last: 46d
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 156 3d12h 664d 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 20 32d 264d 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 ffff888019b9a248 by task syz-executor/13208

CPU: 0 PID: 13208 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/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:0x7f8b3958f749
Code: Unable to access opcode bytes at 0x7f8b3958f71f.
RSP: 002b:00007fff408e1418 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f8b39613da2 RCX: 00007f8b3958f749
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000005 R08: 00007fff408df1b7 R09: 00007fff408e2670
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff408e2670
R13: 00007f8b39613d7d R14: 00000000000b668a R15: 00007fff408e26b0
 </TASK>

Allocated by task 13703:
 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_unstuffer_page fs/gfs2/bmap.c:83 [inline]
 __gfs2_unstuff_inode fs/gfs2/bmap.c:121 [inline]
 gfs2_unstuff_dinode+0xb3a/0x17d0 fs/gfs2/bmap.c:168
 gfs2_iomap_begin_write fs/gfs2/bmap.c:1050 [inline]
 gfs2_iomap_begin+0x9ea/0x1260 fs/gfs2/bmap.c:1126
 iomap_iter+0x6b1/0xec0 fs/iomap/iter.c:91
 iomap_file_buffered_write+0x1b5/0xd10 fs/iomap/buffered-io.c:974
 gfs2_file_buffered_write+0x4bd/0x820 fs/gfs2/file.c:1060
 gfs2_file_write_iter+0x427/0xe10 fs/gfs2/file.c:1158
 call_write_iter include/linux/fs.h:2018 [inline]
 aio_write+0x53c/0x790 fs/aio.c:1593
 __io_submit_one fs/aio.c:-1 [inline]
 io_submit_one+0x70b/0x1240 fs/aio.c:2012
 __do_sys_io_submit fs/aio.c:2071 [inline]
 __se_sys_io_submit+0x194/0x300 fs/aio.c:2041
 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 13703:
 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
 call_write_iter include/linux/fs.h:2018 [inline]
 aio_write+0x53c/0x790 fs/aio.c:1593
 __io_submit_one fs/aio.c:-1 [inline]
 io_submit_one+0x70b/0x1240 fs/aio.c:2012
 __do_sys_io_submit fs/aio.c:2071 [inline]
 __se_sys_io_submit+0x194/0x300 fs/aio.c:2041
 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 ffff888019b9a230
 which belongs to the cache gfs2_bufdata of size 80
The buggy address is located 24 bytes inside of
 freed 80-byte region [ffff888019b9a230, ffff888019b9a280)

The buggy address belongs to the physical page:
page:ffffea000066e680 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19b9a
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000800 ffff888142ef0640 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 13703, tgid 13702 (syz.6.2362), ts 791957813938, free_ts 787438960087
 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
 gfs2_alloc_extent fs/gfs2/rgrp.c:2239 [inline]
 gfs2_alloc_blocks+0x79a/0x2060 fs/gfs2/rgrp.c:2449
 alloc_dinode+0x273/0x580 fs/gfs2/inode.c:421
 gfs2_create_inode+0xcb4/0x1430 fs/gfs2/inode.c:739
 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
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+0x32/0x2e0 mm/page_alloc.c:2429
 vfree+0x1a6/0x320 mm/vmalloc.c:2868
 kcov_put kernel/kcov.c:438 [inline]
 kcov_close+0x2b/0x50 kernel/kcov.c:534
 __fput+0x234/0x970 fs/file_table.c:384
 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

Memory state around the buggy address:
 ffff888019b9a100: fb fb fb fb fb fb fc fc fc fc fa fb fb fb fb fb
 ffff888019b9a180: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb
>ffff888019b9a200: fb fb fc fc fc fc fa fb fb fb fb fb fb fb fb fb
                                              ^
 ffff888019b9a280: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fc fc
 ffff888019b9a300: fc fc fa fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Crashes (18):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/12/20 21:44 linux-6.6.y 5fa4793a2d2d 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/12/05 23:44 linux-6.6.y 4791134e4aeb 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/12/05 12:06 linux-6.6.y 4791134e4aeb 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/12/05 12:03 linux-6.6.y 4791134e4aeb 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/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.