syzbot


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

Status: fixed on 2020/09/09 05:22
Reported-by: syzbot+9e5ce266501433a60fce@syzkaller.appspotmail.com
Fix commit: 8c4a649c20fe Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt()
First crash: 1793d, last: 1331d
Fix bisection: fixed by (bisect log) :
commit 8c4a649c20fec015ebb326f36b47d4e39d9ff5b7
Author: Peilin Ye <yepeilin.cs@gmail.com>
Date: Fri Jul 10 16:09:15 2020 +0000

  Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt()

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in bacpy bluetooth C done inconclusive 21 1380d 1907d 0/26 auto-obsoleted due to no activity on 2022/09/20 22:03
Fix bisection attempts (10)
Created Duration User Patch Repo Result
2020/09/05 01:19 4h09m bisect fix linux-4.19.y job log (1)
2020/08/06 00:29 26m bisect fix linux-4.19.y job log (0) log
2020/07/07 00:05 23m bisect fix linux-4.19.y job log (0) log
2020/06/06 23:39 25m bisect fix linux-4.19.y job log (0) log
2020/05/07 23:10 29m bisect fix linux-4.19.y job log (0) log
2020/04/07 21:49 25m bisect fix linux-4.19.y job log (0) log
2020/03/08 21:22 26m bisect fix linux-4.19.y job log (0) log
2020/01/31 20:58 26m bisect fix linux-4.19.y job log (0) log
2019/12/29 16:10 23m bisect fix linux-4.19.y job log (0) log
2019/11/29 15:47 23m bisect fix linux-4.19.y job log (0) log

Sample crash report:
audit: type=1400 audit(1577912166.213:36): avc:  denied  { map } for  pid=7830 comm="syz-executor358" path="/root/syz-executor358128003" dev="sda1" ino=16484 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:348 [inline]
BUG: KASAN: slab-out-of-bounds in bacpy+0x23/0x30 include/net/bluetooth/bluetooth.h:236
Read of size 6 at addr ffff8880911a0208 by task kworker/u5:0/1204

CPU: 1 PID: 1204 Comm: kworker/u5:0 Not tainted 4.19.92-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: hci0 hci_rx_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memcpy+0x24/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:348 [inline]
 bacpy+0x23/0x30 include/net/bluetooth/bluetooth.h:236
 hci_extended_inquiry_result_evt net/bluetooth/hci_event.c:4162 [inline]
 hci_event_packet+0x48fb/0xaa40 net/bluetooth/hci_event.c:5844
 hci_rx_work+0x478/0xae0 net/bluetooth/hci_core.c:4359
 process_one_work+0x989/0x1750 kernel/workqueue.c:2153
 worker_thread+0x98/0xe40 kernel/workqueue.c:2296
 kthread+0x354/0x420 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 7837:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node_track_caller+0x51/0x80 mm/slab.c:3703
 __kmalloc_reserve.isra.0+0x40/0xf0 net/core/skbuff.c:137
 __alloc_skb+0x10b/0x5f0 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:995 [inline]
 bt_skb_alloc include/net/bluetooth/bluetooth.h:339 [inline]
 vhci_get_user drivers/bluetooth/hci_vhci.c:180 [inline]
 vhci_write+0xc4/0x470 drivers/bluetooth/hci_vhci.c:299
 call_write_iter include/linux/fs.h:1820 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x587/0x810 fs/read_write.c:487
 vfs_write+0x20c/0x560 fs/read_write.c:549
 ksys_write+0x14f/0x2d0 fs/read_write.c:599
 __do_sys_write fs/read_write.c:611 [inline]
 __se_sys_write fs/read_write.c:608 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:608
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880911a0000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes to the right of
 512-byte region [ffff8880911a0000, ffff8880911a0200)
The buggy address belongs to the page:
page:ffffea0002446800 count:1 mapcount:0 mapping:ffff88812c31c940 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00026db9c8 ffffea00022e6348 ffff88812c31c940
raw: 0000000000000000 ffff8880911a0000 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880911a0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880911a0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880911a0200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                      ^
 ffff8880911a0280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880911a0300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/01 20:58 linux-4.19.y c7ecf3e3a71c 25a0186e .config console log report syz C ci2-linux-4-19
2019/05/02 02:49 linux-4.19.y 19bb613acb9a 7516d9fa .config console log report syz C ci2-linux-4-19
2020/02/07 21:22 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.