syzbot


KASAN: use-after-free Read in sco_sock_timeout

Status: upstream: reported C repro on 2021/09/22 11:06
Reported-by: syzbot+6b7fc56a7391b8277521@syzkaller.appspotmail.com
First crash: 918d, last: 388d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in sco_sock_timeout C error 19 565d 777d 0/1 upstream: reported C repro on 2022/02/10 13:41
upstream KASAN: slab-use-after-free Write in sco_sock_timeout bluetooth C done 206 11h34m 133d 0/26 upstream: reported C repro on 2023/11/16 11:20
upstream KASAN: use-after-free Write in sco_sock_timeout bluetooth C done 272 673d 945d 22/26 fixed on 2023/02/24 13:50

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

CPU: 1 PID: 34 Comm: kworker/1:1 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events sco_sock_timeout
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_sock_timeout+0x7b/0x1b0 net/bluetooth/sco.c:95
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 8153:
 __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 8154:
 __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 ffff8880b25a4c80
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 160 bytes inside of
 2048-byte region [ffff8880b25a4c80, ffff8880b25a5480)
The buggy address belongs to the page:
page:ffffea0002c96900 count:1 mapcount:0 mapping:ffff88813bff0c40 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002541c08 ffffea0002544388 ffff88813bff0c40
raw: 0000000000000000 ffff8880b25a4400 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b25a4c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880b25a4c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b25a4d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8880b25a4d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b25a4e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (105):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/06/22 23:53 linux-4.19.y 3f8a27f9e27b 912f5df7 .config console log report syz C ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2021/09/24 09:30 linux-4.19.y 2950c9c5e0df 8cac236e .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2023/03/06 16:45 linux-4.19.y 3f8a27f9e27b f8902b57 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2023/02/01 07:22 linux-4.19.y 3f8a27f9e27b b68fb8d6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2023/01/31 08:24 linux-4.19.y 3f8a27f9e27b b68fb8d6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2023/01/02 22:10 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/11/24 13:40 linux-4.19.y 3f8a27f9e27b ff68ff8f .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/11/12 03:51 linux-4.19.y 3f8a27f9e27b f42ee5d8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/11/02 04:49 linux-4.19.y 3f8a27f9e27b 08977f5d .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/10/22 23:01 linux-4.19.y 3f8a27f9e27b c0b80a55 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/10/06 13:52 linux-4.19.y 3f8a27f9e27b 2c6543ad .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/10/06 12:21 linux-4.19.y 3f8a27f9e27b 2c6543ad .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/09/22 21:20 linux-4.19.y 3f8a27f9e27b 0042f2b4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/09/21 20:16 linux-4.19.y 3f8a27f9e27b 380f82fb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/09/20 00:18 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/09/15 19:35 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/08/23 14:56 linux-4.19.y 3f8a27f9e27b cea8b0f7 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/08/21 18:23 linux-4.19.y 3f8a27f9e27b 26a13b38 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/08/20 21:10 linux-4.19.y 3f8a27f9e27b 26a13b38 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/08/02 00:29 linux-4.19.y 3f8a27f9e27b fef302b1 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/08/01 05:08 linux-4.19.y 3f8a27f9e27b fef302b1 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/07/28 02:29 linux-4.19.y 3f8a27f9e27b fb95c74d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/07/23 23:18 linux-4.19.y 3f8a27f9e27b 22343af4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/07/01 03:17 linux-4.19.y 3f8a27f9e27b 1434eec0 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/22 21:18 linux-4.19.y 3f8a27f9e27b 912f5df7 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/21 07:30 linux-4.19.y 3f8a27f9e27b 0fc5c330 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/17 15:46 linux-4.19.y 3f8a27f9e27b cb58b3b2 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/07 15:06 linux-4.19.y 3f8a27f9e27b b2706118 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/05 11:38 linux-4.19.y 3f8a27f9e27b c8857892 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/01 21:21 linux-4.19.y 3f8a27f9e27b b4bc6a3d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/06/01 19:10 linux-4.19.y 3f8a27f9e27b b4bc6a3d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/05/30 18:40 linux-4.19.y 3f8a27f9e27b af70c3a9 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/05/29 09:03 linux-4.19.y 3f8a27f9e27b a46af346 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/05/12 22:22 linux-4.19.y 3f8a27f9e27b 9ad6612a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/05/11 21:15 linux-4.19.y 3f8a27f9e27b beb0b407 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/04/23 08:23 linux-4.19.y 3f8a27f9e27b 131df97d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/03/31 15:15 linux-4.19.y 3f8a27f9e27b c4c32d8c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/03/06 12:52 linux-4.19.y 3f8a27f9e27b 7bdd8b2c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/03/03 16:16 linux-4.19.y 3f8a27f9e27b 45a13a73 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/02/26 11:24 linux-4.19.y 3f8a27f9e27b 45a13a73 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/29 08:19 linux-4.19.y 3f8a27f9e27b 495e00c5 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/29 04:46 linux-4.19.y 3f8a27f9e27b 495e00c5 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/14 19:46 linux-4.19.y 3f8a27f9e27b 53e00b45 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/12 19:37 linux-4.19.y 3f8a27f9e27b 44d1319a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/12 12:18 linux-4.19.y 3f8a27f9e27b 44d1319a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/12 12:07 linux-4.19.y 3f8a27f9e27b 44d1319a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/11 11:36 linux-4.19.y 3f8a27f9e27b 1884f55a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2022/01/10 18:30 linux-4.19.y 3f8a27f9e27b ddb0ab8c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
2021/09/22 11:05 linux-4.19.y 2950c9c5e0df 169724fe .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in sco_sock_timeout
* Struck through repros no longer work on HEAD.