================================================================== BUG: KASAN: use-after-free in fuse_copy_one fs/fuse/dev.c:1003 [inline] BUG: KASAN: use-after-free in fuse_copy_args+0x248/0x630 fs/fuse/dev.c:1021 Read of size 256 at addr ffff888124e62410 by task syz-executor.2/499 CPU: 0 PID: 499 Comm: syz-executor.2 Not tainted 6.0.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:317 [inline] print_report+0x170/0x5f0 mm/kasan/report.c:433 kasan_report+0xe3/0x110 mm/kasan/report.c:495 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:1003 [inline] fuse_copy_args+0x248/0x630 fs/fuse/dev.c:1021 fuse_dev_do_read+0xc87/0x11d0 fs/fuse/dev.c:1296 fuse_dev_read+0x16d/0x210 fs/fuse/dev.c:1363 call_read_iter include/linux/fs.h:2181 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x771/0xad0 fs/read_write.c:470 ksys_read+0x199/0x2c0 fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:621 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:0x7f7b1a28b639 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:00007f7b19d9c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00007f7b1a3ac1f0 RCX: 00007f7b1a28b639 RDX: 0000000000002020 RSI: 0000000020002140 RDI: 0000000000000003 RBP: 00007f7b1a2e6ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffea5791af R14: 00007f7b19d9c300 R15: 0000000000022000 Allocated by task 494: 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:437 [inline] ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:516 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:525 kasan_kmalloc include/linux/kasan.h:234 [inline] __kmalloc+0x146/0x280 mm/slub.c:4429 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+0xe1/0x1270 fs/dcache.c:2647 __lookup_slow+0x154/0x3e0 fs/namei.c:1670 lookup_slow+0x5a/0x80 fs/namei.c:1702 walk_component+0x2e7/0x410 fs/namei.c:1993 lookup_last fs/namei.c:2450 [inline] path_lookupat+0x16d/0x450 fs/namei.c:2474 filename_lookup+0x251/0x600 fs/namei.c:2503 user_path_at_empty+0x43/0x1a0 fs/namei.c:2876 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 6: 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+0x137/0x180 mm/kasan/common.c:367 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:375 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1759 [inline] slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1785 slab_free mm/slub.c:3539 [inline] kmem_cache_free_bulk+0x375/0x400 mm/slub.c:3665 kfree_bulk include/linux/slab.h:456 [inline] kfree_rcu_work+0x2b6/0x720 kernel/rcu/tree.c:3035 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 arch/x86/entry/entry_64.S:306 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+0xaa/0x6b0 kernel/rcu/tree.c:3322 copy_name fs/dcache.c:2934 [inline] __d_move+0x877/0x13a0 fs/dcache.c:2998 __d_unalias+0x1cc/0x220 fs/dcache.c:3112 d_splice_alias+0x20a/0x390 fs/dcache.c:3175 fuse_lookup+0x2b9/0x5f0 fs/fuse/dir.c:447 __lookup_slow+0x2b9/0x3e0 fs/namei.c:1685 lookup_slow+0x5a/0x80 fs/namei.c:1702 walk_component fs/namei.c:1993 [inline] link_path_walk+0x9d3/0xee0 fs/namei.c:2320 path_parentat fs/namei.c:2521 [inline] filename_parentat+0x24c/0x670 fs/namei.c:2544 filename_create+0xf0/0x520 fs/namei.c:3765 do_mkdirat+0xbd/0x450 fs/namei.c:4028 __do_sys_mkdir fs/namei.c:4058 [inline] __se_sys_mkdir fs/namei.c:4056 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4056 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 ffff888124e62400 which belongs to the cache kmalloc-rcl-512 of size 512 The buggy address is located 16 bytes inside of 512-byte region [ffff888124e62400, ffff888124e62600) The buggy address belongs to the physical page: page:ffffea0004939800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x124e60 head:ffffea0004939800 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 494, tgid 493 (syz-executor.2), ts 39412245778, free_ts 20431145334 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e2/0x1f0 mm/page_alloc.c:2525 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x2ed1/0x2fb0 mm/page_alloc.c:4283 __alloc_pages+0x3e3/0x880 mm/page_alloc.c:5549 allocate_slab mm/slub.c:1974 [inline] new_slab+0x96/0x470 mm/slub.c:2034 ___slab_alloc+0x34d/0x7b0 mm/slub.c:3036 __slab_alloc+0x4a/0x90 mm/slub.c:3123 slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3256 [inline] __kmalloc+0x179/0x280 mm/slub.c:4425 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+0xe1/0x1270 fs/dcache.c:2647 __lookup_slow+0x154/0x3e0 fs/namei.c:1670 lookup_slow+0x5a/0x80 fs/namei.c:1702 walk_component+0x2e7/0x410 fs/namei.c:1993 lookup_last fs/namei.c:2450 [inline] path_lookupat+0x16d/0x450 fs/namei.c:2474 filename_lookup+0x251/0x600 fs/namei.c:2503 user_path_at_empty+0x43/0x1a0 fs/namei.c:2876 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] __free_pages_ok+0x8bf/0x8d0 mm/page_alloc.c:1705 free_the_page mm/page_alloc.c:769 [inline] free_compound_page+0xb0/0xd0 mm/page_alloc.c:790 free_transhuge_page+0x2c3/0x2f0 mm/huge_memory.c:2764 destroy_large_folio+0x56/0x90 mm/page_alloc.c:826 __folio_put_large mm/swap.c:118 [inline] release_pages+0x3cc/0xb00 mm/swap.c:978 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:311 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:3118 __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 get_signal+0x1711/0x1870 kernel/signal.c:2857 arch_do_signal_or_restart+0xb0/0x12e0 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop+0x6b/0xa0 kernel/entry/common.c:166 Memory state around the buggy address: ffff888124e62300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888124e62380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888124e62400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888124e62480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888124e62500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================