================================================================== BUG: KASAN: use-after-free in strcmp+0x9b/0xb0 lib/string.c:346 Read of size 1 at addr ffff8880749aa044 by task syz-executor.2/5776 CPU: 1 PID: 5776 Comm: syz-executor.2 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+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:0x7fad1cea9059 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:00007fad1b81e168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007fad1cfbbf60 RCX: 00007fad1cea9059 RDX: 0000000000000000 RSI: 0000000000003000 RDI: 0000000020ffc000 RBP: 00007fad1cf0308d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffa7b9a18f R14: 00007fad1b81e300 R15: 0000000000022000 Allocated by task 5776: 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 5776: 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+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 ffff8880749aa040 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 4 bytes inside of 32-byte region [ffff8880749aa040, ffff8880749aa060) The buggy address belongs to the page: page:ffffea0001d26a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880749aafc1 pfn:0x749aa flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001dc5b08 ffffea0001c23688 ffff888010c40100 raw: ffff8880749aafc1 ffff8880749aa000 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 3625, ts 196610688095, free_ts 196610480511 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] kmem_cache_alloc_trace+0x380/0x4a0 mm/slab.c:3565 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:715 [inline] selinux_sk_alloc_security+0x8a/0x210 security/selinux/hooks.c:5245 security_sk_alloc+0x50/0xb0 security/security.c:2266 sk_prot_alloc+0x1e5/0x290 net/core/sock.c:1926 sk_alloc+0x32/0xa80 net/core/sock.c:1976 inet_create net/ipv4/af_inet.c:319 [inline] inet_create+0x395/0xea0 net/ipv4/af_inet.c:245 __sock_create+0x353/0x790 net/socket.c:1468 sock_create net/socket.c:1519 [inline] __sys_socket+0xef/0x200 net/socket.c:1561 __do_sys_socket net/socket.c:1570 [inline] __se_sys_socket net/socket.c:1568 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1568 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 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 __vfree+0x3c/0xd0 mm/vmalloc.c:2683 vfree+0x5a/0x90 mm/vmalloc.c:2714 copy_entries_to_user net/ipv4/netfilter/arp_tables.c:713 [inline] get_entries net/ipv4/netfilter/arp_tables.c:867 [inline] do_arpt_get_ctl+0x7ac/0x8f0 net/ipv4/netfilter/arp_tables.c:1453 nf_getsockopt+0x72/0xd0 net/netfilter/nf_sockopt.c:116 ip_getsockopt net/ipv4/ip_sockglue.c:1786 [inline] ip_getsockopt+0x164/0x1c0 net/ipv4/ip_sockglue.c:1765 tcp_getsockopt+0x86/0xd0 net/ipv4/tcp.c:4293 __sys_getsockopt+0x21f/0x5f0 net/socket.c:2224 __do_sys_getsockopt net/socket.c:2239 [inline] __se_sys_getsockopt net/socket.c:2236 [inline] __x64_sys_getsockopt+0xba/0x150 net/socket.c:2236 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 Memory state around the buggy address: ffff8880749a9f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880749a9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880749aa000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff8880749aa080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff8880749aa100: 00 00 fc fc fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================