================================================================== BUG: KASAN: use-after-free in strcmp+0x9b/0xb0 lib/string.c:346 Read of size 1 at addr ffff8880203cc284 by task syz-executor.2/3991 CPU: 0 PID: 3991 Comm: syz-executor.2 Not tainted 5.17.0-rc5-syzkaller-00041-g73878e5eb1bd #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 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:0x7fe8271da059 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:00007fe825b4f168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007fe8272ecf60 RCX: 00007fe8271da059 RDX: 0000000000000000 RSI: 0000000000004000 RDI: 0000000020ffc000 RBP: 00007fe82723408d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdbc6b080f R14: 00007fe825b4f300 R15: 0000000000022000 Allocated by task 3991: 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:2313 [inline] __do_sys_prctl+0xeb5/0x12d0 kernel/sys.c:2602 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 3991: 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+0xff/0x140 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:236 [inline] __cache_free mm/slab.c:3437 [inline] kfree+0xf8/0x2b0 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+0x3fa/0xeb0 mm/mmap.c:1237 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 ffff8880203cc280 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 4 bytes inside of 32-byte region [ffff8880203cc280, ffff8880203cc2a0) The buggy address belongs to the page: page:ffffea000080f300 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880203ccfc1 pfn:0x203cc flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000080b888 ffffea0000713948 ffff888010c40100 raw: ffff8880203ccfc1 ffff8880203cc000 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 3700, ts 214708038573, free_ts 214704748859 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165 __alloc_pages_slowpath.constprop.0+0x2eb/0x20d0 mm/page_alloc.c:4934 __alloc_pages+0x412/0x500 mm/page_alloc.c:5402 __alloc_pages_node include/linux/gfp.h:572 [inline] kmem_getpages mm/slab.c:1378 [inline] cache_grow_begin+0x75/0x390 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 fs/kernfs/dir.c:647 [inline] kernfs_create_dir_ns+0x9c/0x220 fs/kernfs/dir.c:994 sysfs_create_dir_ns+0x127/0x290 fs/sysfs/dir.c:59 create_dir lib/kobject.c:89 [inline] kobject_add_internal+0x2d2/0xa60 lib/kobject.c:255 kobject_add_varg lib/kobject.c:390 [inline] kobject_init_and_add+0x101/0x160 lib/kobject.c:473 netdev_queue_add_kobject net/core/net-sysfs.c:1653 [inline] netdev_queue_update_kobjects+0x1ff/0x4e0 net/core/net-sysfs.c:1705 register_queue_kobjects net/core/net-sysfs.c:1766 [inline] netdev_register_kobject+0x35a/0x430 net/core/net-sysfs.c:2012 register_netdevice+0xd9d/0x1580 net/core/dev.c:9667 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 slab_destroy mm/slab.c:1630 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1650 cache_flusharray mm/slab.c:3410 [inline] ___cache_free+0x303/0x600 mm/slab.c:3472 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x50/0x1a0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc mm/slab.c:3315 [inline] kmem_cache_alloc_trace+0x258/0x4a0 mm/slab.c:3565 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] ref_tracker_alloc+0x110/0x460 lib/ref_tracker.c:77 netdev_tracker_alloc include/linux/netdevice.h:3860 [inline] dev_hold_track include/linux/netdevice.h:3877 [inline] dev_hold_track include/linux/netdevice.h:3872 [inline] rx_queue_add_kobject net/core/net-sysfs.c:1047 [inline] net_rx_queue_update_kobjects+0x20a/0x510 net/core/net-sysfs.c:1101 register_queue_kobjects net/core/net-sysfs.c:1761 [inline] netdev_register_kobject+0x275/0x430 net/core/net-sysfs.c:2012 register_netdevice+0xd9d/0x1580 net/core/dev.c:9667 veth_newlink+0x405/0xa90 drivers/net/veth.c:1694 __rtnl_newlink+0x107c/0x1760 net/core/rtnetlink.c:3483 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3531 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5596 Memory state around the buggy address: ffff8880203cc180: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff8880203cc200: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc >ffff8880203cc280: fa fb fb fb fc fc fc fc 00 00 00 00 fc fc fc fc ^ ffff8880203cc300: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff8880203cc380: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================