================================================================== BUG: KASAN: use-after-free in d_inode include/linux/dcache.h:516 [inline] BUG: KASAN: use-after-free in relay_switch_subbuf+0x837/0x900 kernel/relay.c:676 Read of size 8 at addr ffff88803381dc50 by task udevd/2974 CPU: 0 PID: 2974 Comm: udevd Not tainted 5.19.0-rc5-syzkaller-00228-ge5524c2a1fc4 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 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+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 d_inode include/linux/dcache.h:516 [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_bio+0x326/0x4f0 kernel/trace/blktrace.c:905 trace_block_bio_queue include/trace/events/block.h:355 [inline] submit_bio_noacct+0x1404/0x1b30 block/blk-core.c:843 submit_bio block/blk-core.c:901 [inline] submit_bio+0xd7/0x300 block/blk-core.c:873 submit_bh_wbc+0x4bc/0x670 fs/buffer.c:3039 submit_bh fs/buffer.c:3045 [inline] block_read_full_folio+0x724/0xa60 fs/buffer.c:2337 do_read_cache_folio+0x281/0x760 mm/filemap.c:3524 do_read_cache_page mm/filemap.c:3602 [inline] read_cache_page+0x59/0x2a0 mm/filemap.c:3611 read_mapping_page include/linux/pagemap.h:759 [inline] read_part_sector+0xf6/0x920 block/partitions/core.c:715 adfspart_check_ICS+0x9a/0x690 block/partitions/acorn.c:360 check_partition block/partitions/core.c:147 [inline] blk_add_partitions block/partitions/core.c:600 [inline] bdev_disk_changed block/partitions/core.c:686 [inline] bdev_disk_changed+0x629/0xf60 block/partitions/core.c:653 blkdev_get_whole+0x18a/0x2d0 block/bdev.c:686 blkdev_get_by_dev.part.0+0x5ec/0xb90 block/bdev.c:823 blkdev_get_by_dev+0x6b/0x80 block/bdev.c:857 blkdev_open+0x13c/0x2c0 block/fops.c:481 do_dentry_open+0x4a1/0x11f0 fs/open.c:848 do_open fs/namei.c:3520 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3653 do_filp_open+0x1aa/0x400 fs/namei.c:3680 do_sys_openat2+0x16d/0x4c0 fs/open.c:1278 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1305 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+0x46/0xb0 RIP: 0033:0x7fcd76f25697 Code: 25 00 00 41 00 3d 00 00 41 00 74 37 64 8b 04 25 18 00 00 00 85 c0 75 5b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 85 00 00 00 48 83 c4 68 5d 41 5c c3 0f 1f RSP: 002b:00007fff56e2dfd0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcd76f25697 RDX: 00000000000a0800 RSI: 000055ed6558ffa0 RDI: 00000000ffffff9c RBP: 000055ed6558ffa0 R08: 0000000000000008 R09: 000055ed655bd130 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000a0800 R13: 000055ed6558a670 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 8588: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3243 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc_lru+0x31a/0x720 mm/slub.c:3275 __d_alloc+0x32/0x960 fs/dcache.c:1769 d_alloc+0x4a/0x230 fs/dcache.c:1849 __lookup_hash+0xc8/0x180 fs/namei.c:1598 filename_create+0x1d6/0x4a0 fs/namei.c:3747 do_symlinkat+0xc4/0x2e0 fs/namei.c:4360 __do_sys_symlink fs/namei.c:4392 [inline] __se_sys_symlink fs/namei.c:4390 [inline] __x64_sys_symlink+0x75/0x90 fs/namei.c:4390 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+0x46/0xb0 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3126 dentry_free+0xc3/0x160 fs/dcache.c:377 __dentry_kill+0x4cb/0x640 fs/dcache.c:621 dentry_kill fs/dcache.c:745 [inline] dput+0x64d/0xdb0 fs/dcache.c:913 do_unlinkat+0x3dc/0x650 fs/namei.c:4263 __do_sys_unlink fs/namei.c:4308 [inline] __se_sys_unlink fs/namei.c:4306 [inline] __x64_sys_unlink+0xc6/0x110 fs/namei.c:4306 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+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3126 dentry_free+0xc3/0x160 fs/dcache.c:377 __dentry_kill+0x4cb/0x640 fs/dcache.c:621 dentry_kill fs/dcache.c:745 [inline] dput+0x64d/0xdb0 fs/dcache.c:913 find_next_child fs/libfs.c:264 [inline] simple_recursive_removal+0x136/0x830 fs/libfs.c:279 debugfs_remove fs/debugfs/inode.c:742 [inline] debugfs_remove+0x59/0x80 fs/debugfs/inode.c:736 blk_unregister_queue+0x202/0x350 block/blk-sysfs.c:946 del_gendisk+0x31f/0x900 block/genhd.c:638 loop_remove+0x3a/0x140 drivers/block/loop.c:2059 loop_control_remove drivers/block/loop.c:2115 [inline] loop_control_ioctl+0x42b/0x540 drivers/block/loop.c:2153 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 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+0x46/0xb0 The buggy address belongs to the object at ffff88803381dbe8 which belongs to the cache dentry of size 312 The buggy address is located 104 bytes inside of 312-byte region [ffff88803381dbe8, ffff88803381dd20) The buggy address belongs to the physical page: page:ffffea0000ce0700 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88803381d318 pfn:0x3381c head:ffffea0000ce0700 order:1 compound_mapcount:0 compound_pincount:0 memcg:ffff88801f86a401 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea000221f388 ffffea00025b5d88 ffff888140007640 raw: ffff88803381d318 0000000000150010 00000001ffffffff ffff88801f86a401 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 3632, tgid 3632 (syz-executor.1), ts 188362616609, free_ts 0 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x9c4/0xe20 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc_lru+0x504/0x720 mm/slub.c:3275 __d_alloc+0x32/0x960 fs/dcache.c:1769 d_alloc_pseudo+0x19/0x70 fs/dcache.c:1899 alloc_file_pseudo+0xc6/0x250 fs/file_table.c:262 sock_alloc_file+0x4f/0x190 net/socket.c:463 sock_map_fd net/socket.c:487 [inline] __sys_socket+0x1a4/0x240 net/socket.c:1644 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1647 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+0x46/0xb0 page_owner free stack trace missing Memory state around the buggy address: ffff88803381db00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88803381db80: 00 00 00 00 00 fc fc fc fc fc fc fc fc fb fb fb >ffff88803381dc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803381dc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803381dd00: fb fb fb fb fc fc fc fc fc fc fc fc 00 00 00 00 ==================================================================