syzbot


KASAN: use-after-free Read in hci_cmd_timeout

Status: upstream: reported C repro on 2019/09/06 20:31
Reported-by: syzbot+188c65dac35116b39205@syzkaller.appspotmail.com
First crash: 1693d, last: 829d
Fix bisection the fix commit could be any of (bisect log):
  a844dc4c5442 Linux 4.14.158
  56dfe6252c68 Linux 4.14.188
  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in hci_cmd_timeout syz error 17 451d 1699d 0/1 upstream: reported syz repro on 2019/09/01 02:37
android-5-10 KASAN: use-after-free Read in hci_cmd_timeout 1 422d 422d 0/2 auto-obsoleted due to no activity on 2023/05/29 20:38
upstream KASAN: use-after-free Read in hci_cmd_timeout C done error 371 503d 1815d 22/26 fixed on 2023/04/12 21:18
upstream KASAN: slab-use-after-free Read in hci_cmd_timeout bluetooth 2 23d 40d 0/26 upstream: reported on 2024/03/16 12:17
Last patch testing requests (6)
Created Duration User Patch Repo Result
2023/02/10 00:32 10m retest repro linux-4.14.y report log
2023/02/09 23:32 9m retest repro linux-4.14.y report log
2023/02/09 22:32 10m retest repro linux-4.14.y report log
2022/09/19 17:29 11m retest repro linux-4.14.y report log
2022/09/19 16:29 11m retest repro linux-4.14.y report log
2022/09/19 15:29 14m retest repro linux-4.14.y report log
Fix bisection attempts (6)
Created Duration User Patch Repo Result
2020/07/20 20:02 40m bisect fix linux-4.14.y job log (2)
2020/06/03 17:38 36m bisect fix linux-4.14.y job log (0) log
2020/05/04 16:57 41m bisect fix linux-4.14.y job log (0) log
2020/04/04 16:19 38m bisect fix linux-4.14.y job log (0) log
2020/02/24 05:53 41m bisect fix linux-4.14.y job log (0) log
2020/01/05 21:33 39m bisect fix linux-4.14.y job log (0) log

Sample crash report:
Bluetooth: hci4: Frame reassembly failed (-84)
Bluetooth: hci5: Entering manufacturer mode failed (-110)
Bluetooth: hci5: Frame reassembly failed (-84)
Bluetooth: hci0: Entering manufacturer mode failed (-110)
==================================================================
BUG: KASAN: use-after-free in hci_cmd_timeout+0x19e/0x1b0 net/bluetooth/hci_core.c:2527
Read of size 2 at addr ffff88809ec08848 by task kworker/0:3/8936

CPU: 0 PID: 8936 Comm: kworker/0:3 Not tainted 4.14.234-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events hci_cmd_timeout
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_load_n_noabort+0x6b/0x80 mm/kasan/report.c:440
 hci_cmd_timeout+0x19e/0x1b0 net/bluetooth/hci_core.c:2527
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 9261:
 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]
 bt_skb_alloc include/net/bluetooth/bluetooth.h:336 [inline]
 hci_prepare_cmd+0x2a/0x290 net/bluetooth/hci_request.c:302
 hci_req_add_ev+0xd0/0x220 net/bluetooth/hci_request.c:336
 __hci_cmd_sync_ev+0x14e/0x5a0 net/bluetooth/hci_request.c:129
 btintel_enter_mfg+0x72/0xe0 drivers/bluetooth/btintel.c:81
 ag6xx_setup+0xe8/0x6e0 drivers/bluetooth/hci_ag6xx.c:180
 hci_uart_setup+0x193/0x410 drivers/bluetooth/hci_ldisc.c:429
 hci_dev_do_open+0x34c/0xe30 net/bluetooth/hci_core.c:1386
 hci_power_on+0x97/0x3b0 net/bluetooth/hci_core.c:2082
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 9261:
 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
 hci_dev_do_open+0x737/0xe30 net/bluetooth/hci_core.c:1471
 hci_power_on+0x97/0x3b0 net/bluetooth/hci_core.c:2082
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff88809ec08840
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
 512-byte region [ffff88809ec08840, ffff88809ec08a40)
The buggy address belongs to the page:
page:ffffea00027b0200 count:1 mapcount:0 mapping:ffff88809ec080c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff88809ec080c0 0000000000000000 0000000100000006
raw: ffffea000271b6a0 ffffea000273a3a0 ffff88813fe80940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809ec08700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809ec08780: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88809ec08800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                              ^
 ffff88809ec08880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809ec08900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/05/29 03:25 linux-4.14.y ad8397a84e1e 858ea628 .config console log report syz C ci2-linux-4-14 KASAN: use-after-free Read in hci_cmd_timeout
2019/12/06 21:33 linux-4.14.y a844dc4c5442 85f26751 .config console log report syz C ci2-linux-4-14
2019/09/06 19:30 linux-4.14.y 414510bc00a5 acb5b744 .config console log report syz ci2-linux-4-14
2022/01/17 12:34 linux-4.14.y 4ba8e26127c3 731a2d23 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in hci_cmd_timeout
2021/04/07 11:43 linux-4.14.y 0cc244011f40 6a81331a .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in hci_cmd_timeout
2020/09/03 23:02 linux-4.14.y 2f166cdcf8a9 abf9ba4f .config console log report ci2-linux-4-14
2020/06/20 20:00 linux-4.14.y b850307b279c c655ec77 .config console log report ci2-linux-4-14
2020/03/05 16:19 linux-4.14.y 78d697fc93f9 b655d91b .config console log report ci2-linux-4-14
2020/01/25 05:53 linux-4.14.y 8bac50406cca 2e95ab33 .config console log report ci2-linux-4-14
2019/12/06 20:17 linux-4.14.y a844dc4c5442 85f26751 .config console log report ci2-linux-4-14
2019/11/24 12:33 linux-4.14.y 43598c571e7e 598ca6c8 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.