================================================================== BUG: KASAN: use-after-free in ip_check_mc_rcu+0x604/0x660 net/ipv4/igmp.c:2716 Read of size 4 at addr ffff88806219b098 by task syz-executor.5/11648 CPU: 0 PID: 11648 Comm: syz-executor.5 Not tainted 5.13.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436 ip_check_mc_rcu+0x604/0x660 net/ipv4/igmp.c:2716 __mkroute_output net/ipv4/route.c:2510 [inline] ip_route_output_key_hash_rcu+0x1959/0x2ce0 net/ipv4/route.c:2789 ip_route_output_key_hash+0x1a4/0x2f0 net/ipv4/route.c:2617 __ip_route_output_key include/net/route.h:126 [inline] ip_route_output_flow+0x23/0x150 net/ipv4/route.c:2849 udp_sendmsg+0x1a2f/0x2730 net/ipv4/udp.c:1206 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:821 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:674 ____sys_sendmsg+0x331/0x810 net/socket.c:2350 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404 __sys_sendmmsg+0x195/0x470 net/socket.c:2490 __do_sys_sendmmsg net/socket.c:2519 [inline] __se_sys_sendmmsg net/socket.c:2516 [inline] __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2516 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665d9 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe6415f3188 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000003 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffd44f7cc1f R14: 00007fe6415f3300 R15: 0000000000022000 Allocated by task 11681: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc mm/kasan/common.c:507 [inline] ____kasan_kmalloc mm/kasan/common.c:466 [inline] __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:516 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:686 [inline] ip_mc_add1_src net/ipv4/igmp.c:1971 [inline] ip_mc_add_src+0x7f8/0xdb0 net/ipv4/igmp.c:2095 ip_mc_msfilter+0x899/0xb40 net/ipv4/igmp.c:2479 do_ip_setsockopt net/ipv4/ip_sockglue.c:1255 [inline] ip_setsockopt+0x3272/0x3a40 net/ipv4/ip_sockglue.c:1423 tcp_setsockopt+0x136/0x24a0 net/ipv4/tcp.c:3654 __sys_setsockopt+0x2db/0x610 net/socket.c:2117 __do_sys_setsockopt net/socket.c:2128 [inline] __se_sys_setsockopt net/socket.c:2125 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 11644: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:212 [inline] slab_free_hook mm/slub.c:1582 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1607 slab_free mm/slub.c:3167 [inline] kfree+0xe5/0x7f0 mm/slub.c:4217 ip_mc_del1_src+0x67d/0x800 net/ipv4/igmp.c:1884 ip_mc_del_src.isra.0+0x3e1/0x960 net/ipv4/igmp.c:1925 ip_mc_leave_src.isra.0+0x102/0x240 net/ipv4/igmp.c:2231 ip_mc_drop_socket+0x11a/0x260 net/ipv4/igmp.c:2677 inet_release+0x97/0x280 net/ipv4/af_inet.c:418 __sock_release+0xcd/0x280 net/socket.c:599 sock_close+0x18/0x20 net/socket.c:1258 __fput+0x288/0x920 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x272/0x280 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:57 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88806219b080 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 24 bytes inside of 32-byte region [ffff88806219b080, ffff88806219b0a0) The buggy address belongs to the page: page:ffffea00018866c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6219b flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888011041500 raw: 0000000000000000 0000000000400040 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 12332, ts 189856212403, free_ts 189381152561 prep_new_page mm/page_alloc.c:2358 [inline] get_page_from_freelist+0x1034/0x2bf0 mm/page_alloc.c:3994 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1645 [inline] allocate_slab+0x32e/0x4c0 mm/slub.c:1785 new_slab mm/slub.c:1848 [inline] new_slab_objects mm/slub.c:2594 [inline] ___slab_alloc+0x4a1/0x810 mm/slub.c:2757 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2797 slab_alloc_node mm/slub.c:2879 [inline] slab_alloc mm/slub.c:2921 [inline] __kmalloc_track_caller+0x301/0x320 mm/slub.c:4565 __do_krealloc mm/slab_common.c:1175 [inline] krealloc+0x87/0xf0 mm/slab_common.c:1208 push_jmp_history kernel/bpf/verifier.c:2068 [inline] is_state_visited kernel/bpf/verifier.c:10428 [inline] do_check kernel/bpf/verifier.c:10568 [inline] do_check_common+0x35bf/0xd1b0 kernel/bpf/verifier.c:12809 do_check_main kernel/bpf/verifier.c:12875 [inline] bpf_check+0x7206/0xbcb0 kernel/bpf/verifier.c:13442 bpf_prog_load+0xe60/0x2160 kernel/bpf/syscall.c:2235 __sys_bpf+0x668/0x5520 kernel/bpf/syscall.c:4430 __do_sys_bpf kernel/bpf/syscall.c:4534 [inline] __se_sys_bpf kernel/bpf/syscall.c:4532 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4532 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 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:1298 [inline] free_pcp_prepare+0x223/0x300 mm/page_alloc.c:1342 free_unref_page_prepare mm/page_alloc.c:3250 [inline] free_unref_page+0x12/0x1d0 mm/page_alloc.c:3298 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 ____kasan_kmalloc mm/kasan/common.c:473 [inline] __kasan_krealloc+0x120/0x160 mm/kasan/common.c:575 kasan_krealloc include/linux/kasan.h:266 [inline] __do_krealloc mm/slab_common.c:1171 [inline] krealloc+0x54/0xf0 mm/slab_common.c:1208 push_jmp_history kernel/bpf/verifier.c:2068 [inline] is_state_visited kernel/bpf/verifier.c:10428 [inline] do_check kernel/bpf/verifier.c:10568 [inline] do_check_common+0x35bf/0xd1b0 kernel/bpf/verifier.c:12809 do_check_main kernel/bpf/verifier.c:12875 [inline] bpf_check+0x7206/0xbcb0 kernel/bpf/verifier.c:13442 bpf_prog_load+0xe60/0x2160 kernel/bpf/syscall.c:2235 __sys_bpf+0x668/0x5520 kernel/bpf/syscall.c:4430 __do_sys_bpf kernel/bpf/syscall.c:4534 [inline] __se_sys_bpf kernel/bpf/syscall.c:4532 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4532 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88806219af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88806219b000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc >ffff88806219b080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff88806219b100: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ffff88806219b180: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ==================================================================