syzbot


KASAN: use-after-free Read in sco_conn_del

Status: auto-closed as invalid on 2022/04/03 17:14
Reported-by: syzbot+db00fca6867014d4b691@syzkaller.appspotmail.com
First crash: 937d, last: 867d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in sco_conn_del (2) 1 543d 543d 0/1 auto-obsoleted due to no activity on 2023/02/21 22:38
upstream KASAN: slab-use-after-free Write in sco_conn_del bluetooth C done 57 11d 326d 0/26 upstream: reported C repro on 2023/05/30 07:30
upstream KASAN: use-after-free Write in sco_conn_del bluetooth 23 780d 948d 0/26 auto-closed as invalid on 2022/06/29 18:22

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3295
Read of size 8 at addr ffff888059b40660 by task syz-executor.1/29857

CPU: 0 PID: 29857 Comm: syz-executor.1 Not tainted 4.19.211-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/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3295
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:144
 spin_lock include/linux/spinlock.h:329 [inline]
 sco_conn_del+0xbb/0x1a0 net/bluetooth/sco.c:194
 sco_disconn_cfm+0x74/0xb0 net/bluetooth/sco.c:1150
 hci_disconn_cfm include/net/bluetooth/hci_core.h:1263 [inline]
 hci_conn_hash_flush+0x127/0x260 net/bluetooth/hci_conn.c:1512
 hci_dev_do_reset net/bluetooth/hci_core.c:1789 [inline]
 hci_dev_reset+0x16b/0x3f0 net/bluetooth/hci_core.c:1828
 hci_sock_ioctl+0x56c/0x850 net/bluetooth/hci_sock.c:1033
 sock_do_ioctl+0xce/0x300 net/socket.c:1015
 sock_ioctl+0x2ef/0x5d0 net/socket.c:1135
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f29f1203ae9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f29f0179188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f29f1316f60 RCX: 00007f29f1203ae9
RDX: 0000000000000000 RSI: 00000000400448cb RDI: 0000000000000004
RBP: 00007f29f125dff7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe6e264bbf R14: 00007f29f0179300 R15: 0000000000022000

Allocated by task 29690:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 sk_prot_alloc+0x1e2/0x2d0 net/core/sock.c:1483
 sk_alloc+0x36/0xec0 net/core/sock.c:1537
 sco_sock_alloc.constprop.0+0x31/0x200 net/bluetooth/sco.c:480
 sco_sock_create+0xd5/0x180 net/bluetooth/sco.c:515
 bt_sock_create+0x154/0x2a0 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x3d8/0x740 net/socket.c:1365
 sock_create net/socket.c:1416 [inline]
 __sys_socket+0xef/0x200 net/socket.c:1458
 __do_sys_socket net/socket.c:1467 [inline]
 __se_sys_socket net/socket.c:1465 [inline]
 __x64_sys_socket+0x6f/0xb0 net/socket.c:1465
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 29753:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 sk_prot_free net/core/sock.c:1520 [inline]
 __sk_destruct+0x684/0x8a0 net/core/sock.c:1602
 sk_destruct net/core/sock.c:1617 [inline]
 __sk_free+0x165/0x3b0 net/core/sock.c:1628
 sk_free+0x3b/0x50 net/core/sock.c:1639
 sock_put include/net/sock.h:1713 [inline]
 sco_sock_kill.part.0+0xaa/0xc0 net/bluetooth/sco.c:412
 sco_sock_kill net/bluetooth/sco.c:404 [inline]
 sco_sock_release+0x1a2/0x330 net/bluetooth/sco.c:1035
 __sock_release+0xcd/0x2a0 net/socket.c:599
 sock_close+0x15/0x20 net/socket.c:1214
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 get_signal+0x1b64/0x1f70 kernel/signal.c:2400
 do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:799
 exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163
 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 ffff888059b405c0
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 160 bytes inside of
 2048-byte region [ffff888059b405c0, ffff888059b40dc0)
The buggy address belongs to the page:
page:ffffea000166d000 count:1 mapcount:0 mapping:ffff88813bff0c40 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002a25a88 ffffea0002aac008 ffff88813bff0c40
raw: 0000000000000000 ffff888059b405c0 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888059b40500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888059b40580: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff888059b40600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff888059b40680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888059b40700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/12/04 17:14 linux-4.19.y 3f8a27f9e27b a617004c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/12/02 15:43 linux-4.19.y 3f8a27f9e27b 61f86278 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/11/30 09:52 linux-4.19.y 3f8a27f9e27b d0830353 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/11/25 13:49 linux-4.19.y 3f8a27f9e27b 545ab074 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/11/22 13:34 linux-4.19.y 3f8a27f9e27b 545ab074 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/11/15 10:39 linux-4.19.y 3f8a27f9e27b 75b04091 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/10/01 15:45 linux-4.19.y c2276d585654 cc80db95 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/09/27 07:56 linux-4.19.y c2276d585654 78494d16 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/09/25 23:44 linux-4.19.y 2950c9c5e0df 8cac236e .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
2021/09/25 17:42 linux-4.19.y 2950c9c5e0df 8cac236e .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_conn_del
* Struck through repros no longer work on HEAD.