syzbot


KASAN: use-after-free Read in rfcomm_dlc_exists

Status: auto-closed as invalid on 2020/05/12 12:00
Reported-by: syzbot+6864ce6c043bf8072603@syzkaller.appspotmail.com
First crash: 1111d, last: 906d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in rfcomm_dlc_exists 833 829d 1444d 0/22 auto-closed as invalid on 2020/06/27 18:46
linux-4.19 KASAN: use-after-free Read in rfcomm_dlc_exists 46 874d 1116d 0/1 auto-closed as invalid on 2020/06/13 06:12

Sample crash report:
audit: type=1804 audit(2000000242.785:4987): pid=5166 uid=0 auid=4294967295 ses=4294967295 subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 op="invalid_pcr" cause="open_writers" comm="syz-executor.1" name="/root/syzkaller-testdir505953743/syzkaller.2uV4AW/276/bus/bus/file0" dev="sda1" ino=17585 res=1
==================================================================
BUG: KASAN: use-after-free in rfcomm_dlc_get net/bluetooth/rfcomm/core.c:360 [inline]
BUG: KASAN: use-after-free in rfcomm_dlc_exists+0x152/0x170 net/bluetooth/rfcomm/core.c:549
Read of size 1 at addr ffff88809b89f98c by task syz-executor.1/5179

CPU: 0 PID: 5179 Comm: syz-executor.1 Not tainted 4.14.164-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+0x142/0x197 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
 rfcomm_dlc_get net/bluetooth/rfcomm/core.c:360 [inline]
 rfcomm_dlc_exists+0x152/0x170 net/bluetooth/rfcomm/core.c:549
 __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:413 [inline]
 rfcomm_create_dev net/bluetooth/rfcomm/tty.c:486 [inline]
 rfcomm_dev_ioctl+0x4bb/0x1920 net/bluetooth/rfcomm/tty.c:588
 rfcomm_sock_ioctl+0x82/0xa0 net/bluetooth/rfcomm/sock.c:902
 sock_do_ioctl+0x64/0xb0 net/socket.c:974
 sock_ioctl+0x2a6/0x470 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45af49
RSP: 002b:00007f3586045c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045af49
RDX: 0000000020000100 RSI: 00000000400452c8 RDI: 0000000000000005
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f35860466d4
R13: 00000000004c3c64 R14: 00000000004da398 R15: 00000000ffffffff

Allocated by task 31580:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 rfcomm_dlc_alloc+0x59/0x440 net/bluetooth/rfcomm/core.c:305
 rfcomm_sock_alloc.constprop.0+0xb3/0x360 net/bluetooth/rfcomm/sock.c:285
 rfcomm_sock_create+0xdb/0x2a0 net/bluetooth/rfcomm/sock.c:328
 bt_sock_create+0x14c/0x2b0 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x2f6/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd3/0x170 net/socket.c:1325
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 5178:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 rfcomm_dlc_free+0x20/0x30 net/bluetooth/rfcomm/core.c:328
 rfcomm_dlc_put include/net/bluetooth/rfcomm.h:258 [inline]
 __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:417 [inline]
 rfcomm_create_dev net/bluetooth/rfcomm/tty.c:486 [inline]
 rfcomm_dev_ioctl+0x1637/0x1920 net/bluetooth/rfcomm/tty.c:588
 rfcomm_sock_ioctl+0x82/0xa0 net/bluetooth/rfcomm/sock.c:902
 sock_do_ioctl+0x64/0xb0 net/socket.c:974
 sock_ioctl+0x2a6/0x470 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88809b89f840
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 332 bytes inside of
 512-byte region [ffff88809b89f840, ffff88809b89fa40)
The buggy address belongs to the page:
page:ffffea00026e27c0 count:1 mapcount:0 mapping:ffff88809b89f0c0 index:0xffff88809b89fd40
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88809b89f0c0 ffff88809b89fd40 0000000100000001
raw: ffffea0001ea87a0 ffffea00024d27a0 ffff8880aa800940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809b89f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809b89f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809b89f980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88809b89fa00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88809b89fa80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
==================================================================

Crashes (17):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/01/13 11:59 linux-4.14.y 6d0c334a400d 99565c1a .config log report
ci2-linux-4-14 2020/01/12 13:49 linux-4.14.y 6d0c334a400d 31290a45 .config log report
ci2-linux-4-14 2020/01/09 01:02 linux-4.14.y 84f5ad468100 ddc3e859 .config log report
ci2-linux-4-14 2019/12/05 15:34 linux-4.14.y fbc5fe7a54d0 9fd5a512 .config log report
ci2-linux-4-14 2019/11/20 07:26 linux-4.14.y 775d01b65b5d 432c7650 .config log report
ci2-linux-4-14 2019/11/10 10:05 linux-4.14.y c9fda4f22428 dc438b91 .config log report
ci2-linux-4-14 2019/09/11 20:30 linux-4.14.y e2cd24b62938 f4e53c10 .config log report
ci2-linux-4-14 2019/09/10 03:19 linux-4.14.y 414510bc00a5 a60cb4cd .config log report
ci2-linux-4-14 2019/09/08 04:38 linux-4.14.y 414510bc00a5 a60cb4cd .config log report
ci2-linux-4-14 2019/09/03 23:43 linux-4.14.y 01fd1694b93c 526709ff .config log report
ci2-linux-4-14 2019/08/15 18:50 linux-4.14.y 3ffe1e79c174 faeffb00 .config log report
ci2-linux-4-14 2019/07/29 07:53 linux-4.14.y ff33472c282e c85e1c5b .config log report
ci2-linux-4-14 2019/07/28 06:01 linux-4.14.y ff33472c282e c85e1c5b .config log report
ci2-linux-4-14 2019/07/27 11:12 linux-4.14.y ff33472c282e c85e1c5b .config log report
ci2-linux-4-14 2019/07/27 00:06 linux-4.14.y ff33472c282e 8fe30d3e .config log report
ci2-linux-4-14 2019/07/25 19:35 linux-4.14.y ff33472c282e 0d7a1249 .config log report
ci2-linux-4-14 2019/06/22 07:36 linux-4.14.y a5758c531177 34bf9440 .config log report