================================================================== BUG: KASAN: use-after-free in strcmp+0x9b/0xb0 lib/string.c:346 Read of size 1 at addr ffff8880195e3204 by task syz-executor143/3589 CPU: 0 PID: 3589 Comm: syz-executor143 Not tainted 5.17.0-rc3-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/0x303 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 strcmp+0x9b/0xb0 lib/string.c:346 replace_vma_anon_name mm/madvise.c:141 [inline] madvise_update_vma+0x4e6/0x7f0 mm/madvise.c:212 madvise_vma_behavior+0x116/0x1910 mm/madvise.c:1043 madvise_walk_vmas+0x1d5/0x2d0 mm/madvise.c:1207 do_madvise mm/madvise.c:1385 [inline] do_madvise+0x249/0x3c0 mm/madvise.c:1343 __do_sys_madvise mm/madvise.c:1398 [inline] __se_sys_madvise mm/madvise.c:1396 [inline] __x64_sys_madvise+0xa6/0x110 mm/madvise.c:1396 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 RIP: 0033:0x7fe15c6b9ff9 Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff15ec74b8 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe15c6b9ff9 RDX: 000000000000000b RSI: 0000000000001000 RDI: 0000000020ffc000 RBP: 00007fe15c67dfe0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000000 R11: 0000000000000246 R12: 00007fe15c67e070 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 3589: 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_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524 kasan_kmalloc include/linux/kasan.h:270 [inline] __do_kmalloc mm/slab.c:3694 [inline] __kmalloc+0x209/0x4d0 mm/slab.c:3703 kmalloc include/linux/slab.h:586 [inline] anon_vma_name_alloc mm/madvise.c:75 [inline] replace_vma_anon_name mm/madvise.c:146 [inline] madvise_update_vma+0x546/0x7f0 mm/madvise.c:212 madvise_vma_anon_name+0x7c/0xc0 mm/madvise.c:1236 madvise_walk_vmas+0x1d5/0x2d0 mm/madvise.c:1207 madvise_set_anon_name+0xac/0xe0 mm/madvise.c:1269 prctl_set_vma kernel/sys.c:2305 [inline] __do_sys_prctl+0xeb5/0x12d0 kernel/sys.c:2594 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 3589: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 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+0xee/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:236 [inline] __cache_free mm/slab.c:3437 [inline] kfree+0xf6/0x290 mm/slab.c:3794 vma_anon_name_free mm/madvise.c:88 [inline] kref_put include/linux/kref.h:65 [inline] free_vma_anon_name mm/madvise.c:125 [inline] free_vma_anon_name+0xeb/0x110 mm/madvise.c:116 vm_area_free+0x11/0x30 kernel/fork.c:376 __vma_adjust+0x836/0x24a0 mm/mmap.c:962 vma_merge+0x860/0xeb0 mm/mmap.c:1217 madvise_update_vma+0x1b6/0x7f0 mm/madvise.c:180 madvise_vma_behavior+0x116/0x1910 mm/madvise.c:1043 madvise_walk_vmas+0x1d5/0x2d0 mm/madvise.c:1207 do_madvise mm/madvise.c:1385 [inline] do_madvise+0x249/0x3c0 mm/madvise.c:1343 __do_sys_madvise mm/madvise.c:1398 [inline] __se_sys_madvise mm/madvise.c:1396 [inline] __x64_sys_madvise+0xa6/0x110 mm/madvise.c:1396 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 ffff8880195e3200 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 4 bytes inside of 32-byte region [ffff8880195e3200, ffff8880195e3220) The buggy address belongs to the page: page:ffffea00006578c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880195e3fc1 pfn:0x195e3 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00008f1408 ffffea0000604788 ffff888010c40100 raw: ffff8880195e3fc1 ffff8880195e3000 000000010000003c 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 1, ts 7402281409, free_ts 7402132763 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 __alloc_pages_node include/linux/gfp.h:572 [inline] kmem_getpages mm/slab.c:1378 [inline] cache_grow_begin+0x75/0x350 mm/slab.c:2584 cache_alloc_refill+0x27f/0x380 mm/slab.c:2957 ____cache_alloc mm/slab.c:3040 [inline] ____cache_alloc mm/slab.c:3023 [inline] __do_cache_alloc mm/slab.c:3267 [inline] slab_alloc mm/slab.c:3308 [inline] __do_kmalloc mm/slab.c:3692 [inline] __kmalloc_track_caller+0x3b0/0x4d0 mm/slab.c:3709 kstrdup+0x36/0x70 mm/util.c:60 kstrdup_const+0x53/0x80 mm/util.c:83 __kernfs_new_node+0x9d/0x8b0 fs/kernfs/dir.c:581 kernfs_new_node+0x93/0x120 fs/kernfs/dir.c:647 kernfs_create_link+0xcb/0x230 fs/kernfs/symlink.c:39 sysfs_do_create_link_sd+0x90/0x140 fs/sysfs/symlink.c:44 sysfs_do_create_link fs/sysfs/symlink.c:80 [inline] sysfs_create_link+0x5f/0xc0 fs/sysfs/symlink.c:92 device_add_class_symlinks drivers/base/core.c:3147 [inline] device_add+0x789/0x1ee0 drivers/base/core.c:3353 tty_register_device_attr+0x38e/0x7a0 drivers/tty/tty_io.c:3253 tty_register_device drivers/tty/tty_io.c:3188 [inline] tty_register_driver+0x428/0x800 drivers/tty/tty_io.c:3453 legacy_pty_init drivers/tty/pty.c:589 [inline] pty_init+0x648/0xdfc drivers/tty/pty.c:953 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_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 __vunmap+0x798/0xc50 mm/vmalloc.c:2635 free_work+0x58/0x70 mm/vmalloc.c:97 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x2e9/0x3a0 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff8880195e3100: 00 00 01 fc fc fc fc fc 06 fc fc fc fc fc fc fc ffff8880195e3180: 06 fc fc fc fc fc fc fc 06 fc fc fc fc fc fc fc >ffff8880195e3200: fa fb fb fb fc fc fc fc 06 fc fc fc fc fc fc fc ^ ffff8880195e3280: fa fb fb fb fc fc fc fc 06 fc fc fc fc fc fc fc ffff8880195e3300: 06 fc fc fc fc fc fc fc 06 fc fc fc fc fc fc fc ==================================================================