================================================================== BUG: KASAN: use-after-free in psock_write_space+0x143/0x160 net/kcm/kcmsock.c:418 Read of size 8 at addr ffff8801cb4092e0 by task syz-executor3/27221 CPU: 0 PID: 27221 Comm: syz-executor3 Not tainted 4.15.0-rc8+ #199 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 psock_write_space+0x143/0x160 net/kcm/kcmsock.c:418 sock_wfree+0x10b/0x140 net/core/sock.c:1815 skb_orphan include/linux/skbuff.h:2526 [inline] loopback_xmit+0x12e/0x6a0 drivers/net/loopback.c:78 __netdev_start_xmit include/linux/netdevice.h:4053 [inline] netdev_start_xmit include/linux/netdevice.h:4062 [inline] xmit_one net/core/dev.c:3020 [inline] dev_hard_start_xmit+0x24e/0xac0 net/core/dev.c:3036 __dev_queue_xmit+0x22e9/0x2b50 net/core/dev.c:3532 dev_queue_xmit+0x17/0x20 net/core/dev.c:3565 neigh_hh_output include/net/neighbour.h:472 [inline] neigh_output include/net/neighbour.h:480 [inline] ip_finish_output2+0xf4d/0x1550 net/ipv4/ip_output.c:229 ip_finish_output+0x864/0xd10 net/ipv4/ip_output.c:317 NF_HOOK_COND include/linux/netfilter.h:277 [inline] ip_output+0x1d2/0x860 net/ipv4/ip_output.c:405 dst_output include/net/dst.h:443 [inline] ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124 ip_queue_xmit+0x8c0/0x18e0 net/ipv4/ip_output.c:504 dccp_transmit_skb+0x9ac/0x10f0 net/dccp/output.c:142 dccp_send_reset+0x21c/0x2a0 net/dccp/output.c:530 dccp_disconnect+0x90e/0xbb0 net/dccp/proto.c:279 inet_child_forget+0x6b/0x320 net/ipv4/inet_connection_sock.c:899 inet_csk_listen_stop+0x128/0x920 net/ipv4/inet_connection_sock.c:987 dccp_close+0x780/0xc20 net/dccp/proto.c:1012 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:427 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:432 sock_release+0x8d/0x1e0 net/socket.c:595 sock_close+0x16/0x20 net/socket.c:1123 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x9bb/0x1ad0 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:968 SYSC_exit_group kernel/exit.c:979 [inline] SyS_exit_group+0x1d/0x20 kernel/exit.c:977 entry_SYSCALL_64_fastpath+0x29/0xa0 RIP: 0033:0x452ee9 RSP: 002b:0000000000a2fa08 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000071bf80 RCX: 0000000000452ee9 RDX: 000000000047e551 RSI: 00000000007227e8 RDI: 0000000000000000 RBP: 00000000000000b8 R08: 0000000000000000 R09: 0000000000000008 R10: 0000000000000016 R11: 0000000000000202 R12: 0000000000a2f9a0 R13: 000000000071bf58 R14: 000000000000038d R15: 0000000000000018 Allocated by task 27227: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3544 kmem_cache_zalloc include/linux/slab.h:678 [inline] kcm_attach net/kcm/kcmsock.c:1394 [inline] kcm_attach_ioctl net/kcm/kcmsock.c:1460 [inline] kcm_ioctl+0x2d2/0x1690 net/kcm/kcmsock.c:1665 sock_do_ioctl+0x65/0xb0 net/socket.c:958 sock_ioctl+0x2c2/0x440 net/socket.c:1055 vfs_ioctl fs/ioctl.c:46 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692 entry_SYSCALL_64_fastpath+0x29/0xa0 Freed by task 27221: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3488 [inline] kmem_cache_free+0x83/0x2a0 mm/slab.c:3746 kcm_unattach+0xe53/0x1510 net/kcm/kcmsock.c:1563 release_mux net/kcm/kcmsock.c:1727 [inline] kcm_done+0x5c7/0x1990 net/kcm/kcmsock.c:1787 kcm_release+0x478/0x860 net/kcm/kcmsock.c:1861 sock_release+0x8d/0x1e0 net/socket.c:595 sock_close+0x16/0x20 net/socket.c:1123 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x9bb/0x1ad0 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:968 SYSC_exit_group kernel/exit.c:979 [inline] SyS_exit_group+0x1d/0x20 kernel/exit.c:977 entry_SYSCALL_64_fastpath+0x29/0xa0 The buggy address belongs to the object at ffff8801cb409180 which belongs to the cache kcm_psock_cache of size 544 The buggy address is located 352 bytes inside of 544-byte region [ffff8801cb409180, ffff8801cb4093a0) The buggy address belongs to the page: page:ffffea00072d0200 count:1 mapcount:0 mapping:ffff8801cb408100 index:0xffff8801cb408ec0 compound_mapcount: 0 flags: 0x2fffc0000008100(slab|head) raw: 02fffc0000008100 ffff8801cb408100 ffff8801cb408ec0 0000000100000008 raw: ffffea00074354a0 ffffea0007360820 ffff8801d32d6900 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801cb409180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801cb409200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801cb409280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801cb409300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801cb409380: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================