================================================================== BUG: KASAN: use-after-free in memcpy include/linux/fortify-string.h:191 [inline] BUG: KASAN: use-after-free in __d_alloc+0x19a/0x950 fs/dcache.c:1775 Read of size 5 at addr ffff888029e0b320 by task kdevtmpfs/22 CPU: 1 PID: 22 Comm: kdevtmpfs Not tainted 5.14.0-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:105 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 memcpy+0x20/0x60 mm/kasan/shadow.c:65 memcpy include/linux/fortify-string.h:191 [inline] __d_alloc+0x19a/0x950 fs/dcache.c:1775 d_alloc+0x4a/0x230 fs/dcache.c:1823 __lookup_hash+0xc8/0x180 fs/namei.c:1554 kern_path_locked+0x17e/0x320 fs/namei.c:2567 handle_remove+0xa2/0x5fe drivers/base/devtmpfs.c:312 handle drivers/base/devtmpfs.c:382 [inline] devtmpfs_work_loop drivers/base/devtmpfs.c:395 [inline] devtmpfsd+0x1b9/0x2a3 drivers/base/devtmpfs.c:437 kthread+0x3e5/0x4d0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 22: kasan_save_stack+0x1b/0x40 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+0x83/0xb0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:2959 [inline] slab_alloc mm/slub.c:2967 [inline] kmem_cache_alloc+0x285/0x4a0 mm/slub.c:2972 getname_kernel+0x4e/0x370 fs/namei.c:226 kern_path_locked+0x71/0x320 fs/namei.c:2558 handle_remove+0xa2/0x5fe drivers/base/devtmpfs.c:312 handle drivers/base/devtmpfs.c:382 [inline] devtmpfs_work_loop drivers/base/devtmpfs.c:395 [inline] devtmpfsd+0x1b9/0x2a3 drivers/base/devtmpfs.c:437 kthread+0x3e5/0x4d0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 22: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____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:230 [inline] slab_free_hook mm/slub.c:1628 [inline] slab_free_freelist_hook+0xe3/0x250 mm/slub.c:1653 slab_free mm/slub.c:3213 [inline] kmem_cache_free+0x8a/0x5b0 mm/slub.c:3229 putname.part.0+0xe1/0x120 fs/namei.c:270 putname include/linux/err.h:41 [inline] filename_parentat fs/namei.c:2547 [inline] kern_path_locked+0xc2/0x320 fs/namei.c:2558 handle_remove+0xa2/0x5fe drivers/base/devtmpfs.c:312 handle drivers/base/devtmpfs.c:382 [inline] devtmpfs_work_loop drivers/base/devtmpfs.c:395 [inline] devtmpfsd+0x1b9/0x2a3 drivers/base/devtmpfs.c:437 kthread+0x3e5/0x4d0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff888029e0b300 which belongs to the cache names_cache of size 4096 The buggy address is located 32 bytes inside of 4096-byte region [ffff888029e0b300, ffff888029e0c300) The buggy address belongs to the page: page:ffffea0000a78200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29e08 head:ffffea0000a78200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000a96200 0000000200000002 ffff888010dc53c0 raw: 0000000000000000 0000000080070007 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 10308, ts 2409800561912, free_ts 2409641718102 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4168 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5390 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2291 alloc_slab_page mm/slub.c:1691 [inline] allocate_slab+0x32e/0x4b0 mm/slub.c:1831 new_slab mm/slub.c:1894 [inline] new_slab_objects mm/slub.c:2640 [inline] ___slab_alloc+0x473/0x7b0 mm/slub.c:2803 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2843 slab_alloc_node mm/slub.c:2925 [inline] slab_alloc mm/slub.c:2967 [inline] kmem_cache_alloc+0x3e1/0x4a0 mm/slub.c:2972 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138 getname_flags+0x9a/0xe0 include/linux/audit.h:319 user_path_at_empty+0x2b/0x90 fs/namei.c:2801 do_readlinkat+0xcd/0x2f0 fs/stat.c:443 __do_sys_readlinkat fs/stat.c:470 [inline] __se_sys_readlinkat fs/stat.c:467 [inline] __x64_sys_readlinkat+0x93/0xf0 fs/stat.c:467 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1346 [inline] free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3411 __put_page+0x105/0x400 mm/swap.c:127 put_page include/linux/mm.h:1247 [inline] __skb_frag_unref include/linux/skbuff.h:3107 [inline] skb_release_data+0x49d/0x790 net/core/skbuff.c:671 skb_release_all net/core/skbuff.c:741 [inline] __kfree_skb net/core/skbuff.c:755 [inline] kfree_skb net/core/skbuff.c:773 [inline] kfree_skb+0x133/0x3f0 net/core/skbuff.c:767 kfree_skb_list net/core/skbuff.c:782 [inline] skb_release_data+0x5a6/0x790 net/core/skbuff.c:674 skb_release_all net/core/skbuff.c:741 [inline] __kfree_skb net/core/skbuff.c:755 [inline] kfree_skb net/core/skbuff.c:773 [inline] kfree_skb+0x133/0x3f0 net/core/skbuff.c:767 __skb_queue_purge include/linux/skbuff.h:2831 [inline] kcm_release+0x224/0x720 net/kcm/kcmsock.c:1849 __sock_release+0xcd/0x280 net/socket.c:649 sock_close+0x18/0x20 net/socket.c:1314 __fput+0x288/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 get_signal+0x1b35/0x2160 kernel/signal.c:2641 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:865 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302 Memory state around the buggy address: ffff888029e0b200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888029e0b280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888029e0b300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888029e0b380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888029e0b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================