syzbot


KASAN: use-after-free Read in hci_dev_do_open

Status: auto-closed as invalid on 2021/08/19 08:27
Reported-by: syzbot+3fc856ecd586161d7739@syzkaller.appspotmail.com
First crash: 442d, last: 442d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in hci_dev_do_open 1 546d 542d 0/22 auto-closed as invalid on 2021/05/07 10:14
linux-4.19 KASAN: use-after-free Read in hci_dev_do_open 2 449d 549d 0/1 auto-closed as invalid on 2021/08/11 21:06

Sample crash report:
2097051 pages RAM
0 pages HighMem/MovableOnly
363849 pages reserved
0 pages cma reserved
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in atomic_read arch/x86/include/asm/atomic.h:27 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:42 [inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:952 [inline]
BUG: KASAN: use-after-free in kfree_skb+0x321/0x390 net/core/skbuff.c:668
Read of size 4 at addr ffff8880ab2fd364 by task syz-executor.0/14961

CPU: 1 PID: 14961 Comm: syz-executor.0 Not tainted 4.14.231-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/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 __read_once_size include/linux/compiler.h:183 [inline]
 atomic_read arch/x86/include/asm/atomic.h:27 [inline]
 refcount_read include/linux/refcount.h:42 [inline]
 skb_unref include/linux/skbuff.h:952 [inline]
 kfree_skb+0x321/0x390 net/core/skbuff.c:668
 hci_dev_do_open+0x737/0xe30 net/bluetooth/hci_core.c:1471
 hci_dev_open+0xee/0x1f0 net/bluetooth/hci_core.c:1537
 hci_sock_ioctl+0x483/0x690 net/bluetooth/hci_sock.c:1013
 sock_do_ioctl net/socket.c:974 [inline]
 sock_ioctl+0x2cc/0x4c0 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x466217
RSP: 002b:00007ffe243d3608 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000031043bc RCX: 0000000000466217
RDX: 0000000000000000 RSI: 00000000400448c9 RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 00007efdf65a2700
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004
R13: 000000000056ca68 R14: 0000000000000000 R15: 00000000000000f8

Allocated by task 7993:
 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
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 skb_clone+0x126/0x9a0 net/core/skbuff.c:1291
 hci_cmd_work+0x167/0x300 net/bluetooth/hci_core.c:4282
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 7993:
 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]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 kfree_skbmem+0x98/0x100 net/core/skbuff.c:595
 __kfree_skb net/core/skbuff.c:655 [inline]
 kfree_skb+0xf4/0x390 net/core/skbuff.c:672
 hci_cmd_work+0x15a/0x300 net/bluetooth/hci_core.c:4280
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff8880ab2fd280
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 228 bytes inside of
 232-byte region [ffff8880ab2fd280, ffff8880ab2fd368)
The buggy address belongs to the page:
page:ffffea0002acbf40 count:1 mapcount:0 mapping:ffff8880ab2fd000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880ab2fd000 0000000000000000 000000010000000c
raw: ffffea00029b0da0 ffff8880b5535c48 ffff88823a8183c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880ab2fd200: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
 ffff8880ab2fd280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880ab2fd300: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
                                                       ^
 ffff8880ab2fd380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8880ab2fd400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2021/04/21 08:27 linux-4.14.y cf256fbcbe34 95777977 .config log report info KASAN: use-after-free Read in hci_dev_do_open