================================================================== BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5874 [inline] BUG: KASAN: use-after-free in perf_output_read+0xe43/0xfb0 kernel/events/core.c:5909 Read of size 8 at addr ffff8801d45b4ce0 by task syz-executor1/10170 CPU: 0 PID: 10170 Comm: syz-executor1 Not tainted 4.14.76+ #20 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xb9/0x11b lib/dump_stack.c:53 print_address_description+0x60/0x22b mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409 perf_output_read_group kernel/events/core.c:5874 [inline] perf_output_read+0xe43/0xfb0 kernel/events/core.c:5909 perf_output_sample+0x10dd/0x1780 kernel/events/core.c:5951 __perf_event_output kernel/events/core.c:6261 [inline] perf_event_output_forward+0x121/0x230 kernel/events/core.c:6274 __perf_event_overflow+0x116/0x320 kernel/events/core.c:7510 perf_swevent_overflow+0x166/0x1f0 kernel/events/core.c:7586 perf_swevent_event+0x19c/0x270 kernel/events/core.c:7619 do_perf_sw_event kernel/events/core.c:7727 [inline] ___perf_sw_event+0x296/0x480 kernel/events/core.c:7758 __perf_sw_event+0x3f/0x70 kernel/events/core.c:7770 perf_sw_event include/linux/perf_event.h:1041 [inline] __do_page_fault+0x77f/0xb60 arch/x86/mm/fault.c:1466 page_fault+0x22/0x50 arch/x86/entry/entry_64.S:1104 RIP: 0010:copy_user_enhanced_fast_string+0x7/0x10 arch/x86/lib/copy_user_64.S:180 RSP: 0018:ffff8801d1b07b48 EFLAGS: 00010206 RAX: 0000000000000000 RBX: 0000000000001000 RCX: 0000000000000500 RDX: 0000000000001000 RSI: ffff8801d4691b00 RDI: 00000000206e9000 RBP: 00000000206e8500 R08: 0000000000000000 R09: 0000000000000040 R10: ffffed003a8d23ff R11: ffff8801d4691fff R12: ffff8801d4691000 R13: 00007ffffffff000 R14: 00000000206e9500 R15: 0000000000001000 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_to_user arch/x86/include/asm/uaccess_64.h:112 [inline] copyout+0x99/0xc0 lib/iov_iter.c:137 copy_page_to_iter_iovec lib/iov_iter.c:206 [inline] copy_page_to_iter+0x31d/0xd40 lib/iov_iter.c:710 pipe_to_user+0xa6/0x160 fs/splice.c:1237 splice_from_pipe_feed fs/splice.c:502 [inline] __splice_from_pipe+0x324/0x740 fs/splice.c:626 vmsplice_to_user+0x1bd/0x1e0 fs/splice.c:1272 SYSC_vmsplice fs/splice.c:1353 [inline] SyS_vmsplice+0x12f/0x150 fs/splice.c:1334 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x457569 RSP: 002b:00007f1c1636fc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000116 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000457569 RDX: 0000000000000001 RSI: 0000000020000000 RDI: 0000000000000003 RBP: 000000000072bfa0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1c163706d4 R13: 00000000004c4f4d R14: 00000000004d8520 R15: 00000000ffffffff Allocated by task 10157: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551 slab_post_alloc_hook mm/slab.h:442 [inline] slab_alloc_node mm/slub.c:2723 [inline] slab_alloc mm/slub.c:2731 [inline] __kmalloc_track_caller+0x104/0x300 mm/slub.c:4288 __kmalloc_reserve.isra.8+0x2f/0xc0 net/core/skbuff.c:137 __alloc_skb+0x105/0x550 net/core/skbuff.c:205 alloc_skb include/linux/skbuff.h:980 [inline] sock_wmalloc+0xa5/0xf0 net/core/sock.c:1927 __ip6_append_data.isra.3+0x21f3/0x2940 net/ipv6/ip6_output.c:1424 ip6_append_data+0x1bd/0x2f0 net/ipv6/ip6_output.c:1580 rawv6_sendmsg+0xaa1/0x2990 net/ipv6/raw.c:928 inet_sendmsg+0x168/0x540 net/ipv4/af_inet.c:781 sock_sendmsg_nosec net/socket.c:645 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:655 ___sys_sendmsg+0x41d/0x890 net/socket.c:2061 __sys_sendmmsg+0x13d/0x360 net/socket.c:2151 SYSC_sendmmsg net/socket.c:2182 [inline] SyS_sendmmsg+0x2f/0x50 net/socket.c:2177 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 10157: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524 slab_free_hook mm/slub.c:1389 [inline] slab_free_freelist_hook mm/slub.c:1410 [inline] slab_free mm/slub.c:2966 [inline] kfree+0xf5/0x310 mm/slub.c:3897 skb_free_head+0x83/0xa0 net/core/skbuff.c:550 skb_release_data+0x495/0x610 net/core/skbuff.c:570 skb_release_all+0x46/0x60 net/core/skbuff.c:627 __kfree_skb net/core/skbuff.c:641 [inline] kfree_skb+0xc8/0x340 net/core/skbuff.c:659 ip6_tnl_start_xmit+0x763/0x1900 net/ipv6/ip6_tunnel.c:1408 __netdev_start_xmit include/linux/netdevice.h:4023 [inline] netdev_start_xmit include/linux/netdevice.h:4032 [inline] xmit_one net/core/dev.c:2987 [inline] dev_hard_start_xmit+0x191/0x890 net/core/dev.c:3003 __dev_queue_xmit+0x13d9/0x1f40 net/core/dev.c:3503 neigh_output include/net/neighbour.h:482 [inline] ip6_finish_output2+0xbd0/0x1e70 net/ipv6/ip6_output.c:120 ip6_finish_output+0x62e/0xb10 net/ipv6/ip6_output.c:154 NF_HOOK_COND include/linux/netfilter.h:239 [inline] ip6_output+0x1dd/0x680 net/ipv6/ip6_output.c:171 dst_output include/net/dst.h:459 [inline] ip6_local_out+0x94/0x170 net/ipv6/output_core.c:176 ip6_send_skb+0x98/0x2e0 net/ipv6/ip6_output.c:1686 ip6_push_pending_frames+0xac/0xd0 net/ipv6/ip6_output.c:1706 rawv6_push_pending_frames net/ipv6/raw.c:616 [inline] rawv6_sendmsg+0x20a8/0x2990 net/ipv6/raw.c:935 inet_sendmsg+0x168/0x540 net/ipv4/af_inet.c:781 sock_sendmsg_nosec net/socket.c:645 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:655 ___sys_sendmsg+0x41d/0x890 net/socket.c:2061 __sys_sendmmsg+0x13d/0x360 net/socket.c:2151 SYSC_sendmmsg net/socket.c:2182 [inline] SyS_sendmmsg+0x2f/0x50 net/socket.c:2177 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff8801d45b4c80 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 96 bytes inside of 512-byte region [ffff8801d45b4c80, ffff8801d45b4e80) The buggy address belongs to the page: page:ffffea0007516d00 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000008100(slab|head) raw: 4000000000008100 0000000000000000 0000000000000000 00000001000c000c raw: dead000000000100 dead000000000200 ffff8801da802c00 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801d45b4b80: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801d45b4c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801d45b4c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801d45b4d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d45b4d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================