================================================================== BUG: KASAN: use-after-free in strcmp+0x9b/0xb0 lib/string.c:346 Read of size 1 at addr ffff88808397a284 by task syz-executor.3/31509 CPU: 1 PID: 31509 Comm: syz-executor.3 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:0x7f663de0c059 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f663c781168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f663df1ef60 RCX: 00007f663de0c059 RDX: 000000000000000b RSI: 0000000000001000 RDI: 0000000020ffc000 RBP: 00007f663de6608d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff43c861df R14: 00007f663c781300 R15: 0000000000022000 Allocated by task 31509: 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 31509: 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 ffff88808397a280 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 4 bytes inside of 32-byte region [ffff88808397a280, ffff88808397a2a0) The buggy address belongs to the page: page:ffffea00020e5e80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88808397afc1 pfn:0x8397a flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0002003e08 ffffea00009f2688 ffff888010c40100 raw: ffff88808397afc1 ffff88808397a000 000000010000003f 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 0x3420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 3686, ts 739740102111, free_ts 739637299978 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+0x3b3/0x4d0 mm/slab.c:3703 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:715 [inline] kobject_get_path+0x3e/0x70 lib/kobject.c:179 kobject_uevent_env+0x259/0x1600 lib/kobject_uevent.c:529 disk_event_uevent+0x17b/0x1e0 block/disk-events.c:181 disk_force_media_change+0x1e/0xc0 block/disk-events.c:305 __loop_clr_fd+0x793/0xd80 drivers/block/loop.c:1149 loop_rundown_workfn+0x6f/0x150 drivers/block/loop.c:1185 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 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_list+0x1a9/0xfa0 mm/page_alloc.c:3441 release_pages+0x317/0x1220 mm/swap.c:980 __pagevec_release+0x77/0x100 mm/swap.c:1000 pagevec_release include/linux/pagevec.h:82 [inline] folio_batch_release include/linux/pagevec.h:146 [inline] truncate_inode_pages_range+0x322/0x11a0 mm/truncate.c:382 kill_bdev block/bdev.c:77 [inline] blkdev_flush_mapping+0x18f/0x3c0 block/bdev.c:656 blkdev_put_whole block/bdev.c:687 [inline] blkdev_put+0x700/0x950 block/bdev.c:944 blkdev_close+0x6a/0x80 block/fops.c:515 __fput+0x286/0x9f0 fs/file_table.c:311 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88808397a180: 06 fc fc fc fc fc fc fc 05 fc fc fc fc fc fc fc ffff88808397a200: 00 00 00 fc fc fc fc fc 05 fc fc fc fc fc fc fc >ffff88808397a280: fa fb fb fb fc fc fc fc 06 fc fc fc fc fc fc fc ^ ffff88808397a300: 00 01 fc fc fc fc fc fc 00 01 fc fc fc fc fc fc ffff88808397a380: 00 01 fc fc fc fc fc fc 05 fc fc fc fc fc fc fc ==================================================================