================================================================== BUG: KASAN: use-after-free in fuse_copy_one fs/fuse/dev.c:1004 [inline] BUG: KASAN: use-after-free in fuse_copy_args+0x248/0x630 fs/fuse/dev.c:1022 Read of size 256 at addr ffff8881247b8410 by task syz-executor.0/725 CPU: 0 PID: 725 Comm: syz-executor.0 Not tainted 5.19.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:313 [inline] print_report+0x154/0x5d0 mm/kasan/report.c:429 kasan_report+0xe3/0x110 mm/kasan/report.c:491 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189 memcpy+0x2d/0x70 mm/kasan/shadow.c:65 fuse_copy_one fs/fuse/dev.c:1004 [inline] fuse_copy_args+0x248/0x630 fs/fuse/dev.c:1022 fuse_dev_do_read+0xc87/0x11d0 fs/fuse/dev.c:1297 fuse_dev_read+0x182/0x210 fs/fuse/dev.c:1364 call_read_iter include/linux/fs.h:2052 [inline] new_sync_read fs/read_write.c:401 [inline] vfs_read+0xa05/0xc70 fs/read_write.c:482 ksys_read+0x199/0x2c0 fs/read_write.c:620 __do_sys_read fs/read_write.c:630 [inline] __se_sys_read fs/read_write.c:628 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:628 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f708028b639 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f707fdff168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00007f70803ac1f0 RCX: 00007f708028b639 RDX: 0000000000002020 RSI: 0000000020002140 RDI: 0000000000000003 RBP: 00007f70802e6ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe074d517f R14: 00007f707fdff300 R15: 0000000000022000 Allocated by task 720: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:515 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:524 kasan_kmalloc include/linux/kasan.h:234 [inline] __kmalloc+0x146/0x270 mm/slub.c:4446 kmalloc include/linux/slab.h:605 [inline] __d_alloc+0xb4/0x6c0 fs/dcache.c:1786 d_alloc fs/dcache.c:1849 [inline] d_alloc_parallel+0xe6/0x1360 fs/dcache.c:2601 __lookup_slow+0x154/0x400 fs/namei.c:1686 lookup_slow+0x5a/0x80 fs/namei.c:1718 walk_component+0x48c/0x610 fs/namei.c:2014 lookup_last fs/namei.c:2469 [inline] path_lookupat+0x16d/0x450 fs/namei.c:2493 filename_lookup+0x230/0x5c0 fs/namei.c:2522 user_path_at_empty+0x43/0x1a0 fs/namei.c:2895 user_path_at include/linux/namei.h:57 [inline] do_mount fs/namespace.c:3380 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x285/0x3b0 fs/namespace.c:3568 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 413: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:366 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1780 slab_free mm/slub.c:3536 [inline] kmem_cache_free_bulk+0x52b/0x6e0 mm/slub.c:3683 kfree_bulk include/linux/slab.h:456 [inline] kfree_rcu_work+0x2b2/0x6a0 kernel/rcu/tree.c:3370 process_one_work+0x6ab/0xc00 kernel/workqueue.c:2289 worker_thread+0xa5d/0x1260 kernel/workqueue.c:2436 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xb3/0xc0 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 kvfree_call_rcu+0xa6/0x770 kernel/rcu/tree.c:3647 copy_name fs/dcache.c:2870 [inline] __d_move+0x86e/0x1370 fs/dcache.c:2933 __d_unalias+0x1cc/0x220 fs/dcache.c:3047 d_splice_alias+0x20a/0x390 fs/dcache.c:3110 fuse_lookup+0x2b9/0x5f0 fs/fuse/dir.c:441 __lookup_slow+0x2b9/0x400 fs/namei.c:1701 lookup_slow+0x5a/0x80 fs/namei.c:1718 walk_component+0x48c/0x610 fs/namei.c:2014 link_path_walk+0x68c/0xde0 path_parentat fs/namei.c:2540 [inline] filename_parentat+0x23a/0x650 fs/namei.c:2563 filename_create+0xf0/0x520 fs/namei.c:3727 do_mkdirat+0xb8/0x3f0 fs/namei.c:3990 __do_sys_mkdir fs/namei.c:4021 [inline] __se_sys_mkdir fs/namei.c:4019 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4019 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8881247b8400 which belongs to the cache kmalloc-rcl-512 of size 512 The buggy address is located 16 bytes inside of 512-byte region [ffff8881247b8400, ffff8881247b8600) The buggy address belongs to the physical page: page:ffffea000491ee00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1247b8 head:ffffea000491ee00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 0000000000000000 dead000000000122 ffff888100042dc0 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 684, tgid 683 (syz-executor.2), ts 46179432984, free_ts 22308513323 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e2/0x1f0 mm/page_alloc.c:2449 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x30b5/0x3190 mm/page_alloc.c:4202 __alloc_pages+0x3e3/0x880 mm/page_alloc.c:5430 allocate_slab mm/slub.c:1969 [inline] new_slab+0x96/0x470 mm/slub.c:2029 ___slab_alloc+0x34d/0x7b0 mm/slub.c:3031 __slab_alloc+0x4a/0x90 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] __kmalloc+0x179/0x270 mm/slub.c:4442 kmalloc include/linux/slab.h:605 [inline] __d_alloc+0xb4/0x6c0 fs/dcache.c:1786 d_alloc fs/dcache.c:1849 [inline] d_alloc_parallel+0xe6/0x1360 fs/dcache.c:2601 __lookup_slow+0x154/0x400 fs/namei.c:1686 lookup_slow+0x5a/0x80 fs/namei.c:1718 walk_component+0x48c/0x610 fs/namei.c:2014 lookup_last fs/namei.c:2469 [inline] path_lookupat+0x16d/0x450 fs/namei.c:2493 filename_lookup+0x230/0x5c0 fs/namei.c:2522 vfs_statx+0xfd/0x720 fs/stat.c:228 vfs_fstatat fs/stat.c:255 [inline] __do_sys_newfstatat fs/stat.c:425 [inline] __se_sys_newfstatat+0xf6/0x7a0 fs/stat.c:419 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare mm/page_alloc.c:1443 [inline] free_unref_page_prepare+0x80f/0x820 mm/page_alloc.c:3343 free_unref_page_list+0x1c1/0x6c0 mm/page_alloc.c:3475 release_pages+0xd17/0xd70 mm/swap.c:980 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:325 tlb_batch_pages_flush mm/mmu_gather.c:58 [inline] tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu+0xfe/0x200 mm/mmu_gather.c:262 tlb_finish_mmu+0xd5/0x1f0 mm/mmu_gather.c:353 exit_mmap+0x1e3/0x4c0 mm/mmap.c:3164 __mmput+0x95/0x300 kernel/fork.c:1187 mmput+0x59/0x70 kernel/fork.c:1208 exit_mm kernel/exit.c:510 [inline] do_exit+0xa39/0x27b0 kernel/exit.c:782 do_group_exit+0x255/0x320 kernel/exit.c:925 __do_sys_exit_group kernel/exit.c:936 [inline] __se_sys_exit_group kernel/exit.c:934 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:934 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff8881247b8300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881247b8380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881247b8400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881247b8480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881247b8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================