================================================================== BUG: KASAN: slab-use-after-free in list_empty include/linux/list.h:381 [inline] BUG: KASAN: slab-use-after-free in gfs2_discard fs/gfs2/aops.c:589 [inline] BUG: KASAN: slab-use-after-free in gfs2_invalidate_folio+0x40b/0x750 fs/gfs2/aops.c:627 Read of size 8 at addr ffff88801f4c32b8 by task syz.0.0/5336 CPU: 0 UID: 0 PID: 5336 Comm: syz.0.0 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 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 list_empty include/linux/list.h:381 [inline] gfs2_discard fs/gfs2/aops.c:589 [inline] gfs2_invalidate_folio+0x40b/0x750 fs/gfs2/aops.c:627 folio_invalidate mm/truncate.c:140 [inline] truncate_cleanup_folio+0x2d8/0x430 mm/truncate.c:160 truncate_inode_pages_range+0x233/0xd90 mm/truncate.c:404 gfs2_evict_inode+0x87a/0x1000 fs/gfs2/super.c:1426 evict+0x5f4/0xae0 fs/inode.c:837 gfs2_evict_inodes fs/gfs2/ops_fstype.c:1760 [inline] gfs2_kill_sb+0x2bc/0x430 fs/gfs2/ops_fstype.c:1786 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1318 task_work_run+0x1d4/0x260 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x6c5/0x2310 kernel/exit.c:971 do_group_exit+0x21c/0x2d0 kernel/exit.c:1112 __do_sys_exit_group kernel/exit.c:1123 [inline] __se_sys_exit_group kernel/exit.c:1121 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1121 x64_sys_call+0x2210/0x2210 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f07cf38f7c9 Code: Unable to access opcode bytes at 0x7f07cf38f79f. RSP: 002b:00007ffd64086d18 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f07cf38f7c9 RDX: 0000000000000064 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000003 R08: 0000001364086e0f R09: 00007f07cf5b4280 R10: 0000000000028c7c R11: 0000000000000246 R12: 0000000000000000 R13: 00007f07cf5b4280 R14: 0000000000000003 R15: 00007ffd64086dd0 Allocated by task 5337: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 unpoison_slab_object mm/kasan/common.c:339 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:365 kasan_slab_alloc include/linux/kasan.h:252 [inline] slab_post_alloc_hook mm/slub.c:4953 [inline] slab_alloc_node mm/slub.c:5263 [inline] kmem_cache_alloc_noprof+0x37d/0x710 mm/slub.c:5270 gfs2_alloc_bufdata fs/gfs2/trans.c:173 [inline] gfs2_trans_add_data+0x200/0x620 fs/gfs2/trans.c:214 gfs2_unstuffer_folio fs/gfs2/bmap.c:81 [inline] __gfs2_unstuff_inode fs/gfs2/bmap.c:119 [inline] gfs2_unstuff_dinode+0xb38/0x1320 fs/gfs2/bmap.c:166 gfs2_iomap_begin_write fs/gfs2/bmap.c:1059 [inline] gfs2_iomap_begin+0x976/0x1170 fs/gfs2/bmap.c:1133 iomap_iter+0x5ef/0xeb0 fs/iomap/iter.c:110 iomap_file_buffered_write+0x23c/0x9c0 fs/iomap/buffered-io.c:1187 gfs2_file_buffered_write+0x4ed/0x880 fs/gfs2/file.c:1061 gfs2_file_write_iter+0x94e/0x1100 fs/gfs2/file.c:1166 aio_write+0x535/0x7a0 fs/aio.c:1634 __io_submit_one fs/aio.c:-1 [inline] io_submit_one+0x775/0x1430 fs/aio.c:2053 __do_sys_io_submit fs/aio.c:2112 [inline] __se_sys_io_submit+0x185/0x320 fs/aio.c:2082 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5337: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6668 [inline] kmem_cache_free+0x197/0x620 mm/slub.c:6779 trans_drain fs/gfs2/log.c:1015 [inline] gfs2_log_flush+0x17a2/0x24c0 fs/gfs2/log.c:1153 gfs2_jdata_writepages+0xf9/0x150 fs/gfs2/aops.c:370 do_writepages+0x32e/0x550 mm/page-writeback.c:2598 filemap_writeback mm/filemap.c:387 [inline] filemap_fdatawrite_range+0x1a5/0x250 mm/filemap.c:412 gfs2_fsync+0xd8/0x370 fs/gfs2/file.c:752 generic_write_sync include/linux/fs.h:2616 [inline] gfs2_file_write_iter+0xeb7/0x1100 fs/gfs2/file.c:1168 aio_write+0x535/0x7a0 fs/aio.c:1634 __io_submit_one fs/aio.c:-1 [inline] io_submit_one+0x775/0x1430 fs/aio.c:2053 __do_sys_io_submit fs/aio.c:2112 [inline] __se_sys_io_submit+0x185/0x320 fs/aio.c:2082 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88801f4c32a0 which belongs to the cache gfs2_bufdata of size 80 The buggy address is located 24 bytes inside of freed 80-byte region [ffff88801f4c32a0, ffff88801f4c32f0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f4c3 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff888000b48b40 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080240024 00000000f5000000 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 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5337, tgid 5336 (syz.0.0), ts 77134615042, free_ts 76877298661 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x234/0x290 mm/page_alloc.c:1846 prep_new_page mm/page_alloc.c:1854 [inline] get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3915 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5210 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab+0x86/0x3b0 mm/slub.c:3248 new_slab mm/slub.c:3302 [inline] ___slab_alloc+0xf2b/0x1960 mm/slub.c:4656 __slab_alloc+0x65/0x100 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] kmem_cache_alloc_noprof+0x40f/0x710 mm/slub.c:5270 gfs2_alloc_bufdata fs/gfs2/trans.c:173 [inline] gfs2_trans_add_meta+0x2cf/0x960 fs/gfs2/trans.c:276 gfs2_alloc_extent fs/gfs2/rgrp.c:2237 [inline] gfs2_alloc_blocks+0x7a0/0x2080 fs/gfs2/rgrp.c:2447 alloc_dinode+0x258/0x550 fs/gfs2/inode.c:436 gfs2_create_inode+0xbc8/0x15b0 fs/gfs2/inode.c:822 gfs2_symlink+0xc0/0x100 fs/gfs2/inode.c:1334 vfs_symlink+0x294/0x2d0 fs/namei.c:5514 do_symlinkat+0x1f5/0x3c0 fs/namei.c:5541 __do_sys_symlink fs/namei.c:5567 [inline] __se_sys_symlink fs/namei.c:5565 [inline] __x64_sys_symlink+0x7a/0x90 fs/namei.c:5565 page last free pid 5337 tgid 5336 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] free_unref_folios+0xdb3/0x14f0 mm/page_alloc.c:3000 folios_put_refs+0x584/0x670 mm/swap.c:1002 folio_batch_release include/linux/pagevec.h:101 [inline] truncate_inode_pages_range+0x346/0xd90 mm/truncate.c:408 kill_bdev block/bdev.c:91 [inline] set_blocksize+0x32a/0x500 block/bdev.c:207 sb_set_blocksize+0xf8/0x240 block/bdev.c:241 init_sb+0x9aa/0x12c0 fs/gfs2/ops_fstype.c:490 gfs2_fill_super+0x16a6/0x21b0 fs/gfs2/ops_fstype.c:1217 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1691 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1332 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88801f4c3180: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb ffff88801f4c3200: fb fb fc fc fc fc fa fb fb fb fb fb fb fb fb fb >ffff88801f4c3280: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fc fc ^ ffff88801f4c3300: fc fc fa fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88801f4c3380: fa fb fb fb fb fb fb fb fb fb fc fc fc fc fa fb ==================================================================