syzbot


KASAN: use-after-free Read in hci_dev_do_open

Status: auto-closed as invalid on 2021/08/11 21:06
Reported-by: syzbot+99ce2ea5930e5e235226@syzkaller.appspotmail.com
First crash: 1198d, last: 1098d
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 bluetooth 1 1194d 1190d 0/26 auto-closed as invalid on 2021/05/07 10:14
linux-4.14 KASAN: use-after-free Read in hci_dev_do_open 1 1090d 1090d 0/1 auto-closed as invalid on 2021/08/19 08:27

Sample crash report:
device veth1_macvtap left promiscuous mode
device veth0_macvtap left promiscuous mode
device veth1_vlan left promiscuous mode
device veth0_vlan left promiscuous mode
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:43 [inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:967 [inline]
BUG: KASAN: use-after-free in kfree_skb+0x32/0x3d0 net/core/skbuff.c:668
Read of size 4 at addr ffff8880a2eb6a24 by task syz-executor.3/9778

CPU: 0 PID: 9778 Comm: syz-executor.3 Not tainted 4.19.186-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/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report+0x8f/0xa0 mm/kasan/report.c:412
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 refcount_read include/linux/refcount.h:43 [inline]
 skb_unref include/linux/skbuff.h:967 [inline]
 kfree_skb+0x32/0x3d0 net/core/skbuff.c:668
 hci_dev_do_open+0xaf0/0x1260 net/bluetooth/hci_core.c:1511
 hci_dev_open+0x130/0x250 net/bluetooth/hci_core.c:1577
 hci_sock_ioctl+0x57e/0x7d0 net/bluetooth/hci_sock.c:1018
 sock_do_ioctl+0xcb/0x2d0 net/socket.c:950
 sock_ioctl+0x2ef/0x5d0 net/socket.c:1074
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x466217
Code: 3c 1c 48 f7 d8 49 39 c4 72 b8 e8 a4 48 02 00 85 c0 78 bd 48 83 c4 08 4c 89 e0 5b 41 5c c3 0f 1f 44 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdb45c1a78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000001e653bc RCX: 0000000000466217
RDX: 0000000000000003 RSI: 00000000400448c9 RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 00007faeebf36700
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004
R13: 000000000056ca68 R14: 0000000000000000 R15: 00000000000000f8

Allocated by task 8123:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 skb_clone+0x151/0x3d0 net/core/skbuff.c:1293
 hci_cmd_work+0x18f/0x360 net/bluetooth/hci_core.c:4397
 process_one_work+0x864/0x1570 kernel/workqueue.c:2152
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2295
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 8120:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 kfree_skbmem+0xc1/0x140 net/core/skbuff.c:595
 __kfree_skb net/core/skbuff.c:655 [inline]
 kfree_skb+0x127/0x3d0 net/core/skbuff.c:672
 hci_cmd_work+0x182/0x360 net/bluetooth/hci_core.c:4395
 process_one_work+0x864/0x1570 kernel/workqueue.c:2152
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2295
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff8880a2eb6940
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 228 bytes inside of
 232-byte region [ffff8880a2eb6940, ffff8880a2eb6a28)
The buggy address belongs to the page:
page:ffffea00028bad80 count:1 mapcount:0 mapping:ffff88823b2b7540 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea00026b78c8 ffffea00026c9488 ffff88823b2b7540
raw: 0000000000000000 ffff8880a2eb6080 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a2eb6900: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8880a2eb6980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a2eb6a00: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
                               ^
 ffff8880a2eb6a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a2eb6b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/04/13 21:05 linux-4.19.y 830a059cbba6 a184b83e .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in hci_dev_do_open
2021/01/04 02:46 linux-4.19.y 3207316b3bee 79264ae3 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.