================================================================== BUG: KASAN: use-after-free in ip_check_mc_rcu+0x384/0x3c0 net/ipv4/igmp.c:2731 Read of size 8 at addr ffff8881de903d48 by task syz-executor.1/9253 CPU: 1 PID: 9253 Comm: syz-executor.1 Not tainted 5.4.125-syzkaller-00011-gd52ac987ad2a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1d8/0x24e lib/dump_stack.c:118 print_address_description+0x9b/0x650 mm/kasan/report.c:384 __kasan_report+0x182/0x260 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 ip_check_mc_rcu+0x384/0x3c0 net/ipv4/igmp.c:2731 __mkroute_output+0x372/0x1430 net/ipv4/route.c:2364 ip_route_output_key_hash net/ipv4/route.c:2472 [inline] __ip_route_output_key include/net/route.h:126 [inline] ip_route_output_flow+0x13d/0x320 net/ipv4/route.c:2733 udp_sendmsg+0x17f6/0x2f80 net/ipv4/udp.c:1147 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x583/0x8c0 net/socket.c:2298 ___sys_sendmsg net/socket.c:2352 [inline] __sys_sendmmsg+0x3b3/0x730 net/socket.c:2455 __do_sys_sendmmsg net/socket.c:2484 [inline] __se_sys_sendmmsg net/socket.c:2481 [inline] __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2481 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7ff0baabc709 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:00007ff0b8813188 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 00007ff0babc1020 RCX: 00007ff0baabc709 RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000003 RBP: 00007ff0bab16cb4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe0f15a1ff R14: 00007ff0b8813300 R15: 0000000000022000 Allocated by task 9226: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:529 kmem_cache_alloc_trace+0x139/0x2b0 mm/slub.c:2848 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:690 [inline] ip_mc_add1_src net/ipv4/igmp.c:1973 [inline] ip_mc_add_src+0x4dd/0xa90 net/ipv4/igmp.c:2097 ip_mc_msfilter+0x6cc/0xc80 net/ipv4/igmp.c:2481 do_ip_setsockopt+0x2dc2/0x3ac0 net/ipv4/ip_sockglue.c:959 ip_setsockopt+0x4c/0xc0 net/ipv4/ip_sockglue.c:1248 __sys_setsockopt+0x56a/0x870 net/socket.c:2085 __do_sys_setsockopt net/socket.c:2101 [inline] __se_sys_setsockopt net/socket.c:2098 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2098 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 9220: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x18a/0x240 mm/kasan/common.c:487 slab_free_hook mm/slub.c:1454 [inline] slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492 slab_free mm/slub.c:3072 [inline] kfree+0xe0/0x660 mm/slub.c:4061 ip_mc_del1_src+0x6dd/0x7f0 net/ipv4/igmp.c:1886 ip_mc_del_src+0x398/0x7b0 net/ipv4/igmp.c:1927 ip_mc_leave_src net/ipv4/igmp.c:2233 [inline] ip_mc_drop_socket+0x199/0x3a0 net/ipv4/igmp.c:2687 inet_release+0x48/0x180 net/ipv4/af_inet.c:414 __sock_release net/socket.c:591 [inline] sock_close+0xd2/0x250 net/socket.c:1269 __fput+0x27d/0x6c0 fs/file_table.c:281 task_work_run+0x186/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:163 [inline] prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881de903d40 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 8 bytes inside of 32-byte region [ffff8881de903d40, ffff8881de903d60) The buggy address belongs to the page: page:ffffea00077a40c0 refcount:1 mapcount:0 mapping:ffff8881f5c03400 index:0x0 flags: 0x8000000000000200(slab) raw: 8000000000000200 0000000000000000 0000003900000001 ffff8881f5c03400 raw: 0000000000000000 0000000080400040 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 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x19a/0x380 mm/page_alloc.c:2171 get_page_from_freelist+0x550/0x8b0 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x3a2/0x880 mm/page_alloc.c:4855 alloc_slab_page+0x39/0x3e0 mm/slub.c:342 allocate_slab mm/slub.c:1675 [inline] new_slab+0x97/0x460 mm/slub.c:1741 new_slab_objects mm/slub.c:2498 [inline] ___slab_alloc+0x330/0x4c0 mm/slub.c:2659 __slab_alloc mm/slub.c:2699 [inline] slab_alloc_node mm/slub.c:2784 [inline] slab_alloc mm/slub.c:2829 [inline] __kmalloc+0x1ee/0x2f0 mm/slub.c:3899 kmalloc include/linux/slab.h:561 [inline] context_struct_to_string+0x43b/0x8b0 security/selinux/ss/services.c:1238 context_add_hash+0x13f/0x270 security/selinux/ss/services.c:1479 context_struct_to_sid security/selinux/ss/services.c:1497 [inline] security_context_to_sid_core+0x3fc/0x710 security/selinux/ss/services.c:1557 security_context_to_sid+0x35/0x50 security/selinux/ss/services.c:1583 selinux_setprocattr+0x55f/0x10d0 security/selinux/hooks.c:6467 proc_pid_attr_write+0x2c5/0x310 fs/proc/base.c:2600 __vfs_write+0x103/0x780 fs/read_write.c:494 vfs_write+0x212/0x4e0 fs/read_write.c:558 ksys_write+0x186/0x2b0 fs/read_write.c:611 page_owner free stack trace missing Memory state around the buggy address: ffff8881de903c00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff8881de903c80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc >ffff8881de903d00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ^ ffff8881de903d80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff8881de903e00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================