syzbot


KASAN: use-after-free Read in perf_output_read (2)

Status: auto-closed as invalid on 2021/09/12 12:28
Reported-by: syzbot+59185e10718a4132bf32@syzkaller.appspotmail.com
First crash: 1286d, last: 1286d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in perf_output_read (3) C 24 633d 1066d 0/1 upstream: reported C repro on 2021/12/21 12:25
linux-4.14 KASAN: use-after-free Read in perf_output_read 2 1567d 1603d 0/1 auto-closed as invalid on 2020/12/05 08:38
android-414 KASAN: use-after-free Read in perf_output_read C 94 1821d 2051d 0/1 public: reported C repro on 2019/04/11 00:00
linux-4.14 KASAN: slab-out-of-bounds Read in perf_output_read C error 13 633d 1664d 0/1 upstream: reported C repro on 2020/05/02 11:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in primary_event_id kernel/events/core.c:1316 [inline]
BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5895 [inline]
BUG: KASAN: use-after-free in perf_output_read+0x1046/0x1090 kernel/events/core.c:5930
Read of size 8 at addr ffff8880abfceda0 by task syz-executor.0/18931

CPU: 1 PID: 18931 Comm: syz-executor.0 Not tainted 4.14.232-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/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 primary_event_id kernel/events/core.c:1316 [inline]
 perf_output_read_group kernel/events/core.c:5895 [inline]
 perf_output_read+0x1046/0x1090 kernel/events/core.c:5930
 perf_output_sample+0xa28/0x16f0 kernel/events/core.c:5972
 __perf_event_output kernel/events/core.c:6285 [inline]
 perf_event_output_forward+0xf8/0x1f0 kernel/events/core.c:6298
 __perf_event_overflow+0x113/0x310 kernel/events/core.c:7547
 perf_swevent_overflow kernel/events/core.c:7623 [inline]
 perf_swevent_event+0x299/0x460 kernel/events/core.c:7651
 do_perf_sw_event kernel/events/core.c:7764 [inline]
 ___perf_sw_event+0x2a1/0x480 kernel/events/core.c:7795
 __perf_sw_event+0x4f/0x100 kernel/events/core.c:7807
 perf_sw_event include/linux/perf_event.h:1046 [inline]
 __do_page_fault+0x692/0xad0 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:ffff8880487a7a78 EFLAGS: 00010206
RAX: ffffed10091d8000 RBX: 0000000000008000 RCX: 0000000000000acb
RDX: 0000000000008000 RSI: 0000000020fad000 RDI: ffff888048ebf535
RBP: 0000000020fa5acb R08: 0000000000000001 R09: ffffed10091d7fff
R10: ffff888048ebffff R11: 0000000000000000 R12: ffff888048eb8000
R13: 00007ffffffff000 R14: 0000000020fadacb R15: ffff888048eb8000
 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+0x197/0x690 lib/iov_iter.c:608
 copy_from_iter_full include/linux/uio.h:126 [inline]
 skb_do_copy_data_nocache include/net/sock.h:1889 [inline]
 skb_copy_to_page_nocache include/net/sock.h:1915 [inline]
 tcp_sendmsg_locked+0x23fc/0x2ef0 net/ipv4/tcp.c:1360
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
 inet_sendmsg+0x11a/0x4e0 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:0x4665d9
RSP: 002b:00007f7d61567188 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 00000000004665d9
RDX: ffffffffffffffef RSI: 0000000020d7cfcb RDI: 0000000000000007
RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000053
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
R13: 00007ffd35e5e97f R14: 00007f7d61567300 R15: 0000000000022000

Allocated by task 12147:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 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 net/core/skbuff.c:137 [inline]
 __alloc_skb+0x96/0x510 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:980 [inline]
 alloc_skb_with_frags+0x85/0x500 net/core/skbuff.c:5255
 sock_alloc_send_pskb+0x577/0x6d0 net/core/sock.c:2083
 bt_skb_send_alloc include/net/bluetooth/bluetooth.h:347 [inline]
 l2cap_sock_alloc_skb_cb+0xa6/0x3c0 net/bluetooth/l2cap_sock.c:1398
 l2cap_create_basic_pdu net/bluetooth/l2cap_core.c:2236 [inline]
 l2cap_chan_send+0x25b/0x37f0 net/bluetooth/l2cap_core.c:2532
 l2cap_sock_sendmsg+0x1cd/0x280 net/bluetooth/l2cap_sock.c:975
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x326/0x800 net/socket.c:2062
 __sys_sendmmsg+0x129/0x330 net/socket.c:2152
 SYSC_sendmmsg net/socket.c:2183 [inline]
 SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 14381:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 skb_free_head net/core/skbuff.c:563 [inline]
 skb_release_data+0x5f6/0x820 net/core/skbuff.c:583
 skb_release_all net/core/skbuff.c:640 [inline]
 __kfree_skb net/core/skbuff.c:654 [inline]
 kfree_skb+0xe7/0x390 net/core/skbuff.c:672
 skb_queue_purge+0x14/0x30 net/core/skbuff.c:2870
 hci_chan_del+0x12f/0x1e0 net/bluetooth/hci_conn.c:1578
 l2cap_conn_del+0x426/0x690 net/bluetooth/l2cap_core.c:1739
 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7441 [inline]
 l2cap_disconn_cfm+0x7c/0xb0 net/bluetooth/l2cap_core.c:7434
 hci_disconn_cfm include/net/bluetooth/hci_core.h:1226 [inline]
 hci_conn_hash_flush+0x127/0x260 net/bluetooth/hci_conn.c:1393
 hci_dev_do_close+0x535/0xca0 net/bluetooth/hci_core.c:1622
 hci_unregister_dev+0x17f/0x8c0 net/bluetooth/hci_core.c:3193
 vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xa44/0x2850 kernel/exit.c:868
 do_group_exit+0x100/0x2e0 kernel/exit.c:965
 get_signal+0x38d/0x1ca0 kernel/signal.c:2423
 do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792
 exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880abfced40
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 96 bytes inside of
 512-byte region [ffff8880abfced40, ffff8880abfcef40)
The buggy address belongs to the page:
page:ffffea0002aff380 count:1 mapcount:0 mapping:ffff8880abfce0c0 index:0xffff8880abfced40
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880abfce0c0 ffff8880abfced40 0000000100000004
raw: ffffea00023ca0a0 ffffea0002ad52a0 ffff88813fe80940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880abfcec80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880abfced00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8880abfced80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8880abfcee00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880abfcee80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/05/15 12:27 linux-4.14.y 7d7d1c0ab3eb 93f844de .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in perf_output_read
* Struck through repros no longer work on HEAD.