================================================================== BUG: KASAN: use-after-free in tipc_recvmsg+0xf77/0xf90 net/tipc/socket.c:1979 Read of size 4 at addr ffff8880840d1940 by task syz-executor.4/17278 CPU: 0 PID: 17278 Comm: syz-executor.4 Not tainted 5.14.0-rc2-next-20210723-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+0xcd/0x134 lib/dump_stack.c:105 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 tipc_recvmsg+0xf77/0xf90 net/tipc/socket.c:1979 sock_recvmsg_nosec net/socket.c:943 [inline] sock_recvmsg net/socket.c:961 [inline] sock_recvmsg net/socket.c:957 [inline] ____sys_recvmsg+0x2c4/0x600 net/socket.c:2611 ___sys_recvmsg+0x127/0x200 net/socket.c:2653 __sys_recvmsg+0xe2/0x1a0 net/socket.c:2683 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: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:00007f3986f25188 EFLAGS: 00000246 ORIG_RAX: 000000000000002f RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 0000000000000000 RSI: 00000000200015c0 RDI: 0000000000000003 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffebf49272f R14: 00007f3986f25300 R15: 0000000000022000 Allocated by task 17282: 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:434 [inline] __kasan_slab_alloc+0x84/0xa0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:2958 [inline] kmem_cache_alloc_node+0x266/0x3e0 mm/slub.c:2994 __alloc_skb+0x20b/0x340 net/core/skbuff.c:414 alloc_skb_fclone include/linux/skbuff.h:1162 [inline] tipc_buf_acquire+0x25/0xe0 net/tipc/msg.c:72 tipc_msg_reverse+0x1ee/0x970 net/tipc/msg.c:647 tipc_sk_respond+0x1f0/0x560 net/tipc/socket.c:291 __tipc_shutdown+0x9c5/0xe90 net/tipc/socket.c:588 tipc_release+0x13f/0x1a80 net/tipc/socket.c:640 __sock_release+0xcd/0x280 net/socket.c:648 sock_close+0x18/0x20 net/socket.c:1300 __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:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 17278: 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:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1627 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1652 slab_free mm/slub.c:3212 [inline] kmem_cache_free+0x8e/0x5a0 mm/slub.c:3228 kfree_skbmem+0x166/0x1b0 net/core/skbuff.c:720 __kfree_skb net/core/skbuff.c:756 [inline] kfree_skb net/core/skbuff.c:773 [inline] kfree_skb+0x140/0x3f0 net/core/skbuff.c:767 tipc_recvmsg+0x70d/0xf90 net/tipc/socket.c:1977 sock_recvmsg_nosec net/socket.c:943 [inline] sock_recvmsg net/socket.c:961 [inline] sock_recvmsg net/socket.c:957 [inline] ____sys_recvmsg+0x2c4/0x600 net/socket.c:2611 ___sys_recvmsg+0x127/0x200 net/socket.c:2653 __sys_recvmsg+0xe2/0x1a0 net/socket.c:2683 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 ffff8880840d1900 which belongs to the cache skbuff_fclone_cache of size 472 The buggy address is located 64 bytes inside of 472-byte region [ffff8880840d1900, ffff8880840d1ad8) The buggy address belongs to the page: page:ffffea0002103400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x840d0 head:ffffea0002103400 order:1 compound_mapcount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea000084b500 0000000a0000000a ffff888011ea2b40 raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 15147, ts 1705417207182, free_ts 1685729067373 prep_new_page mm/page_alloc.c:2424 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4152 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5374 alloc_pages+0x1a3/0x2d0 mm/mempolicy.c:2278 alloc_slab_page mm/slub.c:1690 [inline] allocate_slab+0x32e/0x4b0 mm/slub.c:1830 new_slab mm/slub.c:1893 [inline] new_slab_objects mm/slub.c:2639 [inline] ___slab_alloc+0x4ba/0x820 mm/slub.c:2802 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2842 slab_alloc_node mm/slub.c:2924 [inline] kmem_cache_alloc_node+0x12c/0x3e0 mm/slub.c:2994 __alloc_skb+0x20b/0x340 net/core/skbuff.c:414 alloc_skb_fclone include/linux/skbuff.h:1162 [inline] sk_stream_alloc_skb+0x109/0xc30 net/ipv4/tcp.c:887 tcp_sendmsg_locked+0xc78/0x2f10 net/ipv4/tcp.c:1309 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1461 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:821 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:723 __sys_sendto+0x21c/0x320 net/socket.c:2019 __do_sys_sendto net/socket.c:2031 [inline] __se_sys_sendto net/socket.c:2027 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2027 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x373/0x860 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3315 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3394 kasan_depopulate_vmalloc_pte+0x5c/0x70 mm/kasan/shadow.c:375 apply_to_pte_range mm/memory.c:2532 [inline] apply_to_pmd_range mm/memory.c:2576 [inline] apply_to_pud_range mm/memory.c:2612 [inline] apply_to_p4d_range mm/memory.c:2648 [inline] __apply_to_page_range+0x694/0x1080 mm/memory.c:2682 kasan_release_vmalloc+0xa7/0xc0 mm/kasan/shadow.c:485 __purge_vmap_area_lazy+0x8f9/0x1c50 mm/vmalloc.c:1692 try_purge_vmap_area_lazy mm/vmalloc.c:1711 [inline] free_vmap_area_noflush+0xa5b/0xd10 mm/vmalloc.c:1753 free_unmap_vmap_area mm/vmalloc.c:1766 [inline] remove_vm_area+0x1cc/0x230 mm/vmalloc.c:2505 vm_remove_mappings mm/vmalloc.c:2534 [inline] __vunmap+0x392/0xb70 mm/vmalloc.c:2599 __vfree+0x3c/0xd0 mm/vmalloc.c:2657 vfree+0x5a/0x90 mm/vmalloc.c:2688 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:883 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1040 [inline] do_ip6t_get_ctl+0x835/0xa10 net/ipv6/netfilter/ip6_tables.c:1671 nf_getsockopt+0x72/0xd0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x1be/0x270 net/ipv6/ipv6_sockglue.c:1486 tcp_getsockopt+0x86/0xd0 net/ipv4/tcp.c:4253 __sys_getsockopt+0x21f/0x5f0 net/socket.c:2203 Memory state around the buggy address: ffff8880840d1800: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc ffff8880840d1880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880840d1900: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880840d1980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880840d1a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================