syzbot


KASAN: use-after-free Read in l2cap_sock_close_cb

Status: upstream: reported syz repro on 2020/07/31 05:53
Reported-by: syzbot+161f0e5d0dcee3e5af70@syzkaller.appspotmail.com
First crash: 1336d, last: 1254d
Fix bisection: fixed by (bisect log) [no-op commit]:
commit 7fa7c9a3310cb03704f1cb15c99cfe444fc72221
Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date: Wed Jul 22 15:51:02 2020 +0000

  iio:adc:ina2xx Fix timestamp alignment issue.

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in l2cap_sock_close_cb C error 157 1289d 1335d 0/1 upstream: reported C repro on 2020/08/01 21:47
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/02/04 15:32 10m retest repro linux-4.14.y report log
2022/09/14 01:27 9m retest repro linux-4.14.y report log

Sample crash report:
NOHZ: local_softirq_pending 08
NOHZ: local_softirq_pending 08
==================================================================
BUG: KASAN: use-after-free in constant_test_bit arch/x86/include/asm/bitops.h:328 [inline]
BUG: KASAN: use-after-free in sock_flag include/net/sock.h:810 [inline]
BUG: KASAN: use-after-free in l2cap_sock_kill net/bluetooth/l2cap_sock.c:1047 [inline]
BUG: KASAN: use-after-free in l2cap_sock_close_cb+0xa7/0xb0 net/bluetooth/l2cap_sock.c:1312
Read of size 8 at addr ffff8880a5241420 by task syz-executor.5/6378

CPU: 1 PID: 6378 Comm: syz-executor.5 Not tainted 4.14.193-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 constant_test_bit arch/x86/include/asm/bitops.h:328 [inline]
 sock_flag include/net/sock.h:810 [inline]
 l2cap_sock_kill net/bluetooth/l2cap_sock.c:1047 [inline]
 l2cap_sock_close_cb+0xa7/0xb0 net/bluetooth/l2cap_sock.c:1312
 l2cap_conn_del+0x3a3/0x670 net/bluetooth/l2cap_core.c:1730
 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7435 [inline]
 l2cap_disconn_cfm+0x6b/0x80 net/bluetooth/l2cap_core.c:7428
 hci_disconn_cfm include/net/bluetooth/hci_core.h:1226 [inline]
 hci_conn_hash_flush+0x114/0x220 net/bluetooth/hci_conn.c:1376
 hci_dev_do_close+0x542/0xc50 net/bluetooth/hci_core.c:1620
 hci_unregister_dev+0x170/0x7a0 net/bluetooth/hci_core.c:3191
 vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xa08/0x27f0 kernel/exit.c:865
 do_group_exit+0x100/0x2e0 kernel/exit.c:962
 SYSC_exit_group kernel/exit.c:973 [inline]
 SyS_exit_group+0x19/0x20 kernel/exit.c:971
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45ce69
RSP: 002b:00007ffd2fe91cd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045ce69
RDX: 00000000004168c1 RSI: 00000000016a85f0 RDI: 0000000000000043
RBP: 00000000004c2b1b R08: 000000000000000b R09: 0000000000000000
R10: 0000000002cb8940 R11: 0000000000000246 R12: 000000000000000c
R13: 00007ffd2fe91e20 R14: 000000000011da6c R15: 00007ffd2fe91e30

Allocated by task 11999:
 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 mm/slab.c:3720 [inline]
 __kmalloc+0x15a/0x400 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 sk_prot_alloc+0x1ba/0x290 net/core/sock.c:1467
 sk_alloc+0x36/0xcd0 net/core/sock.c:1521
 l2cap_sock_alloc.constprop.0+0x31/0x210 net/bluetooth/l2cap_sock.c:1591
 l2cap_sock_create+0xdd/0x170 net/bluetooth/l2cap_sock.c:1637
 bt_sock_create+0x13b/0x280 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x303/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd1/0x1b0 net/socket.c:1325
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 11998:
 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
 sk_prot_free net/core/sock.c:1504 [inline]
 __sk_destruct+0x577/0x6e0 net/core/sock.c:1582
 sk_destruct net/core/sock.c:1597 [inline]
 __sk_free+0xd9/0x2d0 net/core/sock.c:1605
 sk_free+0x2b/0x40 net/core/sock.c:1616
 sock_put include/net/sock.h:1658 [inline]
 l2cap_sock_kill.part.0+0x5b/0x70 net/bluetooth/l2cap_sock.c:1056
 l2cap_sock_kill net/bluetooth/l2cap_sock.c:1207 [inline]
 l2cap_sock_release+0x146/0x180 net/bluetooth/l2cap_sock.c:1205
 __sock_release+0xcd/0x2b0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880a52413c0
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 96 bytes inside of
 2048-byte region [ffff8880a52413c0, ffff8880a5241bc0)
The buggy address belongs to the page:
page:ffffea0002949000 count:1 mapcount:0 mapping:ffff8880a52402c0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff8880a52402c0 0000000000000000 0000000100000003
raw: ffffea000296f7a0 ffff88812fe50948 ffff88812fe52c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a5241300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a5241380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8880a5241400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8880a5241480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a5241500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (226):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/09 11:13 linux-4.14.y 14b58326976d f721e4a0 .config console log report syz ci2-linux-4-14
2020/10/21 09:10 linux-4.14.y cbfa1702aaf6 e761439e .config console log report info ci2-linux-4-14
2020/10/21 06:52 linux-4.14.y cbfa1702aaf6 ff4a3345 .config console log report info ci2-linux-4-14
2020/10/20 17:19 linux-4.14.y cbfa1702aaf6 ff4a3345 .config console log report info ci2-linux-4-14
2020/10/20 06:19 linux-4.14.y cbfa1702aaf6 ff4a3345 .config console log report info ci2-linux-4-14
2020/10/19 10:31 linux-4.14.y cbfa1702aaf6 ff4a3345 .config console log report info ci2-linux-4-14
2020/10/19 09:02 linux-4.14.y cbfa1702aaf6 ff4a3345 .config console log report info ci2-linux-4-14
2020/10/19 01:48 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report info ci2-linux-4-14
2020/10/18 18:37 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report info ci2-linux-4-14
2020/10/18 16:20 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report info ci2-linux-4-14
2020/10/18 10:07 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report info ci2-linux-4-14
2020/10/18 05:44 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report info ci2-linux-4-14
2020/10/17 12:23 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report info ci2-linux-4-14
2020/10/14 23:42 linux-4.14.y cbfa1702aaf6 fc7735a2 .config console log report info ci2-linux-4-14
2020/10/14 05:23 linux-4.14.y cbfa1702aaf6 fc7735a2 .config console log report info ci2-linux-4-14
2020/10/14 02:54 linux-4.14.y cbfa1702aaf6 fc7735a2 .config console log report info ci2-linux-4-14
2020/10/13 21:27 linux-4.14.y cbfa1702aaf6 fc7735a2 .config console log report info ci2-linux-4-14
2020/10/13 11:21 linux-4.14.y cbfa1702aaf6 bd69ee0d .config console log report info ci2-linux-4-14
2020/10/13 09:02 linux-4.14.y cbfa1702aaf6 bd69ee0d .config console log report info ci2-linux-4-14
2020/10/12 16:53 linux-4.14.y cbfa1702aaf6 d32b0bbf .config console log report info ci2-linux-4-14
2020/10/11 13:57 linux-4.14.y cbfa1702aaf6 4a77ae0b .config console log report info ci2-linux-4-14
2020/10/10 09:37 linux-4.14.y cbfa1702aaf6 b74c49a6 .config console log report info ci2-linux-4-14
2020/10/10 06:56 linux-4.14.y cbfa1702aaf6 93817d89 .config console log report info ci2-linux-4-14
2020/10/09 10:12 linux-4.14.y cbfa1702aaf6 fa79ed2a .config console log report info ci2-linux-4-14
2020/10/09 05:00 linux-4.14.y cbfa1702aaf6 92390980 .config console log report info ci2-linux-4-14
2020/10/08 12:33 linux-4.14.y cbfa1702aaf6 92390980 .config console log report info ci2-linux-4-14
2020/10/08 02:15 linux-4.14.y cbfa1702aaf6 1880b4a9 .config console log report info ci2-linux-4-14
2020/10/07 20:33 linux-4.14.y cbfa1702aaf6 1880b4a9 .config console log report info ci2-linux-4-14
2020/10/07 07:06 linux-4.14.y cbfa1702aaf6 1880b4a9 .config console log report info ci2-linux-4-14
2020/10/06 13:35 linux-4.14.y cbfa1702aaf6 1880b4a9 .config console log report info ci2-linux-4-14
2020/10/05 14:23 linux-4.14.y cbfa1702aaf6 1880b4a9 .config console log report info ci2-linux-4-14
2020/10/05 11:44 linux-4.14.y cbfa1702aaf6 5ef9c291 .config console log report info ci2-linux-4-14
2020/10/04 09:37 linux-4.14.y cbfa1702aaf6 5ef9c291 .config console log report info ci2-linux-4-14
2020/10/04 03:22 linux-4.14.y cbfa1702aaf6 1a3f9408 .config console log report info ci2-linux-4-14
2020/10/03 16:13 linux-4.14.y cbfa1702aaf6 1a3f9408 .config console log report info ci2-linux-4-14
2020/10/03 07:57 linux-4.14.y cbfa1702aaf6 2653fa43 .config console log report info ci2-linux-4-14
2020/10/03 05:19 linux-4.14.y cbfa1702aaf6 2653fa43 .config console log report info ci2-linux-4-14
2020/10/03 04:14 linux-4.14.y cbfa1702aaf6 2653fa43 .config console log report info ci2-linux-4-14
2020/10/02 14:29 linux-4.14.y cbfa1702aaf6 062c9832 .config console log report info ci2-linux-4-14
2020/10/02 13:15 linux-4.14.y cbfa1702aaf6 062c9832 .config console log report info ci2-linux-4-14
2020/10/02 08:59 linux-4.14.y cbfa1702aaf6 9602ddf4 .config console log report info ci2-linux-4-14
2020/10/01 23:32 linux-4.14.y cbfa1702aaf6 9602ddf4 .config console log report info ci2-linux-4-14
2020/10/01 22:01 linux-4.14.y cbfa1702aaf6 9602ddf4 .config console log report info ci2-linux-4-14
2020/10/01 20:48 linux-4.14.y cbfa1702aaf6 9602ddf4 .config console log report info ci2-linux-4-14
2020/10/01 18:33 linux-4.14.y cbfa1702aaf6 4103fce0 .config console log report info ci2-linux-4-14
2020/10/01 08:56 linux-4.14.y cbfa1702aaf6 4103fce0 .config console log report info ci2-linux-4-14
2020/07/31 05:52 linux-4.14.y e5a54aa2d312 8df85ed9 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.