================================================================== BUG: KASAN: slab-use-after-free in iov_iter_folioq_advance lib/iov_iter.c:540 [inline] BUG: KASAN: slab-use-after-free in iov_iter_advance+0x470/0x500 lib/iov_iter.c:576 Read of size 8 at addr ffff8881196d7120 by task syz.0.17/2818 CPU: 0 UID: 0 PID: 2818 Comm: syz.0.17 Not tainted 6.11.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x5a/0x90 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 iov_iter_folioq_advance lib/iov_iter.c:540 [inline] iov_iter_advance+0x470/0x500 lib/iov_iter.c:576 netfs_write_folio+0xa33/0x1e00 fs/netfs/write_issue.c:481 netfs_writepages+0x25a/0xb60 fs/netfs/write_issue.c:541 do_writepages+0x172/0x780 mm/page-writeback.c:2683 filemap_fdatawrite_wbc mm/filemap.c:397 [inline] filemap_fdatawrite_wbc+0x10e/0x180 mm/filemap.c:387 __filemap_fdatawrite_range+0xaa/0xf0 mm/filemap.c:430 v9fs_dir_release+0x242/0x310 fs/9p/vfs_dir.c:219 __fput+0x361/0xaf0 fs/file_table.c:422 task_work_run+0x119/0x1f0 kernel/task_work.c:228 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x180/0x190 kernel/entry/common.c:218 do_syscall_64+0x7a/0x170 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff4a803def9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcbc931268 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007ff4a81f7a80 RCX: 00007ff4a803def9 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007ff4a81f7a80 R08: 0000000000000000 R09: 00007ffcbc93155f R10: 000000000003fd88 R11: 0000000000000246 R12: 000000000001159a R13: 00007ffcbc931370 R14: 0000000000000032 R15: ffffffffffffffff Allocated by task 2818: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc_noprof include/linux/slab.h:681 [inline] netfs_buffer_append_folio+0x140/0x640 fs/netfs/misc.c:25 netfs_write_folio+0x41e/0x1e00 fs/netfs/write_issue.c:419 netfs_writepages+0x25a/0xb60 fs/netfs/write_issue.c:541 do_writepages+0x172/0x780 mm/page-writeback.c:2683 filemap_fdatawrite_wbc mm/filemap.c:397 [inline] filemap_fdatawrite_wbc+0x10e/0x180 mm/filemap.c:387 __filemap_fdatawrite_range+0xaa/0xf0 mm/filemap.c:430 v9fs_dir_release+0x242/0x310 fs/9p/vfs_dir.c:219 __fput+0x361/0xaf0 fs/file_table.c:422 task_work_run+0x119/0x1f0 kernel/task_work.c:228 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x180/0x190 kernel/entry/common.c:218 do_syscall_64+0x7a/0x170 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 529: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2256 [inline] slab_free mm/slub.c:4477 [inline] kfree+0x121/0x360 mm/slub.c:4598 netfs_delete_buffer_head+0x97/0xf0 fs/netfs/misc.c:59 netfs_writeback_unlock_folios fs/netfs/write_collect.c:133 [inline] netfs_collect_write_results fs/netfs/write_collect.c:486 [inline] netfs_write_collection_worker+0x18de/0x4340 fs/netfs/write_collect.c:544 process_one_work+0x7c4/0x15e0 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6b1/0x1010 kernel/workqueue.c:3389 kthread+0x277/0x330 kernel/kthread.c:389 ret_from_fork+0x2f/0x70 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff8881196d7000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff8881196d7000, ffff8881196d7200) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1196d4 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x200000000000040(head|node=0|zone=2) page_type: 0xfdffffff(slab) raw: 0200000000000040 ffff888100041c80 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 0200000000000040 ffff888100041c80 0000000000000000 dead000000000001 head: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 0200000000000002 ffffea000465b501 ffffffffffffffff 0000000000000000 head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 744, tgid 744 (udevd), ts 3689530780, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x283/0x300 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x117b/0x3620 mm/page_alloc.c:3446 __alloc_pages_noprof+0x345/0x620 mm/page_alloc.c:4702 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x4e/0xf0 mm/slub.c:2325 allocate_slab+0x5b/0x200 mm/slub.c:2488 new_slab mm/slub.c:2541 [inline] ___slab_alloc+0xc2a/0x13f0 mm/slub.c:3727 __slab_alloc.constprop.0+0x4d/0x90 mm/slub.c:3817 __slab_alloc_node mm/slub.c:3870 [inline] slab_alloc_node mm/slub.c:4029 [inline] __kmalloc_cache_noprof+0x324/0x370 mm/slub.c:4188 kmalloc_noprof include/linux/slab.h:681 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] kernfs_fop_open+0x25c/0xda0 fs/kernfs/file.c:623 do_dentry_open+0x624/0x1150 fs/open.c:959 vfs_open+0x7d/0x350 fs/open.c:1089 do_open fs/namei.c:3727 [inline] path_openat+0x1d3b/0x2d10 fs/namei.c:3886 do_filp_open+0x1ba/0x400 fs/namei.c:3913 do_sys_openat2+0x133/0x170 fs/open.c:1416 do_sys_open fs/open.c:1431 [inline] __do_sys_openat fs/open.c:1447 [inline] __se_sys_openat fs/open.c:1442 [inline] __x64_sys_openat+0x134/0x1d0 fs/open.c:1442 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x170 arch/x86/entry/common.c:83 page_owner free stack trace missing Memory state around the buggy address: ffff8881196d7000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881196d7080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881196d7100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881196d7180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881196d7200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================