================================================================== BUG: KASAN: use-after-free in strcmp+0x9b/0xb0 lib/string.c:346 Read of size 1 at addr ffff88801b135cd4 by task syz-executor.3/7110 CPU: 1 PID: 7110 Comm: syz-executor.3 Not tainted 5.17.0-rc2-next-20220204-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+0xa5/0x3e0 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/0x19d0 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:0x7f6a625bf059 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:00007f6a61534168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f6a626d1f60 RCX: 00007f6a625bf059 RDX: 0000000000000000 RSI: 0000000000003000 RDI: 0000000020ffc000 RBP: 00007f6a6261908d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd6b3efbff R14: 00007f6a61534300 R15: 0000000000022000 Allocated by task 7110: 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+0xa9/0xd0 mm/kasan/common.c:524 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 7110: 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+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:226 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xce/0x2d0 mm/slub.c:4562 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:377 __vma_adjust+0x836/0x24a0 mm/mmap.c:962 vma_merge+0xc87/0xeb0 mm/mmap.c:1213 madvise_update_vma+0x1b6/0x7f0 mm/madvise.c:180 madvise_vma_behavior+0x116/0x19d0 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 ffff88801b135cd0 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 4 bytes inside of 8-byte region [ffff88801b135cd0, ffff88801b135cd8) The buggy address belongs to the page: page:ffffea00006c4d40 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801b1350f0 pfn:0x1b135 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000001 ffff888010c41280 raw: ffff88801b1350f0 0000000080660054 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 0x12820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 3672, ts 172083220880, free_ts 172070269055 prep_new_page mm/page_alloc.c:2489 [inline] get_page_from_freelist+0x13ea/0x31d0 mm/page_alloc.c:4219 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5435 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2268 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x295/0x400 mm/slub.c:2004 ___slab_alloc+0x7ed/0xe00 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x2fb/0x340 mm/slub.c:4420 kmalloc_array include/linux/slab.h:621 [inline] kcalloc include/linux/slab.h:652 [inline] nsim_fib6_event_init drivers/net/netdevsim/fib.c:807 [inline] nsim_fib6_prepare_event drivers/net/netdevsim/fib.c:940 [inline] nsim_fib_event_schedule_work drivers/net/netdevsim/fib.c:991 [inline] nsim_fib_event_nb+0x2f1/0xc50 drivers/net/netdevsim/fib.c:1028 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 atomic_notifier_call_chain+0x70/0x180 kernel/notifier.c:199 call_fib_notifiers+0x119/0x2a0 net/core/fib_notifier.c:35 call_fib6_entry_notifiers net/ipv6/ip6_fib.c:402 [inline] fib6_add_rt2node net/ipv6/ip6_fib.c:1224 [inline] fib6_add+0xe21/0x3f10 net/ipv6/ip6_fib.c:1478 __ip6_ins_rt net/ipv6/route.c:1302 [inline] ip6_ins_rt+0xb2/0x110 net/ipv6/route.c:1312 __ipv6_ifa_notify+0x84e/0xa90 net/ipv6/addrconf.c:6127 ipv6_ifa_notify net/ipv6/addrconf.c:6166 [inline] addrconf_dad_completed+0x150/0xd60 net/ipv6/addrconf.c:4191 addrconf_dad_begin net/ipv6/addrconf.c:3996 [inline] addrconf_dad_work+0x862/0x1340 net/ipv6/addrconf.c:4098 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3376 [inline] free_unref_page+0x19/0x6c0 mm/page_alloc.c:3455 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2536 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc_trace+0x1e9/0x2c0 mm/slub.c:3255 kmalloc include/linux/slab.h:581 [inline] netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:643 [inline] netdevice_event+0x1a8/0x8a0 drivers/infiniband/core/roce_gid_mgmt.c:802 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline] call_netdevice_notifiers net/core/dev.c:1945 [inline] dev_set_mac_address+0x2d5/0x3e0 net/core/dev.c:8400 dev_set_mac_address_user+0x2d/0x50 net/core/dev.c:8414 do_setlink+0x184a/0x3a20 net/core/rtnetlink.c:2684 __rtnl_newlink+0xdf5/0x1760 net/core/rtnetlink.c:3414 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3529 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5594 Memory state around the buggy address: ffff88801b135b80: fc fc fa fc fc fc fc fa fc fc fc fc fa fc fc fc ffff88801b135c00: fc fa fc fc fc fc fa fc fc fc fc fa fc fc fc fc >ffff88801b135c80: fa fc fc fc fc fa fc fc fc fc fa fc fc fc fc fa ^ ffff88801b135d00: fc fc fc fc fb fc fc fc fc fa fc fc fc fc fb fc ffff88801b135d80: fc fc fc fa fc fc fc fc fa fc fc fc fc fa fc fc ==================================================================