================================================================== BUG: KASAN: use-after-free in __list_del_entry_valid+0x88/0x130 lib/list_debug.c:59 Read of size 8 at addr ffff8881184cc498 by task kworker/u4:5/12902 CPU: 0 PID: 12902 Comm: kworker/u4:5 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Workqueue: writeback wb_workfn (flush-7:3) Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 __list_del_entry_valid+0x88/0x130 lib/list_debug.c:59 __list_del_entry include/linux/list.h:132 [inline] list_del_init include/linux/list.h:204 [inline] __remove_dirty_inode fs/f2fs/checkpoint.c:1015 [inline] f2fs_remove_dirty_inode+0x217/0x3f0 fs/f2fs/checkpoint.c:1051 __f2fs_write_data_pages+0x245b/0x2c80 fs/f2fs/data.c:3219 f2fs_write_data_pages+0x74/0x80 fs/f2fs/data.c:3233 do_writepages+0x13a/0x280 mm/page-writeback.c:2358 __writeback_single_inode+0xb8/0x6e0 fs/fs-writeback.c:1467 writeback_sb_inodes+0x999/0x1700 fs/fs-writeback.c:1730 wb_writeback+0x42f/0xc20 fs/fs-writeback.c:1905 wb_do_writeback+0x222/0xbd0 fs/fs-writeback.c:2050 wb_workfn+0xf8/0x3f0 fs/fs-writeback.c:2091 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Allocated by task 160: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x1dd/0x330 mm/slub.c:2983 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] kernfs_iop_get_link+0x65/0x590 fs/kernfs/symlink.c:135 vfs_readlink+0x177/0x420 fs/namei.c:4631 do_readlinkat+0x28f/0x3b0 fs/stat.c:426 __do_sys_readlink fs/stat.c:447 [inline] __se_sys_readlink fs/stat.c:444 [inline] __x64_sys_readlink+0x7f/0x90 fs/stat.c:444 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 160: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 kfree_link+0x15/0x20 fs/libfs.c:1204 do_delayed_call include/linux/delayed_call.h:28 [inline] vfs_readlink+0x25f/0x420 fs/namei.c:4636 do_readlinkat+0x28f/0x3b0 fs/stat.c:426 __do_sys_readlink fs/stat.c:447 [inline] __se_sys_readlink fs/stat.c:444 [inline] __x64_sys_readlink+0x7f/0x90 fs/stat.c:444 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 The buggy address belongs to the object at ffff8881184cc000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1176 bytes inside of 4096-byte region [ffff8881184cc000, ffff8881184cd000) The buggy address belongs to the page: page:ffffea0004613200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1184c8 head:ffffea0004613200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 0000000000000000 0000000100000001 ffff888100042c00 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 383, ts 1399696173655, free_ts 1398386861344 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2386 [inline] prep_new_page mm/page_alloc.c:2392 [inline] get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2636 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x20e/0x330 mm/slub.c:2981 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] kobject_uevent_env+0x26c/0x730 lib/kobject_uevent.c:524 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642 __loop_clr_fd+0x5f8/0x9b0 drivers/block/loop.c:1253 lo_release+0x186/0x1f0 drivers/block/loop.c:1923 __blkdev_put+0x4ea/0x750 fs/block_dev.c:1799 blkdev_put+0x2b8/0x3a0 fs/block_dev.c:1861 kill_block_super+0xb3/0xe0 fs/super.c:1450 kill_f2fs_super+0x2f3/0x3c0 fs/f2fs/super.c:4368 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1332 [inline] free_pcp_prepare+0x18c/0x1c0 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3293 [inline] free_unref_page_list+0x11d/0x660 mm/page_alloc.c:3367 release_pages+0xc24/0xc60 mm/swap.c:1082 __pagevec_release+0x81/0xf0 mm/swap.c:1102 pagevec_release include/linux/pagevec.h:88 [inline] truncate_inode_pages_range+0x9f8/0x1940 mm/truncate.c:367 truncate_inode_pages mm/truncate.c:473 [inline] truncate_inode_pages_final+0xc1/0xd0 mm/truncate.c:524 f2fs_evict_inode+0x181/0x1350 fs/f2fs/inode.c:739 evict+0x2a3/0x6c0 fs/inode.c:577 dispose_list fs/inode.c:612 [inline] evict_inodes+0x628/0x6b0 fs/inode.c:662 generic_shutdown_super+0x9c/0x2d0 fs/super.c:454 kill_block_super+0x80/0xe0 fs/super.c:1447 kill_f2fs_super+0x2f3/0x3c0 fs/f2fs/super.c:4368 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1118 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125 Memory state around the buggy address: ffff8881184cc380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881184cc400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881184cc480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881184cc500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881184cc580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== list_del corruption. prev->next should be ffff888162351d60, but was 0000000000000000 ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:61! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 12902 Comm: kworker/u4:5 Tainted: G B 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Workqueue: writeback wb_workfn (flush-7:3) RIP: 0010:__list_del_entry_valid+0x11a/0x130 lib/list_debug.c:59 Code: 69 fd 41 02 0f 0b 48 c7 c7 40 0b 44 85 4c 89 f6 31 c0 e8 56 fd 41 02 0f 0b 48 c7 c7 a0 0b 44 85 4c 89 f6 31 c0 e8 43 fd 41 02 <0f> 0b 48 c7 c7 00 0c 44 85 4c 89 f6 31 c0 e8 30 fd 41 02 0f 0b 90 RSP: 0018:ffffc90009c57008 EFLAGS: 00010246 RAX: 0000000000000054 RBX: ffff8881184cc498 RCX: d28f3c1a0071cd00 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc90009c57028 R08: ffffffff81540db8 R09: fffff5200138ad29 R10: fffff5200138ad29 R11: 1ffff9200138ad28 R12: dffffc0000000000 R13: ffff888162351d60 R14: ffff888162351d60 R15: ffff8881184cc498 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000555555d97728 CR3: 0000000156b66000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_del_entry include/linux/list.h:132 [inline] list_del_init include/linux/list.h:204 [inline] __remove_dirty_inode fs/f2fs/checkpoint.c:1015 [inline] f2fs_remove_dirty_inode+0x217/0x3f0 fs/f2fs/checkpoint.c:1051 __f2fs_write_data_pages+0x245b/0x2c80 fs/f2fs/data.c:3219 f2fs_write_data_pages+0x74/0x80 fs/f2fs/data.c:3233 do_writepages+0x13a/0x280 mm/page-writeback.c:2358 __writeback_single_inode+0xb8/0x6e0 fs/fs-writeback.c:1467 writeback_sb_inodes+0x999/0x1700 fs/fs-writeback.c:1730 wb_writeback+0x42f/0xc20 fs/fs-writeback.c:1905 wb_do_writeback+0x222/0xbd0 fs/fs-writeback.c:2050 wb_workfn+0xf8/0x3f0 fs/fs-writeback.c:2091 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Modules linked in: ---[ end trace 93318a148d3813fe ]--- RIP: 0010:__list_del_entry_valid+0x11a/0x130 lib/list_debug.c:59 Code: 69 fd 41 02 0f 0b 48 c7 c7 40 0b 44 85 4c 89 f6 31 c0 e8 56 fd 41 02 0f 0b 48 c7 c7 a0 0b 44 85 4c 89 f6 31 c0 e8 43 fd 41 02 <0f> 0b 48 c7 c7 00 0c 44 85 4c 89 f6 31 c0 e8 30 fd 41 02 0f 0b 90 RSP: 0018:ffffc90009c57008 EFLAGS: 00010246 RAX: 0000000000000054 RBX: ffff8881184cc498 RCX: d28f3c1a0071cd00 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc90009c57028 R08: ffffffff81540db8 R09: fffff5200138ad29 R10: fffff5200138ad29 R11: 1ffff9200138ad28 R12: dffffc0000000000 R13: ffff888162351d60 R14: ffff888162351d60 R15: ffff8881184cc498 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000555555d97728 CR3: 0000000156b66000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400