================================================================== BUG: KASAN: use-after-free in strcmp+0x66/0xa0 lib/string.c:346 Read of size 1 at addr ffff88807ed2b5f4 by task syz-executor.1/4595 CPU: 1 PID: 4595 Comm: syz-executor.1 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:0x7f72bf3a4059 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:00007f72bdd19168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f72bf4b6f60 RCX: 00007f72bf3a4059 RDX: 0000000000000000 RSI: 0000000000003000 RDI: 0000000020ffc000 RBP: 00007f72bf3fe08d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdb222e2df R14: 00007f72bdd19300 R15: 0000000000022000 Allocated by task 4595: 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 4595: 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+0xd15/0x1020 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 ffff88807ed2b5f0 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 4 bytes inside of 8-byte region [ffff88807ed2b5f0, ffff88807ed2b5f8) The buggy address belongs to the page: page:ffffea0001fb4ac0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ed2b flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888011441280 raw: 0000000000000000 0000000080660066 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 3625, ts 162884471134, free_ts 162884293405 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] __kmalloc_node+0x2ec/0x420 mm/slub.c:4468 kmalloc_node include/linux/slab.h:604 [inline] __vmalloc_area_node mm/vmalloc.c:2948 [inline] __vmalloc_node_range+0x376/0xd90 mm/vmalloc.c:3107 __vmalloc_node mm/vmalloc.c:3157 [inline] vzalloc+0x75/0x80 mm/vmalloc.c:3227 __do_replace+0xc2/0xab0 net/ipv6/netfilter/ip6_tables.c:1066 do_replace net/ipv6/netfilter/ip6_tables.c:1157 [inline] do_ip6t_set_ctl+0x2cd3/0x3de0 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x29f/0x2d0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x2913/0x5e00 net/ipv6/ipv6_sockglue.c:1024 __sys_setsockopt+0x552/0x980 net/socket.c:2180 __do_sys_setsockopt net/socket.c:2191 [inline] __se_sys_setsockopt net/socket.c:2188 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2188 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 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+0x7d/0x580 mm/page_alloc.c:3404 __vunmap+0x936/0xa80 mm/vmalloc.c:2635 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:884 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1041 [inline] do_ip6t_get_ctl+0x186c/0x1f60 net/ipv6/netfilter/ip6_tables.c:1672 nf_getsockopt+0x2ab/0x2d0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x4ae/0x3f30 net/ipv6/ipv6_sockglue.c:1502 __sys_getsockopt+0x29f/0x560 net/socket.c:2224 __do_sys_getsockopt net/socket.c:2239 [inline] __se_sys_getsockopt net/socket.c:2236 [inline] __x64_sys_getsockopt+0xb1/0xc0 net/socket.c:2236 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 Memory state around the buggy address: ffff88807ed2b480: fc fb fc fc fc fc fa fc fc fc fc fa fc fc fc fc ffff88807ed2b500: fa fc fc fc fc fa fc fc fc fc fa fc fc fc fc fa >ffff88807ed2b580: fc fc fc fc fa fc fc fc fc fa fc fc fc fc fa fc ^ ffff88807ed2b600: fc fc fc 05 fc fc fc fc fa fc fc fc fc fa fc fc ffff88807ed2b680: fc fc fa fc fc fc fc fa fc fc fc fc fa fc fc fc ==================================================================