================================================================== BUG: KASAN: use-after-free in packet_rcv_fanout+0x78a/0x7d0 net/packet/af_packet.c:1490 Read of size 8 at addr ffff88006a3e8d90 by task sshd/2977 CPU: 2 PID: 2977 Comm: sshd Not tainted 4.13.0-next-20170913+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:52 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x24e/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 packet_rcv_fanout+0x78a/0x7d0 net/packet/af_packet.c:1490 deliver_skb net/core/dev.c:1859 [inline] dev_queue_xmit_nit+0x2d4/0xae0 net/core/dev.c:1915 xmit_one net/core/dev.c:2971 [inline] dev_hard_start_xmit+0x16b/0xac0 net/core/dev.c:2991 sch_direct_xmit+0x31d/0x6d0 net/sched/sch_generic.c:186 __dev_xmit_skb net/core/dev.c:3173 [inline] __dev_queue_xmit+0x15fe/0x1e40 net/core/dev.c:3440 dev_queue_xmit+0x17/0x20 net/core/dev.c:3505 neigh_hh_output include/net/neighbour.h:471 [inline] neigh_output include/net/neighbour.h:479 [inline] ip_finish_output2+0xece/0x1460 net/ipv4/ip_output.c:229 ip_finish_output+0x85e/0xd10 net/ipv4/ip_output.c:317 NF_HOOK_COND include/linux/netfilter.h:238 [inline] ip_output+0x1cc/0x860 net/ipv4/ip_output.c:405 dst_output include/net/dst.h:472 [inline] ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124 ip_queue_xmit+0x8c6/0x18e0 net/ipv4/ip_output.c:504 tcp_transmit_skb+0x1947/0x3300 net/ipv4/tcp_output.c:1123 tcp_write_xmit+0x5fc/0x4960 net/ipv4/tcp_output.c:2341 __tcp_push_pending_frames+0xa0/0x250 net/ipv4/tcp_output.c:2516 tcp_push+0x4e0/0x760 net/ipv4/tcp.c:715 tcp_sendmsg_locked+0x17ad/0x3bc0 net/ipv4/tcp.c:1408 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1445 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:633 [inline] sock_sendmsg+0xca/0x110 net/socket.c:643 sock_write_iter+0x320/0x5e0 net/socket.c:912 call_write_iter include/linux/fs.h:1770 [inline] new_sync_write fs/read_write.c:468 [inline] __vfs_write+0x68a/0x970 fs/read_write.c:481 vfs_write+0x18f/0x510 fs/read_write.c:543 SYSC_write fs/read_write.c:588 [inline] SyS_write+0xef/0x220 fs/read_write.c:580 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x7f8192647370 RSP: 002b:00007fff54f62668 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000058 RCX: 00007f8192647370 RDX: 0000000000000058 RSI: 00005596046ce260 RDI: 0000000000000003 RBP: 0000000000000082 R08: 0000000000000001 R09: 0101010101010101 R10: 0000000000000008 R11: 0000000000000246 R12: 00005596046db810 R13: 0000000000000001 R14: 00005596046db810 R15: 0000000000000050 Allocated by task 5382: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 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 __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x162/0x760 mm/slab.c:3734 kmalloc include/linux/slab.h:498 [inline] sk_prot_alloc+0x101/0x2a0 net/core/sock.c:1469 sk_alloc+0x89/0x700 net/core/sock.c:1525 packet_create+0x169/0xb00 net/packet/af_packet.c:3211 __sock_create+0x4d4/0x850 net/socket.c:1262 sock_create net/socket.c:1302 [inline] SYSC_socket net/socket.c:1332 [inline] SyS_socket+0xeb/0x200 net/socket.c:1312 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 5382: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 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:3503 [inline] kfree+0xca/0x250 mm/slab.c:3820 sk_prot_free net/core/sock.c:1508 [inline] __sk_destruct+0x74a/0x910 net/core/sock.c:1587 sk_destruct+0x47/0x80 net/core/sock.c:1595 __sk_free+0x57/0x230 net/core/sock.c:1603 sk_free+0x2a/0x40 net/core/sock.c:1614 sock_put include/net/sock.h:1649 [inline] packet_release+0x859/0xd70 net/packet/af_packet.c:3047 sock_release+0x8d/0x1e0 net/socket.c:597 sock_close+0x16/0x20 net/socket.c:1126 __fput+0x333/0x7f0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:112 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0xa52/0x1b40 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:968 get_signal+0x7e8/0x17e0 kernel/signal.c:2334 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:808 exit_to_usermode_loop+0x224/0x300 arch/x86/entry/common.c:158 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath+0x42f/0x500 arch/x86/entry/common.c:266 entry_SYSCALL_64_fastpath+0xbc/0xbe The buggy address belongs to the object at ffff88006a3e85c0 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 2000 bytes inside of 2048-byte region [ffff88006a3e85c0, ffff88006a3e8dc0) The buggy address belongs to the page: page:ffffea0001a8fa00 count:1 mapcount:0 mapping:ffff88006a3e85c0 index:0x0 compound_mapcount: 0 flags: 0x500000000008100(slab|head) raw: 0500000000008100 ffff88006a3e85c0 0000000000000000 0000000100000003 raw: ffffea0001b3f9a0 ffffea0001b251a0 ffff88003e800c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88006a3e8c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88006a3e8d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88006a3e8d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88006a3e8e00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff88006a3e8e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================