syzbot


KASAN: slab-out-of-bounds Read in perf_output_read

Status: upstream: reported C repro on 2020/05/02 11:43
Reported-by: syzbot+832a6b168f9d0bc99676@syzkaller.appspotmail.com
First crash: 1506d, last: 475d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: slab-out-of-bounds Read in perf_output_read C 16 1665d 1892d 0/1 public: reported C repro on 2019/04/13 00:01
linux-4.14 KASAN: use-after-free Read in perf_output_read (3) C 24 475d 908d 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) 1 1128d 1128d 0/1 auto-closed as invalid on 2021/09/12 12:28
Fix bisection attempts (23)
Created Duration User Patch Repo Result
2022/10/13 02:14 0m bisect fix linux-4.14.y error job log (0)
2022/09/01 20:04 23m bisect fix linux-4.14.y job log (0) log
2022/08/02 19:33 30m bisect fix linux-4.14.y job log (0) log
2022/07/03 11:54 22m bisect fix linux-4.14.y job log (0) log
2022/05/21 02:34 24m bisect fix linux-4.14.y job log (0) log
2022/04/21 02:12 21m bisect fix linux-4.14.y job log (0) log
2022/03/22 01:41 30m bisect fix linux-4.14.y job log (0) log
2022/02/20 01:09 31m bisect fix linux-4.14.y job log (0) log
2022/01/21 00:37 25m bisect fix linux-4.14.y job log (0) log
2021/11/22 01:05 30m bisect fix linux-4.14.y job log (0) log
2021/10/23 00:33 31m bisect fix linux-4.14.y job log (0) log
2021/09/22 01:09 32m bisect fix linux-4.14.y job log (0) log
2021/08/22 21:28 30m bisect fix linux-4.14.y job log (0) log
2021/07/23 20:53 34m bisect fix linux-4.14.y job log (0) log
2021/06/23 20:22 30m bisect fix linux-4.14.y job log (0) log
2021/05/24 19:46 35m bisect fix linux-4.14.y job log (0) log
2021/04/24 18:14 39m bisect fix linux-4.14.y job log (0) log
2021/03/25 09:40 38m bisect fix linux-4.14.y job log (0) log
2021/02/23 07:41 37m bisect fix linux-4.14.y job log (0) log
2021/02/19 04:15 19m bisect fix linux-4.14.y error job log (0)
2020/11/20 07:27 38m bisect fix linux-4.14.y job log (0) log
2020/10/21 04:39 41m bisect fix linux-4.14.y job log (0) log
2020/09/21 03:55 38m bisect fix linux-4.14.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in primary_event_id kernel/events/core.c:1316 [inline]
BUG: KASAN: slab-out-of-bounds in perf_output_read_group kernel/events/core.c:5897 [inline]
BUG: KASAN: slab-out-of-bounds in perf_output_read+0x1046/0x1090 kernel/events/core.c:5932
Read of size 8 at addr ffff8880990bd020 by task syz-executor079/10568

CPU: 1 PID: 10568 Comm: syz-executor079 Not tainted 4.14.258-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:5897 [inline]
 perf_output_read+0x1046/0x1090 kernel/events/core.c:5932
 perf_output_sample+0xa28/0x16f0 kernel/events/core.c:5974
 __perf_event_output kernel/events/core.c:6287 [inline]
 perf_event_output_forward+0xf8/0x1f0 kernel/events/core.c:6300
 __perf_event_overflow+0x113/0x310 kernel/events/core.c:7549
 perf_swevent_overflow kernel/events/core.c:7625 [inline]
 perf_swevent_event+0x299/0x460 kernel/events/core.c:7653
 do_perf_sw_event kernel/events/core.c:7766 [inline]
 ___perf_sw_event+0x2a1/0x480 kernel/events/core.c:7797
 __perf_sw_event+0x4f/0x100 kernel/events/core.c:7809
 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:ffff88809b6a7a60 EFLAGS: 00050206
RAX: ffffed1012856000 RBX: 00000000000037c7 RCX: 0000000000001acb
RDX: 00000000000037c7 RSI: 0000000020e34000 RDI: ffff8880942ae535
RBP: 0000000020e32304 R08: 0000000000000001 R09: ffffed1012855fff
R10: ffff8880942affff R11: 0000000000000000 R12: ffff8880942ac839
R13: 00007ffffffff000 R14: 0000000020e35acb R15: ffff8880a1a36cc0
 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+0x19c/0x760 lib/iov_iter.c:608
 copy_from_iter_full include/linux/uio.h:126 [inline]
 skb_do_copy_data_nocache include/net/sock.h:1892 [inline]
 skb_copy_to_page_nocache include/net/sock.h:1918 [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:0x7f6180d58439
RSP: 002b:00007f6180d031f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f6180de14e8 RCX: 00007f6180d58439
RDX: ffffffffffffffef RSI: 0000000020d7cfcb RDI: 0000000000000006
RBP: 00007f6180de14e0 R08: 0000000000000000 R09: 0000000000000053
R10: 0000000000025c42 R11: 0000000000000246 R12: 00007f6180de14ec
R13: 00007ffd30a5a25f R14: 00007f6180d03300 R15: 0000000000022000

Allocated by task 7985:
 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]
 nlmsg_new include/net/netlink.h:511 [inline]
 netlink_ack+0x216/0x9a0 net/netlink/af_netlink.c:2368
 netlink_rcv_skb+0x2c5/0x390 net/netlink/af_netlink.c:2447
 netlink_unicast_kernel net/netlink/af_netlink.c:1294 [inline]
 netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1320
 netlink_sendmsg+0x638/0xb90 net/netlink/af_netlink.c:1886
 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

Freed by task 7985:
 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]
 consume_skb+0xe0/0x380 net/core/skbuff.c:714
 skb_free_datagram+0x16/0xe0 net/core/datagram.c:331
 netlink_recvmsg+0x5c1/0xda0 net/netlink/af_netlink.c:1965
 sock_recvmsg_nosec net/socket.c:819 [inline]
 sock_recvmsg net/socket.c:826 [inline]
 sock_recvmsg net/socket.c:822 [inline]
 SYSC_recvfrom net/socket.c:1815 [inline]
 SyS_recvfrom+0x21b/0x340 net/socket.c:1787
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880990bd0c0
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 160 bytes to the left of
 512-byte region [ffff8880990bd0c0, ffff8880990bd2c0)
The buggy address belongs to the page:
page:ffffea0002642f40 count:1 mapcount:0 mapping:ffff8880990bd0c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880990bd0c0 0000000000000000 0000000100000006
raw: ffffea0002c06120 ffffea0002cf0260 ffff88813fe74940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880990bcf00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880990bcf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880990bd000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                               ^
 ffff8880990bd080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8880990bd100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/12/21 15:27 linux-4.14.y 9dfbac0e6b86 a938f0b8 .config console log report syz C ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2021/01/19 00:37 linux-4.14.y 2762b48e9611 63631df1 .config console log report syz C ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2020/07/27 11:59 linux-4.14.y 69b94dd6dcd1 cb93dc6a .config console log report syz C ci2-linux-4-14
2023/02/27 16:11 linux-4.14.y 7878a41b6cc1 9189cb53 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2023/01/21 00:57 linux-4.14.y 97205fccccdc cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2023/01/18 12:57 linux-4.14.y 97205fccccdc 4620c2d9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2022/11/13 17:56 linux-4.14.y e911713e40ca 7ba4d859 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2022/06/03 11:54 linux-4.14.y 501eec4f9e13 eee80d3c .config console log report info ci2-linux-4-14 KASAN: slab-out-of-bounds Read in perf_output_read
2021/01/01 08:47 linux-4.14.y 1752938529c6 79264ae3 .config console log report info ci2-linux-4-14
2020/12/28 22:47 linux-4.14.y 3f2ecb86cb90 8259d56c .config console log report info ci2-linux-4-14
2020/12/08 19:07 linux-4.14.y 47cbf4cc32db 9af51e31 .config console log report info ci2-linux-4-14
2020/08/22 03:55 linux-4.14.y 6a24ca2506d6 6436ce4b .config console log report ci2-linux-4-14
2020/05/02 11:42 linux-4.14.y 050272a0423e 58da4c35 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.