syzbot


KASAN: use-after-free Read in gfs2_invalidate_folio

Status: upstream: reported on 2025/05/16 19:32
Reported-by: syzbot+ad31dfa0b430a4497f2a@syzkaller.appspotmail.com
First crash: 124d, last: 10d
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 KASAN: slab-use-after-free Read in gfs2_invalidate_folio 19 2 44d 44d 0/2 upstream: reported on 2025/08/04 00:39
upstream KASAN: slab-use-after-free Read in gfs2_invalidate_folio gfs2 19 C error 70 10h48m 524d 0/29 upstream: reported C repro on 2024/04/11 16:17

Sample crash report:
RBP: 00007ffb02811c05 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000206 R12: 00007fffaca66a10
R13: 00007ffb02811c05 R14: 0000555565c974a8 R15: 00007fffaca67ae0
 </TASK>
==================================================================
BUG: KASAN: use-after-free in list_empty include/linux/list.h:292 [inline]
BUG: KASAN: use-after-free in gfs2_discard fs/gfs2/aops.c:618 [inline]
BUG: KASAN: use-after-free in gfs2_invalidate_folio+0x455/0xa70 fs/gfs2/aops.c:656
Read of size 8 at addr ffff88807d3612b8 by task syz-executor/4264

CPU: 1 PID: 4264 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:420
 kasan_report+0x10b/0x140 mm/kasan/report.c:524
 list_empty include/linux/list.h:292 [inline]
 gfs2_discard fs/gfs2/aops.c:618 [inline]
 gfs2_invalidate_folio+0x455/0xa70 fs/gfs2/aops.c:656
 folio_invalidate mm/truncate.c:158 [inline]
 truncate_cleanup_folio+0x218/0x5e0 mm/truncate.c:178
 truncate_inode_pages_range+0x237/0xff0 mm/truncate.c:368
 gfs2_evict_inode+0xab5/0x1170 fs/gfs2/super.c:1511
 evict+0x485/0x870 fs/inode.c:705
 gfs2_put_super+0x412/0x8c0 fs/gfs2/super.c:616
 generic_shutdown_super+0x130/0x340 fs/super.c:501
 kill_block_super+0x7c/0xe0 fs/super.c:1470
 deactivate_locked_super+0x93/0xf0 fs/super.c:332
 cleanup_mnt+0x463/0x4f0 fs/namespace.c:1182
 task_work_run+0x1ca/0x250 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7ffb0278ff17
Code: a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 a8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007fffaca65868 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000064 RCX: 00007ffb0278ff17
RDX: 0000000000000200 RSI: 0000000000000009 RDI: 00007fffaca66a10
RBP: 00007ffb02811c05 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000206 R12: 00007fffaca66a10
R13: 00007ffb02811c05 R14: 0000555565c974a8 R15: 00007fffaca67ae0
 </TASK>

Allocated by task 4564:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6b/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x123/0x2f0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 gfs2_alloc_bufdata fs/gfs2/trans.c:168 [inline]
 gfs2_trans_add_data+0x1fb/0x610 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+0xf61/0x1770 fs/gfs2/bmap.c:168
 gfs2_adjust_quota+0x234/0x810 fs/gfs2/quota.c:847
 gfs2_set_dqblk+0x96e/0xc10 fs/gfs2/quota.c:1738
 quota_setquota+0x4ac/0x530 fs/quota/quota.c:310
 __do_sys_quotactl fs/quota/quota.c:960 [inline]
 __se_sys_quotactl+0x295/0x6b0 fs/quota/quota.c:916
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4264:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1750
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0xf7/0x290 mm/slub.c:3683
 trans_drain fs/gfs2/log.c:1023 [inline]
 gfs2_log_flush+0x1902/0x24e0 fs/gfs2/log.c:1161
 gfs2_kill_sb+0x50/0xd0 fs/gfs2/ops_fstype.c:1729
 deactivate_locked_super+0x93/0xf0 fs/super.c:332
 cleanup_mnt+0x463/0x4f0 fs/namespace.c:1182
 task_work_run+0x1ca/0x250 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

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

The buggy address belongs to the physical page:
page:ffffea0001f4d840 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d361
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff88801c3a68c0
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 4536, tgid 4535 (syz.3.25), ts 98031057320, free_ts 97460224860
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614
 alloc_slab_page+0x5d/0x160 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x87/0x2c0 mm/slub.c:1992
 ___slab_alloc+0xbc6/0x1220 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1b7/0x2f0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 gfs2_alloc_bufdata fs/gfs2/trans.c:168 [inline]
 gfs2_trans_add_meta+0x34e/0xc60 fs/gfs2/trans.c:250
 gfs2_alloc_extent fs/gfs2/rgrp.c:2239 [inline]
 gfs2_alloc_blocks+0x79b/0x2070 fs/gfs2/rgrp.c:2450
 alloc_dinode+0x2e5/0x4f0 fs/gfs2/inode.c:405
 gfs2_create_inode+0xc73/0x1400 fs/gfs2/inode.c:712
 gfs2_atomic_open+0xce/0x210 fs/gfs2/inode.c:1293
 atomic_open fs/namei.c:3345 [inline]
 lookup_open fs/namei.c:3453 [inline]
 open_last_lookups fs/namei.c:3550 [inline]
 path_openat+0xe20/0x2e70 fs/namei.c:3780
 do_filp_open+0x1c1/0x3c0 fs/namei.c:3810
 do_sys_openat2+0x142/0x490 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_open fs/open.c:1342 [inline]
 __se_sys_open fs/open.c:1338 [inline]
 __x64_sys_open+0x11b/0x140 fs/open.c:1338
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
 free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3525
 release_pages+0x1f92/0x2200 mm/swap.c:1035
 __pagevec_release+0x6d/0xe0 mm/swap.c:1055
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 truncate_inode_pages_range+0x2f6/0xff0 mm/truncate.c:372
 gfs2_find_jhead+0xc5d/0xd00 fs/gfs2/lops.c:602
 gfs2_make_fs_rw+0x1f4/0x560 fs/gfs2/super.c:140
 gfs2_fill_super+0x1888/0x1f80 fs/gfs2/ops_fstype.c:1271
 get_tree_bdev+0x3f1/0x610 fs/super.c:1366
 gfs2_get_tree+0x4d/0x1e0 fs/gfs2/ops_fstype.c:1327
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x24a/0xa40 fs/namespace.c:3069
 do_mount fs/namespace.c:3412 [inline]
 __do_sys_mount fs/namespace.c:3620 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3597
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff88807d361180: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb
 ffff88807d361200: fb fb fc fc fc fc fa fb fb fb fb fb fb fb fb fb
>ffff88807d361280: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fc fc
                                        ^
 ffff88807d361300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807d361380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/07 09:03 linux-6.1.y 28c695c365e1 d291dd2d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/09/05 22:48 linux-6.1.y 28c695c365e1 d291dd2d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/09/05 21:46 linux-6.1.y 28c695c365e1 d291dd2d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/09/05 20:56 linux-6.1.y 28c695c365e1 d291dd2d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/08/18 14:57 linux-6.1.y 0bc96de781b4 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/08/18 00:25 linux-6.1.y 0bc96de781b4 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/08/18 00:21 linux-6.1.y 0bc96de781b4 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/08/01 21:38 linux-6.1.y 3594f306da12 40127d41 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in gfs2_invalidate_folio
2025/05/16 19:32 linux-6.1.y 02b72ccb5f9d cfde8269 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in gfs2_invalidate_folio
* Struck through repros no longer work on HEAD.