loop0: detected capacity change from 0 to 128 ================================================================== BUG: KASAN: slab-use-after-free in iov_iter_folioq_advance+0x10c/0x360 lib/iov_iter.c:540 Read of size 8 at addr ffff88804083c920 by task syz.0.0/5108 CPU: 0 UID: 0 PID: 5108 Comm: syz.0.0 Not tainted 6.11.0-syzkaller-02520-gadfc3ded5c33 #0 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 lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 iov_iter_folioq_advance+0x10c/0x360 lib/iov_iter.c:540 netfs_write_folio+0x154b/0x1fe0 fs/netfs/write_issue.c:481 netfs_writepages+0x89f/0xe80 fs/netfs/write_issue.c:541 do_writepages+0x35d/0x870 mm/page-writeback.c:2683 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] __filemap_fdatawrite mm/filemap.c:436 [inline] filemap_fdatawrite+0xfb/0x160 mm/filemap.c:441 v9fs_dir_release+0x151/0x560 fs/9p/vfs_dir.c:219 __fput+0x23f/0x880 fs/file_table.c:431 task_work_run+0x24f/0x310 kernel/task_work.c:228 get_signal+0x15e6/0x1740 kernel/signal.c:2689 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0xc9/0x370 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fac75f7def9 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:00007fac76cf7038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: 0000000001960000 RBX: 00007fac76135f80 RCX: 00007fac75f7def9 RDX: 0000000000000000 RSI: 0000000000000010 RDI: 0000000000000009 RBP: 00007fac75ff0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 000000007ffff000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fac76135f80 R15: 00007ffd29613c48 Allocated by task 5108: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __kmalloc_cache_noprof+0x19c/0x2c0 mm/slub.c:4190 kmalloc_noprof include/linux/slab.h:690 [inline] netfs_buffer_append_folio+0x1f1/0x8b0 fs/netfs/misc.c:25 netfs_write_folio+0xe69/0x1fe0 fs/netfs/write_issue.c:421 netfs_writepages+0x89f/0xe80 fs/netfs/write_issue.c:541 do_writepages+0x35d/0x870 mm/page-writeback.c:2683 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] __filemap_fdatawrite mm/filemap.c:436 [inline] filemap_fdatawrite+0xfb/0x160 mm/filemap.c:441 v9fs_dir_release+0x151/0x560 fs/9p/vfs_dir.c:219 __fput+0x23f/0x880 fs/file_table.c:431 task_work_run+0x24f/0x310 kernel/task_work.c:228 get_signal+0x15e6/0x1740 kernel/signal.c:2689 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0xc9/0x370 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 12: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2250 [inline] slab_free mm/slub.c:4474 [inline] kfree+0x149/0x360 mm/slub.c:4595 netfs_delete_buffer_head+0x9f/0xd0 fs/netfs/misc.c:59 netfs_writeback_unlock_folios fs/netfs/write_collect.c:139 [inline] netfs_collect_write_results fs/netfs/write_collect.c:493 [inline] netfs_write_collection_worker+0x1b9a/0x4950 fs/netfs/write_collect.c:551 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x870/0xd30 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 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 ffff88804083c800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff88804083c800, ffff88804083ca00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4083c head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 04fff00000000040 ffff88801ac41c80 0000000000000000 0000000000000001 raw: 0000000000000000 0000000080080008 00000001fdffffff 0000000000000000 head: 04fff00000000040 ffff88801ac41c80 0000000000000000 0000000000000001 head: 0000000000000000 0000000080080008 00000001fdffffff 0000000000000000 head: 04fff00000000001 ffffea0001020f01 ffffffffffffffff 0000000000000000 head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5089, tgid 5089 (mkswap), ts 74112462240, free_ts 74077753695 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3446 __alloc_pages_noprof+0x256/0x6c0 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+0x5f/0x120 mm/slub.c:2319 allocate_slab+0x5a/0x2f0 mm/slub.c:2482 new_slab mm/slub.c:2535 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3721 __slab_alloc+0x58/0xa0 mm/slub.c:3811 __slab_alloc_node mm/slub.c:3864 [inline] slab_alloc_node mm/slub.c:4026 [inline] __do_kmalloc_node mm/slub.c:4158 [inline] __kmalloc_noprof+0x25a/0x400 mm/slub.c:4171 kmalloc_noprof include/linux/slab.h:694 [inline] kzalloc_noprof include/linux/slab.h:816 [inline] tomoyo_init_log+0x1b3d/0x2050 security/tomoyo/audit.c:275 tomoyo_supervisor+0x38a/0x11f0 security/tomoyo/common.c:2089 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission+0x243/0x360 security/tomoyo/file.c:587 tomoyo_path_perm+0x480/0x740 security/tomoyo/file.c:838 security_inode_getattr+0xd8/0x130 security/security.c:2269 vfs_getattr+0x45/0x430 fs/stat.c:204 vfs_fstat fs/stat.c:229 [inline] vfs_fstatat+0xe4/0x190 fs/stat.c:338 __do_sys_newfstatat fs/stat.c:505 [inline] __se_sys_newfstatat fs/stat.c:499 [inline] __x64_sys_newfstatat+0x11d/0x1a0 fs/stat.c:499 page last free pid 5089 tgid 5089 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2619 mm_free_pgd kernel/fork.c:802 [inline] __mmdrop+0xb9/0x3d0 kernel/fork.c:918 exec_mmap+0x680/0x710 fs/exec.c:1082 begin_new_exec+0x12c0/0x2050 fs/exec.c:1348 load_elf_binary+0x966/0x2680 fs/binfmt_elf.c:996 search_binary_handler fs/exec.c:1820 [inline] exec_binprm fs/exec.c:1862 [inline] bprm_execve+0xaf8/0x1770 fs/exec.c:1913 do_execveat_common+0x55f/0x6f0 fs/exec.c:2020 do_execve fs/exec.c:2094 [inline] __do_sys_execve fs/exec.c:2170 [inline] __se_sys_execve fs/exec.c:2165 [inline] __x64_sys_execve+0x92/0xb0 fs/exec.c:2165 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804083c800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804083c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804083c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804083c980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804083ca00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================