================================================================== BUG: KASAN: use-after-free in strcmp+0x66/0xa0 lib/string.c:346 Read of size 1 at addr ffff888019c92a04 by task syz-executor.5/7254 CPU: 1 PID: 7254 Comm: syz-executor.5 Not tainted 5.17.0-rc3-syzkaller-00247-g83e396641110 #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+0x1dc/0x2d8 lib/dump_stack.c:106 print_address_description+0x65/0x3a0 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x19a/0x1f0 mm/kasan/report.c:459 strcmp+0x66/0xa0 lib/string.c:346 replace_vma_anon_name mm/madvise.c:141 [inline] madvise_update_vma+0x49d/0x7e0 mm/madvise.c:212 madvise_vma_behavior mm/madvise.c:1043 [inline] madvise_walk_vmas mm/madvise.c:1207 [inline] do_madvise+0xb6e/0x1200 mm/madvise.c:1385 __do_sys_madvise mm/madvise.c:1398 [inline] __se_sys_madvise mm/madvise.c:1396 [inline] __x64_sys_madvise+0xa2/0xb0 mm/madvise.c:1396 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fb74b4ea059 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:00007fb749e5f168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007fb74b5fcf60 RCX: 00007fb74b4ea059 RDX: 0000000000000000 RSI: 0000000000003000 RDI: 0000000020ffc000 RBP: 00007fb74b54408d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff3a802b3f R14: 00007fb749e5f300 R15: 0000000000022000 Allocated by task 7254: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:515 kasan_kmalloc include/linux/kasan.h:270 [inline] __kmalloc+0x253/0x380 mm/slub.c:4424 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+0x584/0x7e0 mm/madvise.c:212 madvise_vma_anon_name mm/madvise.c:1236 [inline] madvise_walk_vmas mm/madvise.c:1207 [inline] madvise_set_anon_name+0x367/0x520 mm/madvise.c:1269 prctl_set_vma+0x19b/0x220 kernel/sys.c:2305 __do_sys_prctl+0x183/0x1120 kernel/sys.c:2594 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 7254: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x126/0x180 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xb8/0x2e0 mm/slub.c:4562 vm_area_free+0x11/0x30 kernel/fork.c:376 __vma_adjust+0x315d/0x3910 mm/mmap.c:962 vma_merge+0xbe3/0x1020 mm/mmap.c:1237 madvise_update_vma+0x235/0x7e0 mm/madvise.c:180 madvise_vma_behavior mm/madvise.c:1043 [inline] madvise_walk_vmas mm/madvise.c:1207 [inline] do_madvise+0xb6e/0x1200 mm/madvise.c:1385 __do_sys_madvise mm/madvise.c:1398 [inline] __se_sys_madvise mm/madvise.c:1396 [inline] __x64_sys_madvise+0xa2/0xb0 mm/madvise.c:1396 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888019c92a00 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 4 bytes inside of 8-byte region [ffff888019c92a00, ffff888019c92a08) The buggy address belongs to the page: page:ffffea0000672480 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888019c92078 pfn:0x19c92 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000052f9c0 dead000000000003 ffff888011441280 raw: ffff888019c92078 0000000080660050 00000001ffffffff 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 8554, ts 230120341151, free_ts 212856990270 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0x729/0x9e0 mm/page_alloc.c:4165 __alloc_pages+0x255/0x580 mm/page_alloc.c:5389 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0xce/0x3f0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x3fe/0xc30 mm/slub.c:3018 __slab_alloc mm/slub.c:3105 [inline] slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc_track_caller+0x2d4/0x370 mm/slub.c:4926 kstrdup mm/util.c:60 [inline] kstrdup_const+0x51/0x90 mm/util.c:83 __kernfs_new_node+0x99/0x720 fs/kernfs/dir.c:581 kernfs_new_node+0x95/0x160 fs/kernfs/dir.c:647 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:987 sysfs_add_file_mode_ns+0x21d/0x330 fs/sysfs/file.c:294 create_files fs/sysfs/group.c:64 [inline] internal_create_group+0x54c/0xed0 fs/sysfs/group.c:148 internal_create_groups fs/sysfs/group.c:188 [inline] sysfs_create_groups+0x5d/0x130 fs/sysfs/group.c:214 setup_gid_attrs drivers/infiniband/core/sysfs.c:1169 [inline] ib_setup_port_attrs+0x15cb/0x23b0 drivers/infiniband/core/sysfs.c:1441 ib_register_device+0x1156/0x1540 drivers/infiniband/core/device.c:1412 rxe_register_device+0x25d/0x360 drivers/infiniband/sw/rxe/rxe_verbs.c:1146 rxe_net_add+0x73/0xd0 drivers/infiniband/sw/rxe/rxe_net.c:538 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+0xd1c/0xe00 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page_list+0x11f/0xa50 mm/page_alloc.c:3441 release_pages+0x15a7/0x17d0 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:50 [inline] tlb_flush_mmu_free mm/mmu_gather.c:243 [inline] tlb_flush_mmu+0x780/0x910 mm/mmu_gather.c:250 tlb_finish_mmu+0xcb/0x200 mm/mmu_gather.c:341 exit_mmap+0x402/0x740 mm/mmap.c:3180 __mmput+0x111/0x3a0 kernel/fork.c:1114 exit_mm+0x211/0x2f0 kernel/exit.c:507 do_exit+0x5be/0x2140 kernel/exit.c:793 do_group_exit+0x2af/0x2b0 kernel/exit.c:935 get_signal+0x1831/0x2330 kernel/signal.c:2862 arch_do_signal_or_restart+0x9c/0x730 arch/x86/kernel/signal.c:868 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+0x191/0x220 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:300 do_syscall_64+0x53/0xd0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888019c92900: fc fc fb fc fc fc fc fb fc fc fc fc fb fc fc fc ffff888019c92980: fc fa fc fc fc fc fa fc fc fc fc fb fc fc fc fc >ffff888019c92a00: fa fc fc fc fc fb fc fc fc fc fb fc fc fc fc 00 ^ ffff888019c92a80: fc fc fc fc fb fc fc fc fc 00 fc fc fc fc fa fc ffff888019c92b00: fc fc fc fa fc fc fc fc 00 fc fc fc fc 00 fc fc ==================================================================