syzbot


KASAN: use-after-free Read in rfcomm_dlc_open

Status: auto-closed as invalid on 2019/02/22 10:29
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+e080cd9649f73620fce3@syzkaller.appspotmail.com
First crash: 2082d, last: 2082d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in rfcomm_dlc_open (2) bluetooth 19 1683d 1823d 0/26 auto-closed as invalid on 2020/01/07 22:09

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rfcomm_dlc_get net/bluetooth/rfcomm/core.c:360 [inline]
BUG: KASAN: use-after-free in __rfcomm_dlc_open net/bluetooth/rfcomm/core.c:396 [inline]
BUG: KASAN: use-after-free in rfcomm_dlc_open+0xecf/0x11b0 net/bluetooth/rfcomm/core.c:431
Read of size 1 at addr ffff8801ad4bf484 by task syz-executor2/17324

CPU: 1 PID: 17324 Comm: syz-executor2 Not tainted 4.18.0-rc8+ #180
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 rfcomm_dlc_get net/bluetooth/rfcomm/core.c:360 [inline]
 __rfcomm_dlc_open net/bluetooth/rfcomm/core.c:396 [inline]
 rfcomm_dlc_open+0xecf/0x11b0 net/bluetooth/rfcomm/core.c:431
 rfcomm_sock_connect+0x37c/0x4b0 net/bluetooth/rfcomm/sock.c:416
 __sys_connect+0x37d/0x4c0 net/socket.c:1674
 __do_sys_connect net/socket.c:1685 [inline]
 __se_sys_connect net/socket.c:1682 [inline]
 __x64_sys_connect+0x73/0xb0 net/socket.c:1682
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x456cb9
Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 
RSP: 002b:00007f4baa97bc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f4baa97c6d4 RCX: 0000000000456cb9
RDX: 000000000000000e RSI: 0000000020000080 RDI: 0000000000000014
RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000004cadc8 R14: 00000000004c2c43 R15: 0000000000000000

Allocated by task 2622:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
 kmalloc include/linux/slab.h:513 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 kernfs_fop_open+0x358/0x1020 fs/kernfs/file.c:648
 do_dentry_open+0x818/0xe40 fs/open.c:794
 vfs_open+0x139/0x230 fs/open.c:908
 do_last fs/namei.c:3399 [inline]
 path_openat+0x174a/0x4e10 fs/namei.c:3540
 do_filp_open+0x255/0x380 fs/namei.c:3574
 do_sys_open+0x584/0x760 fs/open.c:1101
 __do_sys_open fs/open.c:1119 [inline]
 __se_sys_open fs/open.c:1114 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1114
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2622:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 kernfs_fop_release+0x12b/0x1a0 fs/kernfs/file.c:783
 __fput+0x355/0x8b0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1ec/0x2a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:192 [inline]
 exit_to_usermode_loop+0x313/0x370 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801ad4bf340
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 324 bytes inside of
 512-byte region [ffff8801ad4bf340, ffff8801ad4bf540)
The buggy address belongs to the page:
page:ffffea0006b52fc0 count:1 mapcount:0 mapping:ffff8801dac00940 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00072c8488 ffffea00073b2308 ffff8801dac00940
raw: 0000000000000000 ffff8801ad4bf0c0 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ad4bf380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ad4bf400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801ad4bf480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8801ad4bf500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801ad4bf580: fc fc fc fc fc fc fc fc 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
2018/08/07 01:56 upstream 1236568ee3cb 1beb8136 .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.