syzbot


KASAN: use-after-free Read in l2cap_chan_put

Status: upstream: reported C repro on 2020/08/06 00:36
Reported-by: syzbot+3dc0a659c7ec0011789f@syzkaller.appspotmail.com
First crash: 1358d, last: 949d
Fix bisection: failed (error log, bisect log)
  
Fix bisection attempts (16)
Created Duration User Patch Repo Result
2021/10/18 21:15 18m bisect fix linux-4.19.y error job log (0)
2021/09/18 20:35 40m bisect fix linux-4.19.y job log (0) log
2021/08/19 19:54 40m bisect fix linux-4.19.y job log (0) log
2021/07/20 19:07 46m bisect fix linux-4.19.y job log (0) log
2021/06/20 18:25 42m bisect fix linux-4.19.y job log (0) log
2021/05/21 04:44 40m bisect fix linux-4.19.y job log (0) log
2021/04/21 04:10 30m bisect fix linux-4.19.y job log (0) log
2021/03/22 03:35 34m bisect fix linux-4.19.y job log (0) log
2021/02/20 02:23 34m bisect fix linux-4.19.y job log (0) log
2021/02/17 16:59 19m bisect fix linux-4.19.y error job log (0)
2021/02/02 23:21 1m bisect fix linux-4.19.y error job log (0)
2021/01/03 21:16 35m bisect fix linux-4.19.y job log (0) log
2020/12/04 20:36 39m bisect fix linux-4.19.y job log (0) log
2020/11/04 06:39 38m bisect fix linux-4.19.y job log (0) log
2020/10/05 05:47 32m bisect fix linux-4.19.y job log (0) log
2020/09/05 00:35 44m bisect fix linux-4.19.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xcc/0xef lib/list_debug.c:42
Read of size 8 at addr ffff88808a9d3b50 by task syz-executor289/7079

CPU: 0 PID: 7079 Comm: syz-executor289 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_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 __list_del_entry_valid+0xcc/0xef lib/list_debug.c:42
 __list_del_entry include/linux/list.h:117 [inline]
 list_del include/linux/list.h:125 [inline]
 l2cap_chan_destroy net/bluetooth/l2cap_core.c:476 [inline]
 kref_put include/linux/kref.h:70 [inline]
 l2cap_chan_put+0x5e/0x1c0 net/bluetooth/l2cap_core.c:493
 l2cap_sock_destruct+0x47/0xf0 net/bluetooth/l2cap_sock.c:1488
 __sk_destruct+0x4b/0x810 net/core/sock.c:1559
 sk_destruct net/core/sock.c:1599 [inline]
 __sk_free+0x165/0x3b0 net/core/sock.c:1610
 sk_free+0x3b/0x50 net/core/sock.c:1621
 sock_put include/net/sock.h:1707 [inline]
 l2cap_sock_kill.part.0+0x6b/0x80 net/bluetooth/l2cap_sock.c:1055
 l2cap_sock_kill net/bluetooth/l2cap_sock.c:1206 [inline]
 l2cap_sock_release+0x158/0x190 net/bluetooth/l2cap_sock.c:1204
 __sock_release+0xcd/0x2a0 net/socket.c:579
 sock_close+0x15/0x20 net/socket.c:1140
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 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
RIP: 0033:0x405c61
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 19 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffea2c16330 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000405c61
RDX: fffffffffffffff7 RSI: 0000000020000180 RDI: 0000000000000004
RBP: 00007ffea2c16370 R08: 0000000000000004 R09: 00007ffea2c162e0
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000018402
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7079:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 l2cap_chan_create+0x40/0x380 net/bluetooth/l2cap_core.c:441
 l2cap_sock_alloc.constprop.0+0x16c/0x210 net/bluetooth/l2cap_sock.c:1605
 l2cap_sock_create+0x110/0x1b0 net/bluetooth/l2cap_sock.c:1636
 bt_sock_create+0x154/0x2a0 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x3d8/0x740 net/socket.c:1276
 sock_create net/socket.c:1316 [inline]
 __sys_socket+0xef/0x200 net/socket.c:1346
 __do_sys_socket net/socket.c:1355 [inline]
 __se_sys_socket net/socket.c:1353 [inline]
 __x64_sys_socket+0x6f/0xb0 net/socket.c:1353
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6472:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 l2cap_chan_destroy net/bluetooth/l2cap_core.c:479 [inline]
 kref_put include/linux/kref.h:70 [inline]
 l2cap_chan_put+0x16b/0x1c0 net/bluetooth/l2cap_core.c:493
 l2cap_conless_channel net/bluetooth/l2cap_core.c:6976 [inline]
 l2cap_recv_frame+0xd36/0xa550 net/bluetooth/l2cap_core.c:7023
 l2cap_recv_acldata+0x80e/0x910 net/bluetooth/l2cap_core.c:7588
 hci_acldata_packet net/bluetooth/hci_core.c:4178 [inline]
 hci_rx_work+0x455/0xa90 net/bluetooth/hci_core.c:4364
 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 ffff88808a9d3700
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1104 bytes inside of
 2048-byte region [ffff88808a9d3700, ffff88808a9d3f00)
The buggy address belongs to the page:
page:ffffea00022a7480 count:1 mapcount:0 mapping:ffff88812c39cc40 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea000231e108 ffff88812c394948 ffff88812c39cc40
raw: 0000000000000000 ffff88808a9d2600 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808a9d3a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808a9d3a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808a9d3b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff88808a9d3b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808a9d3c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/06 00:35 linux-4.19.y c076c79e03c6 0487ea6f .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.