syzbot


KASAN: use-after-free Write in hci_conn_del

Status: upstream: reported syz repro on 2020/08/04 00:48
Reported-by: syzbot+673b8798679ede1ad670@syzkaller.appspotmail.com
First crash: 1355d, last: 939d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Write in hci_conn_del syz error 2 1089d 1353d 0/1 upstream: reported syz repro on 2020/08/06 02:37
upstream KASAN: use-after-free Write in hci_conn_del bluetooth syz done inconclusive 3 941d 1354d 0/26 auto-obsoleted due to no activity on 2023/09/10 16:24
Fix bisection attempts (15)
Created Duration User Patch Repo Result
2021/10/31 11:23 14m bisect fix linux-4.19.y error job log (0)
2021/09/23 12:07 33m bisect fix linux-4.19.y job log (0) log
2021/08/24 11:29 37m bisect fix linux-4.19.y job log (0) log
2021/07/25 06:33 36m bisect fix linux-4.19.y job log (0) log
2021/06/25 05:32 35m bisect fix linux-4.19.y job log (0) log
2021/05/26 04:52 39m bisect fix linux-4.19.y job log (0) log
2021/04/26 04:11 37m bisect fix linux-4.19.y job log (0) log
2021/03/26 22:04 27m bisect fix linux-4.19.y job log (0) log
2021/02/24 16:16 32m bisect fix linux-4.19.y job log (0) log
2021/02/03 07:13 0m bisect fix linux-4.19.y error job log (0)
2021/01/04 06:44 28m bisect fix linux-4.19.y job log (0) log
2020/12/05 00:40 37m bisect fix linux-4.19.y job log (0) log
2020/11/04 17:30 27m bisect fix linux-4.19.y job log (0) log
2020/10/05 17:00 29m bisect fix linux-4.19.y job log (0) log
2020/09/05 16:04 35m bisect fix linux-4.19.y job log (0) log

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_batadv: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in hci_conn_del+0x64e/0x6a0 net/bluetooth/hci_conn.c:596
Write of size 8 at addr ffff888091549030 by task syz-executor.4/6510

CPU: 1 PID: 6510 Comm: syz-executor.4 Not tainted 4.19.137-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_store8_noabort+0x88/0x90 mm/kasan/report.c:438
 hci_conn_del+0x64e/0x6a0 net/bluetooth/hci_conn.c:596
 hci_conn_hash_flush+0x189/0x220 net/bluetooth/hci_conn.c:1496
 hci_dev_do_close+0x624/0xe70 net/bluetooth/hci_core.c:1666
 hci_unregister_dev+0x17c/0x7f0 net/bluetooth/hci_core.c:3271
 vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xbb2/0x2b70 kernel/exit.c:887
 do_group_exit+0x125/0x310 kernel/exit.c:990
 __do_sys_exit_group kernel/exit.c:1001 [inline]
 __se_sys_exit_group kernel/exit.c:999 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:999
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45ccd9
Code: Bad RIP value.
RSP: 002b:00007ffecad57fa8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045ccd9
RDX: 0000000000416731 RSI: 0000000000ca85f0 RDI: 0000000000000043
RBP: 00000000004c2963 R08: 000000000000000b R09: 0000000000000000
R10: 0000000001a84940 R11: 0000000000000246 R12: 0000000000000019
R13: 00007ffecad580f0 R14: 000000000000cdd2 R15: 00007ffecad58100

Allocated by task 7904:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 hci_conn_add+0x53/0x11e0 net/bluetooth/hci_conn.c:501
 hci_connect_acl.part.0+0x20d/0x4b0 net/bluetooth/hci_conn.c:1209
 hci_connect_acl net/bluetooth/hci_conn.c:1267 [inline]
 hci_connect_sco+0xf4/0x950 net/bluetooth/hci_conn.c:1232
 sco_connect net/bluetooth/sco.c:240 [inline]
 sco_sock_connect+0x2ff/0x970 net/bluetooth/sco.c:576
 __sys_connect+0x265/0x2c0 net/socket.c:1663
 __do_sys_connect net/socket.c:1674 [inline]
 __se_sys_connect net/socket.c:1671 [inline]
 __x64_sys_connect+0x6f/0xb0 net/socket.c:1671
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7827:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 device_release+0x76/0x210 drivers/base/core.c:1061
 kobject_cleanup lib/kobject.c:662 [inline]
 kobject_release lib/kobject.c:691 [inline]
 kref_put include/linux/kref.h:70 [inline]
 kobject_put+0x22d/0x350 lib/kobject.c:708
 put_device+0x1c/0x30 drivers/base/core.c:2251
 hci_conn_del+0x27e/0x6a0 net/bluetooth/hci_conn.c:611
 hci_conn_complete_evt net/bluetooth/hci_event.c:2468 [inline]
 hci_event_packet+0x654c/0x858f net/bluetooth/hci_event.c:5763
 hci_rx_work+0x46b/0xa90 net/bluetooth/hci_core.c:4359
 process_one_work+0x864/0x1570 kernel/workqueue.c:2155
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2298
 kthread+0x30b/0x410 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff888091548800
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2096 bytes inside of
 4096-byte region [ffff888091548800, ffff888091549800)
The buggy address belongs to the page:
page:ffffea0002455200 count:1 mapcount:0 mapping:ffff88812c39cdc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea000244d888 ffffea0002440388 ffff88812c39cdc0
raw: 0000000000000000 ffff888091548800 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888091548f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888091548f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888091549000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888091549080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888091549100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/06 16:03 linux-4.19.y c076c79e03c6 4ca1c0ea .config console log report syz ci2-linux-4-19
2020/08/04 00:48 linux-4.19.y 13af6c74b14a 96dd3623 .config console log report syz ci2-linux-4-19
* Struck through repros no longer work on HEAD.