================================================================== BUG: KASAN: use-after-free in psock_write_space+0x143/0x160 net/kcm/kcmsock.c:418 Read of size 8 at addr ffff8801bbb11d20 by task syzkaller645698/3665 CPU: 0 PID: 3665 Comm: syzkaller645698 Not tainted 4.15.0-rc8-next-20180116+ #98 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:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x23b/0x360 mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 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] ip6_finish_output2+0x1492/0x23a0 net/ipv6/ip6_output.c:120 ip6_finish_output+0x698/0xaf0 net/ipv6/ip6_output.c:154 NF_HOOK_COND include/linux/netfilter.h:277 [inline] ip6_output+0x1eb/0x840 net/ipv6/ip6_output.c:171 dst_output include/net/dst.h:443 [inline] NF_HOOK include/linux/netfilter.h:288 [inline] ip6_xmit+0xd84/0x2090 net/ipv6/ip6_output.c:277 inet6_csk_xmit+0x2fc/0x580 net/ipv6/inet6_connection_sock.c:139 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:209 ____fput+0x15/0x20 fs/file_table.c:243 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:869 do_group_exit+0x149/0x400 kernel/exit.c:972 get_signal+0x73a/0x16d0 kernel/signal.c:2343 do_signal+0x90/0x1eb0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:161 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264 entry_SYSCALL_64_fastpath+0x9e/0xa0 RIP: 0033:0x445819 RSP: 002b:00007fba5e086da8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00000000006dac3c RCX: 0000000000445819 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000006dac3c RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dac38 R13: 0100000000000000 R14: 656c6c616b7a7973 R15: 000000000000000b Allocated by task 3664: 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:552 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3541 kmem_cache_zalloc include/linux/slab.h:691 [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 3665: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527 __cache_free mm/slab.c:3485 [inline] kmem_cache_free+0x86/0x2b0 mm/slab.c:3743 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:209 ____fput+0x15/0x20 fs/file_table.c:243 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:869 do_group_exit+0x149/0x400 kernel/exit.c:972 get_signal+0x73a/0x16d0 kernel/signal.c:2343 do_signal+0x90/0x1eb0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:161 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264 entry_SYSCALL_64_fastpath+0x9e/0xa0 The buggy address belongs to the object at ffff8801bbb11bc0 which belongs to the cache kcm_psock_cache of size 544 The buggy address is located 352 bytes inside of 544-byte region [ffff8801bbb11bc0, ffff8801bbb11de0) The buggy address belongs to the page: page:ffffea0006eec400 count:1 mapcount:0 mapping:ffff8801bbb10040 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000008100(slab|head) raw: 02fffc0000008100 ffff8801bbb10040 0000000000000000 000000010000000b raw: ffff8801d3356948 ffff8801d3356948 ffff8801d3366c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801bbb11c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801bbb11c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801bbb11d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801bbb11d80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff8801bbb11e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================