================================================================== 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+0x677/0x6c0 lib/iov_iter.c:576 Read of size 8 at addr ffff888034b47520 by task syz.3.67/5587 CPU: 1 UID: 0 PID: 5587 Comm: syz.3.67 Not tainted 6.11.0-syzkaller-02574-ga430d95c5efa #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+0x116/0x1f0 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+0x677/0x6c0 lib/iov_iter.c:576 netfs_write_folio+0x745/0x18f0 fs/netfs/write_issue.c:481 netfs_writepages+0x2ba/0xb90 fs/netfs/write_issue.c:541 do_writepages+0x1a6/0x7f0 mm/page-writeback.c:2683 filemap_fdatawrite_wbc mm/filemap.c:397 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:387 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:430 v9fs_dir_release+0x429/0x590 fs/9p/vfs_dir.c:219 __fput+0x3f9/0xb60 fs/file_table.c:431 task_work_run+0x151/0x250 kernel/task_work.c:228 get_signal+0x1ca/0x2770 kernel/signal.c:2689 arch_do_signal_or_restart+0x90/0x7e0 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+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f554f57def9 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:00007f555029f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: 00000000003bc000 RBX: 00007f554f735f80 RCX: 00007f554f57def9 RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000007 RBP: 00007f554f5f0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 000000007ffff000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f554f735f80 R15: 00007ffc4c4e97a8 Allocated by task 5587: 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:690 [inline] netfs_buffer_append_folio+0x181/0x750 fs/netfs/misc.c:25 netfs_write_folio+0x542/0x18f0 fs/netfs/write_issue.c:421 netfs_writepages+0x2ba/0xb90 fs/netfs/write_issue.c:541 do_writepages+0x1a6/0x7f0 mm/page-writeback.c:2683 filemap_fdatawrite_wbc mm/filemap.c:397 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:387 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:430 v9fs_dir_release+0x429/0x590 fs/9p/vfs_dir.c:219 __fput+0x3f9/0xb60 fs/file_table.c:431 task_work_run+0x151/0x250 kernel/task_work.c:228 get_signal+0x1ca/0x2770 kernel/signal.c:2689 arch_do_signal_or_restart+0x90/0x7e0 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+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 35: 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:2250 [inline] slab_free mm/slub.c:4474 [inline] kfree+0x12a/0x3b0 mm/slub.c:4595 netfs_delete_buffer_head+0xa6/0x100 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+0x20f9/0x4f80 fs/netfs/write_collect.c:551 process_one_work+0x9c8/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3393 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/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 ffff888034b47400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff888034b47400, ffff888034b47600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x34b44 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000040 ffff88801ac41c80 ffffea0000a79300 dead000000000002 raw: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 00fff00000000040 ffff88801ac41c80 ffffea0000a79300 dead000000000002 head: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 00fff00000000002 ffffea0000d2d101 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4682, tgid 4682 (udevadm), ts 43484112443, free_ts 43337998744 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3446 __alloc_pages_noprof+0x22b/0x2460 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:2319 allocate_slab mm/slub.c:2482 [inline] new_slab+0x84/0x260 mm/slub.c:2535 ___slab_alloc+0xdac/0x1870 mm/slub.c:3721 __slab_alloc.constprop.0+0x56/0xb0 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+0x367/0x400 mm/slub.c:4171 kmalloc_noprof include/linux/slab.h:694 [inline] kzalloc_noprof include/linux/slab.h:816 [inline] tomoyo_init_log+0x13c7/0x2170 security/tomoyo/audit.c:275 tomoyo_supervisor+0x30c/0xea0 security/tomoyo/common.c:2089 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3b0 security/tomoyo/file.c:573 tomoyo_path_perm+0x35e/0x450 security/tomoyo/file.c:838 security_inode_getattr+0x116/0x290 security/security.c:2371 vfs_getattr+0x36/0xb0 fs/stat.c:204 vfs_statx_path+0x36/0x390 fs/stat.c:251 vfs_statx+0x145/0x1e0 fs/stat.c:315 page last free pid 4680 tgid 4680 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2619 stack_depot_save_flags+0x2da/0x8f0 lib/stackdepot.c:666 kasan_save_stack+0x42/0x60 mm/kasan/common.c:48 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 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4159 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4171 kmalloc_noprof include/linux/slab.h:694 [inline] kzalloc_noprof include/linux/slab.h:816 [inline] tomoyo_encode2+0x100/0x3e0 security/tomoyo/realpath.c:45 tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x19d/0x720 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x245/0x590 security/tomoyo/file.c:723 tomoyo_path_chown+0x14d/0x1b0 security/tomoyo/tomoyo.c:384 security_path_chown+0x12a/0x2e0 security/security.c:2074 chown_common+0x3bc/0x670 fs/open.c:788 do_fchownat+0x1ac/0x200 fs/open.c:824 __do_sys_chown fs/open.c:844 [inline] __se_sys_chown fs/open.c:842 [inline] __x64_sys_chown+0x7b/0xc0 fs/open.c:842 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 Memory state around the buggy address: ffff888034b47400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034b47480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888034b47500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888034b47580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034b47600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================