================================================================== BUG: KASAN: invalid-free in slab_free mm/slub.c:3809 [inline] BUG: KASAN: invalid-free in __kmem_cache_free+0xb8/0x2d0 mm/slub.c:3822 Free of addr ffff88808202ac30 by task syz-executor.0/31434 CPU: 1 PID: 31434 Comm: syz-executor.0 Not tainted 6.6.0-rc2-next-20230921-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report_invalid_free+0xab/0xd0 mm/kasan/report.c:550 ____kasan_slab_free+0x1a0/0x1b0 mm/kasan/common.c:216 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2d0 mm/slub.c:3822 ovl_do_copy_up fs/overlayfs/copy_up.c:973 [inline] ovl_copy_up_one+0x15ac/0x3250 fs/overlayfs/copy_up.c:1137 ovl_copy_up_flags+0x189/0x200 fs/overlayfs/copy_up.c:1192 ovl_nlink_start+0x391/0x470 fs/overlayfs/util.c:1144 ovl_do_remove+0x16d/0xd50 fs/overlayfs/dir.c:893 vfs_unlink+0x2f1/0x900 fs/namei.c:4313 do_unlinkat+0x3da/0x6d0 fs/namei.c:4379 __do_sys_unlink fs/namei.c:4427 [inline] __se_sys_unlink fs/namei.c:4425 [inline] __x64_sys_unlink+0xc8/0x110 fs/namei.c:4425 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f612f67cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f612e1fe0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 00007f612f79bf80 RCX: 00007f612f67cae9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000200 RBP: 00007f612e1fe120 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 R13: 000000000000000b R14: 00007f612f79bf80 R15: 00007fff0f7dcfe8 Allocated by task 31434: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc_lru+0x215/0x670 mm/slub.c:3509 __d_alloc+0x32/0xac0 fs/dcache.c:1768 d_alloc+0x4e/0x220 fs/dcache.c:1848 lookup_one_qstr_excl+0xc7/0x180 fs/namei.c:1604 do_unlinkat+0x294/0x6d0 fs/namei.c:4365 __do_sys_unlink fs/namei.c:4427 [inline] __se_sys_unlink fs/namei.c:4425 [inline] __x64_sys_unlink+0xc8/0x110 fs/namei.c:4425 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653 dentry_free+0xc2/0x160 fs/dcache.c:377 __dentry_kill+0x4c1/0x640 fs/dcache.c:621 dentry_kill fs/dcache.c:745 [inline] dput+0x6de/0xf80 fs/dcache.c:913 __fput+0x536/0xa70 fs/file_table.c:392 task_work_run+0x14d/0x240 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x215/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653 dentry_free+0xc2/0x160 fs/dcache.c:377 __dentry_kill+0x4c1/0x640 fs/dcache.c:621 shrink_dentry_list+0x22b/0x7d0 fs/dcache.c:1201 shrink_dcache_parent+0xdf/0x3b0 fs/dcache.c:1652 vfs_rmdir fs/namei.c:4188 [inline] vfs_rmdir+0x220/0x650 fs/namei.c:4161 do_rmdir+0x344/0x400 fs/namei.c:4243 __do_sys_unlinkat fs/namei.c:4421 [inline] __se_sys_unlinkat fs/namei.c:4415 [inline] __x64_sys_unlinkat+0xef/0x130 fs/namei.c:4415 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88808202abc0 which belongs to the cache dentry of size 312 The buggy address is located 112 bytes inside of 312-byte region [ffff88808202abc0, ffff88808202acf8) The buggy address belongs to the physical page: page:ffffea0002080a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8202a head:ffffea0002080a80 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff8880772a3201 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff88814000a8c0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000150015 00000001ffffffff ffff8880772a3201 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 5091, tgid 5091 (syz-executor.2), ts 384826965162, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1530 prep_new_page mm/page_alloc.c:1537 [inline] get_page_from_freelist+0xf17/0x2e50 mm/page_alloc.c:3200 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4456 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2305 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc_lru+0x4e1/0x670 mm/slub.c:3509 __d_alloc+0x32/0xac0 fs/dcache.c:1768 d_alloc_pseudo+0x1c/0x70 fs/dcache.c:1898 alloc_file_pseudo+0xdc/0x240 fs/file_table.c:329 sock_alloc_file+0x50/0x1d0 net/socket.c:469 sock_map_fd net/socket.c:494 [inline] __sys_socket+0x1bf/0x260 net/socket.c:1700 __do_sys_socket net/socket.c:1705 [inline] __se_sys_socket net/socket.c:1703 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1703 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd page_owner free stack trace missing Memory state around the buggy address: ffff88808202ab00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88808202ab80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 >ffff88808202ac00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88808202ac80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc ffff88808202ad00: fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 ==================================================================