================================================================== 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 ffff88801219e520 by task syz.4.65/5626 CPU: 0 UID: 0 PID: 5626 Comm: syz.4.65 Not tainted 6.11.0-syzkaller-11558-g075dbe9f6e3c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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:0x7fe1cc17df39 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:00007ffc23a03658 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fe1cc337a80 RCX: 00007fe1cc17df39 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fe1cc337a80 R08: 0000000000000006 R09: 00007ffc23a0394f R10: 00000000005e2378 R11: 0000000000000246 R12: 000000000001d223 R13: 00007ffc23a03760 R14: 0000000000000032 R15: ffffffffffffffff Allocated by task 5626: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:878 [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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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 53: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2343 [inline] slab_free mm/slub.c:4580 [inline] kfree+0x14f/0x4b0 mm/slub.c:4728 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/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 ffff88801219e400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff88801219e400, ffff88801219e600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1219c 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: f5(slab) raw: 00fff00000000040 ffff88801b041c80 ffffea0001f8bf00 dead000000000002 raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b041c80 ffffea0001f8bf00 dead000000000002 head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000002 ffffea0000486701 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 5236, tgid 5236 (syz-executor), ts 85590249903, free_ts 85475345943 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2413 [inline] allocate_slab mm/slub.c:2579 [inline] new_slab+0x28b/0x3f0 mm/slub.c:2632 ___slab_alloc+0xd1d/0x16f0 mm/slub.c:3819 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3909 __slab_alloc_node mm/slub.c:3962 [inline] slab_alloc_node mm/slub.c:4123 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x367/0x400 mm/slub.c:4277 kmalloc_noprof include/linux/slab.h:882 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] fib6_info_alloc+0x40/0x160 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x337/0x1910 net/ipv6/route.c:3761 ip6_route_add+0x26/0x1c0 net/ipv6/route.c:3853 addrconf_add_mroute+0x1de/0x350 net/ipv6/addrconf.c:2550 addrconf_add_dev+0x14e/0x1c0 net/ipv6/addrconf.c:2568 inet6_addr_add+0x1a8/0xbc0 net/ipv6/addrconf.c:3026 inet6_rtm_newaddr+0x11d1/0x1aa0 net/ipv6/addrconf.c:5050 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6646 page last free pid 5293 tgid 5293 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4086 [inline] slab_alloc_node mm/slub.c:4135 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x199/0x400 mm/slub.c:4277 kmalloc_noprof include/linux/slab.h:882 [inline] tomoyo_realpath_from_path+0xb9/0x720 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x273/0x450 security/tomoyo/file.c:822 security_inode_getattr+0x116/0x290 security/security.c:2371 vfs_getattr fs/stat.c:204 [inline] vfs_fstat+0x53/0xd0 fs/stat.c:229 vfs_fstatat+0x146/0x160 fs/stat.c:338 __do_sys_newfstatat+0xa2/0x130 fs/stat.c:505 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88801219e400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801219e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801219e500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801219e580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801219e600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ================================================================== 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 ffff888027919920 by task syz.4.65/5626 CPU: 0 UID: 0 PID: 5626 Comm: syz.4.65 Tainted: G B 6.11.0-syzkaller-11558-g075dbe9f6e3c #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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:0x7fe1cc17df39 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:00007ffc23a03658 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fe1cc337a80 RCX: 00007fe1cc17df39 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fe1cc337a80 R08: 0000000000000006 R09: 00007ffc23a0394f R10: 00000000005e2378 R11: 0000000000000246 R12: 000000000001d223 R13: 00007ffc23a03760 R14: 0000000000000032 R15: ffffffffffffffff Allocated by task 5626: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:878 [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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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 11: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2343 [inline] slab_free mm/slub.c:4580 [inline] kfree+0x14f/0x4b0 mm/slub.c:4728 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/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 ffff888027919800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff888027919800, ffff888027919a00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27918 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: f5(slab) raw: 00fff00000000040 ffff88801b041c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b041c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000002 ffffea00009e4601 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 4678, tgid 4678 (udevadm), ts 33990386955, free_ts 33974383475 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2413 [inline] allocate_slab mm/slub.c:2579 [inline] new_slab+0x28b/0x3f0 mm/slub.c:2632 ___slab_alloc+0xd1d/0x16f0 mm/slub.c:3819 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3909 __slab_alloc_node mm/slub.c:3962 [inline] slab_alloc_node mm/slub.c:4123 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4291 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] kernfs_fop_open+0x28b/0xdb0 fs/kernfs/file.c:623 do_dentry_open+0x6cd/0x1530 fs/open.c:958 vfs_open+0x82/0x3f0 fs/open.c:1088 do_open fs/namei.c:3774 [inline] path_openat+0x1e6a/0x2d60 fs/namei.c:3933 do_filp_open+0x1dc/0x430 fs/namei.c:3960 do_sys_openat2+0x17a/0x1e0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1441 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 4677 tgid 4677 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 __put_partials+0x14c/0x170 mm/slub.c:3146 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4086 [inline] slab_alloc_node mm/slub.c:4135 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4142 getname_flags.part.0+0x4c/0x550 fs/namei.c:139 getname_flags include/linux/audit.h:322 [inline] getname+0x8d/0xe0 fs/namei.c:225 do_sys_openat2+0x104/0x1e0 fs/open.c:1409 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1441 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888027919800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888027919880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888027919900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888027919980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888027919a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ================================================================== 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 ffff88802fcf6520 by task syz.4.65/5626 CPU: 1 UID: 0 PID: 5626 Comm: syz.4.65 Tainted: G B 6.11.0-syzkaller-11558-g075dbe9f6e3c #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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:0x7fe1cc17df39 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:00007ffc23a03658 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fe1cc337a80 RCX: 00007fe1cc17df39 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fe1cc337a80 R08: 0000000000000006 R09: 00007ffc23a0394f R10: 00000000005e2378 R11: 0000000000000246 R12: 000000000001d223 R13: 00007ffc23a03760 R14: 0000000000000032 R15: ffffffffffffffff Allocated by task 5626: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:878 [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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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 2873: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2343 [inline] slab_free mm/slub.c:4580 [inline] kfree+0x14f/0x4b0 mm/slub.c:4728 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/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 ffff88802fcf6400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff88802fcf6400, ffff88802fcf6600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2fcf4 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b041c80 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b041c80 0000000000000000 dead000000000001 head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000002 ffffea0000bf3d01 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 4691, tgid 4691 (udevadm), ts 38489493974, free_ts 38024711775 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2413 [inline] allocate_slab mm/slub.c:2579 [inline] new_slab+0x28b/0x3f0 mm/slub.c:2632 ___slab_alloc+0xd1d/0x16f0 mm/slub.c:3819 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3909 __slab_alloc_node mm/slub.c:3962 [inline] slab_alloc_node mm/slub.c:4123 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4291 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] kernfs_fop_open+0x28b/0xdb0 fs/kernfs/file.c:623 do_dentry_open+0x6cd/0x1530 fs/open.c:958 vfs_open+0x82/0x3f0 fs/open.c:1088 do_open fs/namei.c:3774 [inline] path_openat+0x1e6a/0x2d60 fs/namei.c:3933 do_filp_open+0x1dc/0x430 fs/namei.c:3960 do_sys_openat2+0x17a/0x1e0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1441 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 4708 tgid 4708 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4086 [inline] slab_alloc_node mm/slub.c:4135 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4142 vm_area_alloc+0x1f/0x230 kernel/fork.c:472 mmap_region+0xf22/0x2a60 mm/mmap.c:1424 do_mmap+0xc00/0xfc0 mm/mmap.c:496 vm_mmap_pgoff+0x1ba/0x360 mm/util.c:588 ksys_mmap_pgoff+0x7d/0x5c0 mm/mmap.c:542 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:79 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:79 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88802fcf6400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802fcf6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802fcf6500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802fcf6580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802fcf6600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ================================================================== 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 ffff888025536120 by task syz.4.65/5626 CPU: 1 UID: 0 PID: 5626 Comm: syz.4.65 Tainted: G B 6.11.0-syzkaller-11558-g075dbe9f6e3c #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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:0x7fe1cc17df39 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:00007ffc23a03658 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fe1cc337a80 RCX: 00007fe1cc17df39 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fe1cc337a80 R08: 0000000000000006 R09: 00007ffc23a0394f R10: 00000000005e2378 R11: 0000000000000246 R12: 000000000001d223 R13: 00007ffc23a03760 R14: 0000000000000032 R15: ffffffffffffffff Allocated by task 5626: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:878 [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:398 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:388 __filemap_fdatawrite_range+0xb3/0xf0 mm/filemap.c:431 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 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+0x27b/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 53: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2343 [inline] slab_free mm/slub.c:4580 [inline] kfree+0x14f/0x4b0 mm/slub.c:4728 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/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 ffff888025536000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 288 bytes inside of freed 512-byte region [ffff888025536000, ffff888025536200) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25534 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: f5(slab) raw: 00fff00000000040 ffff88801b041c80 ffffea000077a700 dead000000000002 raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b041c80 ffffea000077a700 dead000000000002 head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000 head: 00fff00000000002 ffffea0000954d01 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 22, tgid 22 (cpuhp/1), ts 14151251834, free_ts 14134303735 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2413 [inline] allocate_slab mm/slub.c:2579 [inline] new_slab+0x28b/0x3f0 mm/slub.c:2632 ___slab_alloc+0xd1d/0x16f0 mm/slub.c:3819 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3909 __slab_alloc_node mm/slub.c:3962 [inline] slab_alloc_node mm/slub.c:4123 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4291 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] device_private_init drivers/base/core.c:3527 [inline] device_add+0xccf/0x1a70 drivers/base/core.c:3578 __cpu_device_create drivers/base/cpu.c:467 [inline] cpu_device_create+0x25f/0x2d0 drivers/base/cpu.c:486 cache_add_dev drivers/base/cacheinfo.c:870 [inline] cacheinfo_cpu_online+0x3f4/0x9a0 drivers/base/cacheinfo.c:968 cpuhp_invoke_callback+0x438/0xbe0 kernel/cpu.c:194 cpuhp_thread_fun+0x480/0x6f0 kernel/cpu.c:1102 smpboot_thread_fn+0x664/0xa10 kernel/smpboot.c:164 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 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 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4086 [inline] slab_alloc_node mm/slub.c:4135 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4142 __kernfs_new_node+0xd3/0x890 fs/kernfs/dir.c:624 kernfs_new_node+0x186/0x240 fs/kernfs/dir.c:700 __kernfs_create_file+0x53/0x350 fs/kernfs/file.c:1034 sysfs_add_file_mode_ns+0x1ff/0x3b0 fs/sysfs/file.c:307 sysfs_create_file_ns+0x13e/0x1d0 fs/sysfs/file.c:368 sysfs_create_file include/linux/sysfs.h:767 [inline] driver_create_file+0x4a/0x70 drivers/base/driver.c:182 bus_add_driver+0x357/0x690 drivers/base/bus.c:684 driver_register+0x15c/0x4b0 drivers/base/driver.c:246 drm_pci_register_driver_if_modeset include/drm/drm_module.h:69 [inline] bochs_pci_driver_init+0x67/0x80 drivers/gpu/drm/tiny/bochs.c:732 do_one_initcall+0x12b/0x700 init/main.c:1269 Memory state around the buggy address: ffff888025536000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025536080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888025536100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888025536180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025536200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================