Hello,
syzbot found the following crash on:
HEAD commit: b850307b Linux 4.14.184
git tree: linux-4.14.y
console output:
https://syzkaller.appspot.com/x/log.txt?x=101c346b100000
kernel config:
https://syzkaller.appspot.com/x/.config?x=ddc0f08dd6b981c5
dashboard link:
https://syzkaller.appspot.com/bug?extid=f14eca13b5fe06cdff75
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
Unfortunately, I don't have any reproducer for this crash yet.
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by:
syzbot+f14eca...@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5888 [inline]
BUG: KASAN: use-after-free in perf_output_read+0xe24/0xf80 kernel/events/core.c:5923
Read of size 8 at addr ffff8880a51a0b48 by task syz-executor.2/9289
CPU: 1 PID: 9289 Comm: syz-executor.2 Not tainted 4.14.184-syzkaller #0
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+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2b9 mm/kasan/report.c:393
perf_output_read_group kernel/events/core.c:5888 [inline]
perf_output_read+0xe24/0xf80 kernel/events/core.c:5923
perf_output_sample+0x1196/0x1720 kernel/events/core.c:5965
__perf_event_output kernel/events/core.c:6278 [inline]
perf_event_output_forward+0xf8/0x1f0 kernel/events/core.c:6291
__perf_event_overflow+0x113/0x310 kernel/events/core.c:7536
perf_swevent_overflow+0x17b/0x210 kernel/events/core.c:7612
perf_swevent_event+0x19c/0x270 kernel/events/core.c:7645
do_perf_sw_event kernel/events/core.c:7753 [inline]
___perf_sw_event+0x295/0x480 kernel/events/core.c:7784
__perf_sw_event+0x42/0x80 kernel/events/core.c:7796
perf_sw_event include/linux/perf_event.h:1046 [inline]
__do_page_fault+0x6c1/0xb50 arch/x86/mm/fault.c:1483
page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1123
RIP: 0010:copy_user_enhanced_fast_string+0xe/0x20 arch/x86/lib/copy_user_64.S:181
RSP: 0018:ffff88805944fa88 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 0000000000008000 RCX: 0000000000001acb
RDX: 0000000000008000 RSI: 0000000020fec000 RDI: ffff88805e6be535
RBP: 0000000020fe5acb R08: ffffed100bcd8000 R09: 0000000000000000
R10: ffffed100bcd7fff R11: ffff88805e6bffff R12: ffff88805e6b8000
R13: 00007ffffffff000 R14: 0000000020fedacb R15: ffff88805e6b8000
copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
raw_copy_from_user arch/x86/include/asm/uaccess_64.h:55 [inline]
copyin+0x99/0xc0 lib/iov_iter.c:146
_copy_from_iter_full+0x195/0x680 lib/iov_iter.c:608
copy_from_iter_full include/linux/uio.h:126 [inline]
skb_do_copy_data_nocache include/net/sock.h:1886 [inline]
skb_copy_to_page_nocache include/net/sock.h:1912 [inline]
tcp_sendmsg_locked+0x249d/0x2ef0 net/ipv4/tcp.c:1360
tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
inet_sendmsg+0x116/0x4d0 net/ipv4/af_inet.c:762
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1c7/0x2c0 net/socket.c:1731
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45cb29
RSP: 002b:00007f54c4794c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000502960 RCX: 000000000045cb29
RDX: ffffffffffffffef RSI: 0000000020d7cfcb RDI: 0000000000000008
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0f0000000000e814
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000a4c R14: 00000000004cd338 R15: 00007f54c47956d4
Allocated by task 8431:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node_track_caller+0x4c/0x70 mm/slab.c:3696
__kmalloc_reserve.isra.0+0x35/0xd0 net/core/skbuff.c:137
pskb_expand_head+0x115/0xc90 net/core/skbuff.c:1462
skb_ensure_writable+0x249/0x2e0 net/core/skbuff.c:5091
__bpf_try_make_writable net/core/filter.c:1403 [inline]
bpf_try_make_writable net/core/filter.c:1409 [inline]
bpf_try_make_head_writable net/core/filter.c:1417 [inline]
____bpf_clone_redirect net/core/filter.c:1781 [inline]
bpf_clone_redirect+0x120/0x2c0 net/core/filter.c:1759
0xffffffffa00882d2
Freed by task 8431:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
skb_free_head+0x83/0xa0 net/core/skbuff.c:554
pskb_expand_head+0x5cb/0xc90 net/core/skbuff.c:1495
__skb_cow include/linux/skbuff.h:2936 [inline]
skb_cow_head include/linux/skbuff.h:2970 [inline]
ipgre_xmit+0x405/0x6f0 net/ipv4/ip_gre.c:649
__netdev_start_xmit include/linux/netdevice.h:4039 [inline]
netdev_start_xmit include/linux/netdevice.h:4048 [inline]
xmit_one net/core/dev.c:3009 [inline]
dev_hard_start_xmit+0x186/0x880 net/core/dev.c:3025
__dev_queue_xmit+0x1dce/0x25a0 net/core/dev.c:3525
__bpf_tx_skb net/core/filter.c:1708 [inline]
__bpf_redirect_common net/core/filter.c:1747 [inline]
__bpf_redirect+0x612/0xa30 net/core/filter.c:1754
____bpf_clone_redirect net/core/filter.c:1787 [inline]
bpf_clone_redirect+0x1e0/0x2c0 net/core/filter.c:1759
0xffffffffa00882d2
The buggy address belongs to the object at ffff8880a51a0a40
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 264 bytes inside of
512-byte region [ffff8880a51a0a40, ffff8880a51a0c40)
The buggy address belongs to the page:
page:ffffea0002946800 count:1 mapcount:0 mapping:ffff8880a51a0040 index:0xffff8880a51a0a40
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a51a0040 ffff8880a51a0a40 0000000100000005
raw: ffffea00028291e0 ffffea00029cc020 ffff8880aa800940 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880a51a0a00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8880a51a0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a51a0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a51a0b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a51a0c00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
---
This bug is generated by a bot. It may contain errors.
See
https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at
syzk...@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.