================================================================== BUG: KASAN: use-after-free in fuse_copy_one fs/fuse/dev.c:1012 [inline] BUG: KASAN: use-after-free in fuse_copy_args+0x248/0x630 fs/fuse/dev.c:1030 Read of size 256 at addr ffff888122313010 by task syz-executor.0/621 CPU: 1 PID: 621 Comm: syz-executor.0 Not tainted 5.17.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+0x84/0x360 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x177/0x1c0 mm/kasan/report.c:459 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:1012 [inline] fuse_copy_args+0x248/0x630 fs/fuse/dev.c:1030 fuse_dev_do_read+0xc87/0x11d0 fs/fuse/dev.c:1305 fuse_dev_read+0x182/0x210 fs/fuse/dev.c:1372 call_read_iter include/linux/fs.h:2068 [inline] new_sync_read fs/read_write.c:400 [inline] vfs_read+0xa97/0xd60 fs/read_write.c:481 ksys_read+0x199/0x2c0 fs/read_write.c:619 __do_sys_read fs/read_write.c:629 [inline] __se_sys_read fs/read_write.c:627 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:627 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f01582ba639 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:00007f0157dcb168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00007f01583db1f0 RCX: 00007f01582ba639 RDX: 0000000000002020 RSI: 0000000020002140 RDI: 0000000000000003 RBP: 00007f0158315ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffcd075b48f R14: 00007f0157dcb300 R15: 0000000000022000 Allocated by task 608: 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:270 [inline] __kmalloc+0x142/0x270 mm/slub.c:4424 kmalloc include/linux/slab.h:586 [inline] __d_alloc+0xad/0x6c0 fs/dcache.c:1785 d_alloc fs/dcache.c:1848 [inline] d_alloc_parallel+0xe6/0x1360 fs/dcache.c:2600 __lookup_slow+0x154/0x400 fs/namei.c:1692 lookup_slow+0x5a/0x80 fs/namei.c:1724 walk_component+0x48c/0x610 fs/namei.c:2020 lookup_last fs/namei.c:2475 [inline] path_lookupat+0x16d/0x450 fs/namei.c:2499 filename_lookup+0x230/0x5c0 fs/namei.c:2528 user_path_at_empty+0x43/0x1a0 fs/namei.c:2851 user_path_at include/linux/namei.h:57 [inline] do_mount fs/namespace.c:3364 [inline] __do_sys_mount fs/namespace.c:3575 [inline] __se_sys_mount+0x285/0x3b0 fs/namespace.c:3552 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3552 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 418: 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:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kmem_cache_free_bulk+0x579/0x730 mm/slub.c:3656 kfree_bulk include/linux/slab.h:437 [inline] kfree_rcu_work+0x2b2/0x6a0 kernel/rcu/tree.c:3314 process_one_work+0x6b8/0xc00 kernel/workqueue.c:2307 worker_thread+0xac6/0x1290 kernel/workqueue.c:2454 kthread+0x26d/0x300 kernel/kthread.c:377 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+0xb2/0x7d0 kernel/rcu/tree.c:3591 copy_name fs/dcache.c:2869 [inline] __d_move+0x86e/0x1370 fs/dcache.c:2932 __d_unalias+0x1cc/0x220 fs/dcache.c:3046 d_splice_alias+0x20a/0x390 fs/dcache.c:3109 fuse_lookup+0x2b9/0x5f0 fs/fuse/dir.c:441 __lookup_slow+0x2b9/0x400 fs/namei.c:1707 lookup_slow+0x5a/0x80 fs/namei.c:1724 walk_component+0x48c/0x610 fs/namei.c:2020 link_path_walk+0x68c/0xde0 path_parentat fs/namei.c:2546 [inline] filename_parentat+0x23a/0x650 fs/namei.c:2569 filename_create+0xf5/0x4e0 fs/namei.c:3687 do_mkdirat+0xb8/0x3f0 fs/namei.c:3948 __do_sys_mkdir fs/namei.c:3979 [inline] __se_sys_mkdir fs/namei.c:3977 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:3977 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888122313000 which belongs to the cache kmalloc-rcl-512 of size 512 The buggy address is located 16 bytes inside of 512-byte region [ffff888122313000, ffff888122313200) The buggy address belongs to the page: page:ffffea000488c400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x122310 head:ffffea000488c400 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 608, ts 45027574657, free_ts 23371055057 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1af/0x1c0 mm/page_alloc.c:2427 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0x33eb/0x34c0 mm/page_alloc.c:4165 __alloc_pages+0x38a/0x7b0 mm/page_alloc.c:5389 allocate_slab mm/slub.c:1944 [inline] new_slab+0x96/0x470 mm/slub.c:2004 ___slab_alloc+0x348/0x7b0 mm/slub.c:3018 __slab_alloc+0x4a/0x90 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x175/0x270 mm/slub.c:4420 kmalloc include/linux/slab.h:586 [inline] __d_alloc+0xad/0x6c0 fs/dcache.c:1785 d_alloc fs/dcache.c:1848 [inline] d_alloc_parallel+0xe6/0x1360 fs/dcache.c:2600 __lookup_slow+0x154/0x400 fs/namei.c:1692 lookup_slow+0x5a/0x80 fs/namei.c:1724 walk_component+0x48c/0x610 fs/namei.c:2020 lookup_last fs/namei.c:2475 [inline] path_lookupat+0x16d/0x450 fs/namei.c:2499 filename_lookup+0x230/0x5c0 fs/namei.c:2528 user_path_at_empty+0x43/0x1a0 fs/namei.c:2851 user_path_at include/linux/namei.h:57 [inline] do_mount fs/namespace.c:3364 [inline] __do_sys_mount fs/namespace.c:3575 [inline] __se_sys_mount+0x285/0x3b0 fs/namespace.c:3552 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] __free_pages_ok+0x805/0x880 mm/page_alloc.c:1650 free_the_page mm/page_alloc.c:708 [inline] free_compound_page+0xb0/0xd0 mm/page_alloc.c:729 free_transhuge_page+0x2c3/0x2f0 mm/huge_memory.c:2751 destroy_compound_page include/linux/mm.h:889 [inline] __put_compound_page mm/swap.c:112 [inline] release_pages+0x473/0xc40 mm/swap.c:956 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:320 tlb_batch_pages_flush mm/mmu_gather.c:50 [inline] tlb_flush_mmu_free mm/mmu_gather.c:243 [inline] tlb_flush_mmu mm/mmu_gather.c:250 [inline] tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:341 exit_mmap+0x412/0x6f0 mm/mmap.c:3180 __mmput+0x95/0x300 kernel/fork.c:1114 mmput+0x59/0x70 kernel/fork.c:1135 exit_mm kernel/exit.c:507 [inline] do_exit+0xab3/0x2850 kernel/exit.c:793 do_group_exit+0x255/0x320 kernel/exit.c:935 __do_sys_exit_group kernel/exit.c:946 [inline] __se_sys_exit_group kernel/exit.c:944 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:944 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888122312f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888122312f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888122313000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888122313080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888122313100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================