================================================================== BUG: KASAN: use-after-free in d_inode include/linux/dcache.h:526 [inline] BUG: KASAN: use-after-free in relay_switch_subbuf+0x837/0x900 kernel/relay.c:676 Read of size 8 at addr ffff88806e6244d0 by task ksoftirqd/1/19 CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.16.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 d_inode include/linux/dcache.h:526 [inline] relay_switch_subbuf+0x837/0x900 kernel/relay.c:676 relay_reserve include/linux/relay.h:248 [inline] trace_note+0x5af/0x720 kernel/trace/blktrace.c:95 trace_note_tsk kernel/trace/blktrace.c:126 [inline] __blk_add_trace+0xbfb/0xdf0 kernel/trace/blktrace.c:267 blk_add_trace_rq+0x392/0x490 kernel/trace/blktrace.c:836 trace_block_rq_complete include/trace/events/block.h:115 [inline] blk_update_request+0x9af/0x1400 block/blk-mq.c:715 blk_mq_end_request+0x4b/0x80 block/blk-mq.c:821 lo_complete_rq+0x1c2/0x280 drivers/block/loop.c:369 blk_complete_reqs+0xad/0xe0 block/blk-mq.c:891 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 run_ksoftirqd kernel/softirq.c:920 [inline] run_ksoftirqd+0x2d/0x60 kernel/softirq.c:912 smpboot_thread_fn+0x645/0x9c0 kernel/smpboot.c:164 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 13005: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3247 __d_alloc+0x2a/0x950 fs/dcache.c:1744 d_alloc+0x4a/0x230 fs/dcache.c:1823 d_alloc_parallel+0xe2/0x19f0 fs/dcache.c:2575 __lookup_slow+0x193/0x480 fs/namei.c:1642 lookup_slow fs/namei.c:1674 [inline] lookup_one_len_unlocked+0x127/0x150 fs/namei.c:2745 ovl_lookup_positive_unlocked fs/overlayfs/namei.c:205 [inline] ovl_lookup_single+0x66/0xb60 fs/overlayfs/namei.c:230 ovl_lookup_layer+0x3d4/0x480 fs/overlayfs/namei.c:314 ovl_lookup+0xca4/0x1bf0 fs/overlayfs/namei.c:914 __lookup_slow+0x24c/0x480 fs/namei.c:1657 lookup_one_len+0x16a/0x1a0 fs/namei.c:2686 ovl_check_whiteouts+0x127/0x260 fs/overlayfs/readdir.c:281 ovl_dir_read fs/overlayfs/readdir.c:315 [inline] ovl_dir_read_merged+0x477/0x4e0 fs/overlayfs/readdir.c:372 ovl_cache_get fs/overlayfs/readdir.c:414 [inline] ovl_iterate+0x80d/0xe40 fs/overlayfs/readdir.c:764 iterate_dir+0x1f9/0x700 fs/readdir.c:67 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __x64_sys_getdents64+0x13a/0x2c0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kmem_cache_free+0xbd/0x5d0 mm/slub.c:3530 rcu_do_batch kernel/rcu/tree.c:2506 [inline] rcu_core+0x7ab/0x1470 kernel/rcu/tree.c:2741 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 dentry_free+0xc3/0x160 fs/dcache.c:352 __dentry_kill+0x4cb/0x640 fs/dcache.c:596 shrink_dentry_list+0x128/0x490 fs/dcache.c:1176 shrink_dcache_parent+0x1fe/0x3c0 fs/dcache.c:1603 vfs_rmdir.part.0+0x1de/0x4b0 fs/namei.c:3972 vfs_rmdir fs/namei.c:3954 [inline] do_rmdir+0x3a6/0x430 fs/namei.c:4030 __do_sys_rmdir fs/namei.c:4049 [inline] __se_sys_rmdir fs/namei.c:4047 [inline] __x64_sys_rmdir+0xc6/0x110 fs/namei.c:4047 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Second to last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 dentry_free+0xc3/0x160 fs/dcache.c:352 __dentry_kill+0x4cb/0x640 fs/dcache.c:596 dentry_kill fs/dcache.c:720 [inline] dput+0x669/0xbc0 fs/dcache.c:888 do_renameat2+0xb6b/0xc80 fs/namei.c:4779 __do_sys_rename fs/namei.c:4823 [inline] __se_sys_rename fs/namei.c:4821 [inline] __x64_sys_rename+0x7d/0xa0 fs/namei.c:4821 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88806e624468 which belongs to the cache dentry of size 312 The buggy address is located 104 bytes inside of 312-byte region [ffff88806e624468, ffff88806e6245a0) The buggy address belongs to the page: page:ffffea0001b98900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6e624 head:ffffea0001b98900 order:1 compound_mapcount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010dd0500 raw: 0000000000000000 0000000000150015 00000001ffffffff 0000000000000000 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 1, ts 50607493793, free_ts 10280837334 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3247 __d_alloc+0x2a/0x950 fs/dcache.c:1744 d_alloc+0x4a/0x230 fs/dcache.c:1823 d_alloc_parallel+0xe2/0x19f0 fs/dcache.c:2575 lookup_open.isra.0+0x85e/0x13d0 fs/namei.c:3204 open_last_lookups fs/namei.c:3350 [inline] path_openat+0x9b8/0x2750 fs/namei.c:3556 do_filp_open+0x1aa/0x400 fs/namei.c:3586 do_sys_openat2+0x16d/0x4d0 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_open fs/open.c:1236 [inline] __se_sys_open fs/open.c:1232 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1232 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 free_contig_range+0xa8/0xf0 mm/page_alloc.c:9271 destroy_args+0xa8/0x646 mm/debug_vm_pgtable.c:1016 debug_vm_pgtable+0x2984/0x2a16 mm/debug_vm_pgtable.c:1330 do_one_initcall+0x103/0x650 init/main.c:1297 do_initcall_level init/main.c:1370 [inline] do_initcalls init/main.c:1386 [inline] do_basic_setup init/main.c:1405 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1610 kernel_init+0x1a/0x1d0 init/main.c:1499 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88806e624380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806e624400: fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb >ffff88806e624480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806e624500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806e624580: fb fb fb fb fc fc fc fc fc fc fc fc 00 00 00 00 ==================================================================