================================================================== BUG: KASAN: use-after-free in ip_check_mc_rcu+0x546/0x600 net/ipv4/igmp.c:2721 Read of size 8 at addr ffff888037b29310 by task syz-executor.1/5902 CPU: 0 PID: 5902 Comm: syz-executor.1 Not tainted 5.14.0-rc4-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+0x1ae/0x29f lib/dump_stack.c:105 print_address_description+0x66/0x3b0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x163/0x210 mm/kasan/report.c:436 ip_check_mc_rcu+0x546/0x600 net/ipv4/igmp.c:2721 __mkroute_output net/ipv4/route.c:2524 [inline] ip_route_output_key_hash_rcu+0xf3f/0x2570 net/ipv4/route.c:2803 ip_route_output_key_hash+0x1b7/0x300 net/ipv4/route.c:2631 __ip_route_output_key include/net/route.h:126 [inline] ip_route_output_flow+0x25/0x130 net/ipv4/route.c:2863 udp_sendmsg+0x1cf1/0x3260 net/ipv4/udp.c:1219 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg net/socket.c:723 [inline] ____sys_sendmsg+0x5a2/0x900 net/socket.c:2392 ___sys_sendmsg net/socket.c:2446 [inline] __sys_sendmmsg+0x500/0x790 net/socket.c:2532 __do_sys_sendmmsg net/socket.c:2561 [inline] __se_sys_sendmmsg net/socket.c:2558 [inline] __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2558 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665e9 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:00007f5da2142188 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000004 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffd8fdad7bf R14: 00007f5da2142300 R15: 0000000000022000 Allocated by task 5902: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xc4/0xf0 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x96/0x340 mm/slub.c:2983 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] ip_mc_add1_src net/ipv4/igmp.c:1972 [inline] ip_mc_add_src+0x766/0xd80 net/ipv4/igmp.c:2096 ip_mc_msfilter+0x691/0xc50 net/ipv4/igmp.c:2480 do_ip_setsockopt net/ipv4/ip_sockglue.c:1255 [inline] ip_setsockopt+0x3ea4/0x54a0 net/ipv4/ip_sockglue.c:1423 __sys_setsockopt+0x552/0x980 net/socket.c:2159 __do_sys_setsockopt net/socket.c:2170 [inline] __se_sys_setsockopt net/socket.c:2167 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2167 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 5897: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x3d/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0x109/0x150 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1625 [inline] slab_free_freelist_hook+0x1d8/0x290 mm/slub.c:1650 slab_free mm/slub.c:3210 [inline] kfree+0xd0/0x1f0 mm/slub.c:4264 ip_mc_del1_src+0x6ff/0x860 net/ipv4/igmp.c:1885 ip_mc_del_src+0x636/0xa40 net/ipv4/igmp.c:1926 ip_mc_leave_src+0x10b/0x200 net/ipv4/igmp.c:2232 ip_mc_drop_socket+0x198/0x260 net/ipv4/igmp.c:2678 inet_release+0x82/0x1f0 net/ipv4/af_inet.c:418 __sock_release net/socket.c:648 [inline] sock_close+0xd8/0x260 net/socket.c:1300 __fput+0x352/0x7b0 fs/file_table.c:280 task_work_run+0x146/0x1c0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x201/0x220 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:302 do_syscall_64+0x4c/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888037b29300 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 16 bytes inside of 32-byte region [ffff888037b29300, ffff888037b29320) The buggy address belongs to the page: page:ffffea0000deca40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x37b29 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0005169680 0000000e0000000e 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 38529179559, free_ts 38464801844 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4169 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5391 alloc_slab_page mm/slub.c:1688 [inline] allocate_slab+0xf1/0x540 mm/slub.c:1828 new_slab mm/slub.c:1891 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x1cf/0x350 mm/slub.c:2800 __slab_alloc mm/slub.c:2840 [inline] slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc+0x2e7/0x390 mm/slub.c:4108 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] tomoyo_encode2+0x25a/0x560 security/tomoyo/realpath.c:45 tomoyo_encode security/tomoyo/realpath.c:80 [inline] tomoyo_realpath_from_path+0x5c3/0x610 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x201/0x650 security/tomoyo/file.c:822 security_inode_getattr+0xc0/0x140 security/security.c:1332 vfs_getattr fs/stat.c:139 [inline] vfs_statx+0x188/0x3d0 fs/stat.c:207 vfs_fstatat fs/stat.c:225 [inline] vfs_lstat include/linux/fs.h:3386 [inline] __do_sys_newlstat fs/stat.c:380 [inline] __se_sys_newlstat+0xab/0x770 fs/stat.c:374 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/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:1346 [inline] free_pcp_prepare+0xc29/0xd20 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page_list+0x118/0xad0 mm/page_alloc.c:3448 release_pages+0x18bb/0x1af0 mm/swap.c:972 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu+0x780/0x910 mm/mmu_gather.c:249 tlb_finish_mmu+0xcb/0x200 mm/mmu_gather.c:340 exit_mmap+0x404/0x7a0 mm/mmap.c:3203 __mmput+0x111/0x370 kernel/fork.c:1101 exit_mm+0x60a/0x770 kernel/exit.c:501 do_exit+0x6ae/0x2510 kernel/exit.c:812 do_group_exit+0x168/0x2d0 kernel/exit.c:922 __do_sys_exit_group+0x13/0x20 kernel/exit.c:933 __ia32_sys_exit_group+0x0/0x40 kernel/exit.c:931 __x64_sys_exit_group+0x37/0x40 kernel/exit.c:931 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888037b29200: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ffff888037b29280: 00 00 00 04 fc fc fc fc 00 00 00 fc fc fc fc fc >ffff888037b29300: fa fb fb fb fc fc fc fc 00 00 00 04 fc fc fc fc ^ ffff888037b29380: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff888037b29400: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc ==================================================================