syzbot


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

Status: fixed on 2020/09/11 09:49
Reported-by: syzbot+f7d833bcd3363d2bbb0d@syzkaller.appspotmail.com
Fix commit: 8c4a649c20fe Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt()
First crash: 1772d, last: 1563d
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 (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: slab-out-of-bounds Read in hci_event_packet C done 17 1556d 2030d 1/1 fixed on 2020/09/17 01:43
upstream KASAN: slab-out-of-bounds Read in hci_event_packet C done error 67 1511d 2144d 0/28 auto-obsoleted due to no activity on 2022/09/25 01:13
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2020/09/10 13:19 4h01m bisect fix linux-4.19.y OK (1) job log
2020/07/10 17:23 24m bisect fix linux-4.19.y OK (0) job log log
2020/05/14 11:39 26m bisect fix linux-4.19.y OK (0) job log log
2020/04/14 11:15 24m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
audit: type=1400 audit(1584261723.992:36): avc:  denied  { map } for  pid=8171 comm="syz-executor226" path="/root/syz-executor226309558" 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 hci_extended_inquiry_result_evt net/bluetooth/hci_event.c:4162 [inline]
BUG: KASAN: slab-out-of-bounds in hci_event_packet+0x48f5/0xa9d9 net/bluetooth/hci_event.c:5844
Read of size 6 at addr ffff88809fbad788 by task kworker/u5:0/1216

CPU: 1 PID: 1216 Comm: kworker/u5:0 Not tainted 4.19.109-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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x212 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+0x88/0x2b9 mm/kasan/report.c:396
 memcpy+0x20/0x50 mm/kasan/kasan.c:302
 hci_extended_inquiry_result_evt net/bluetooth/hci_event.c:4162 [inline]
 hci_event_packet+0x48f5/0xa9d9 net/bluetooth/hci_event.c:5844
 hci_rx_work+0x47b/0xab0 net/bluetooth/hci_core.c:4359
 process_one_work+0x91f/0x1640 kernel/workqueue.c:2153
 worker_thread+0x96/0xe20 kernel/workqueue.c:2296
 kthread+0x34a/0x420 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 8179:
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node_track_caller+0x4c/0x70 mm/slab.c:3703
 __kmalloc_reserve.isra.0+0x39/0xe0 net/core/skbuff.c:137
 __alloc_skb+0xef/0x5b0 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+0xbd/0x460 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+0x512/0x760 fs/read_write.c:487
 vfs_write+0x206/0x550 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6110:
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xce/0x220 mm/slab.c:3822
 kernfs_fop_release+0x124/0x190 fs/kernfs/file.c:783
 __fput+0x2cd/0x890 fs/file_table.c:278
 task_work_run+0x13f/0x1b0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x25a/0x2b0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809fbad580
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes to the right of
 512-byte region [ffff88809fbad580, ffff88809fbad780)
The buggy address belongs to the page:
page:ffffea00027eeb40 count:1 mapcount:0 mapping:ffff88812c3dc940 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002a202c8 ffffea0002397088 ffff88812c3dc940
raw: 0000000000000000 ffff88809fbad080 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809fbad680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88809fbad700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809fbad780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                      ^
 ffff88809fbad800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809fbad880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/15 08:44 linux-4.19.y 569209711609 749688d2 .config console log report syz C ci2-linux-4-19
2020/08/11 13:19 linux-4.19.y 961f830af065 5d3ebca9 .config console log report ci2-linux-4-19
2020/08/07 04:38 linux-4.19.y c076c79e03c6 cb436c69 .config console log report ci2-linux-4-19
2020/08/05 17:18 linux-4.19.y c076c79e03c6 b7129355 .config console log report ci2-linux-4-19
2020/08/04 01:25 linux-4.19.y 13af6c74b14a 96dd3623 .config console log report ci2-linux-4-19
2020/08/02 09:34 linux-4.19.y 13af6c74b14a 96dd3623 .config console log report ci2-linux-4-19
2020/08/02 09:18 linux-4.19.y 13af6c74b14a 96dd3623 .config console log report ci2-linux-4-19
2020/08/02 08:54 linux-4.19.y 13af6c74b14a 96dd3623 .config console log report ci2-linux-4-19
2020/08/02 08:53 linux-4.19.y 13af6c74b14a 96dd3623 .config console log report ci2-linux-4-19
2020/08/02 04:09 linux-4.19.y 13af6c74b14a 8df85ed9 .config console log report ci2-linux-4-19
2020/06/10 17:23 linux-4.19.y 106fa147d3da 5caaad3a .config console log report ci2-linux-4-19
2020/06/10 17:23 linux-4.19.y 106fa147d3da 5caaad3a .config console log report ci2-linux-4-19
2020/06/10 12:41 linux-4.19.y 106fa147d3da 5caaad3a .config console log report ci2-linux-4-19
2020/03/15 08:23 linux-4.19.y 569209711609 749688d2 .config console log report ci2-linux-4-19
2020/01/14 15:51 linux-4.19.y dcd888983542 32881205 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.