KASAN: use-after-free Read in sco_chan_del

10 views
Skip to first unread message

syzbot

unread,
Aug 3, 2020, 9:10:16 AM8/3/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 7f2c5eb4 Linux 4.14.191
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15940062900000
kernel config: https://syzkaller.appspot.com/x/.config?x=881f1aee9620bf9f
dashboard link: https://syzkaller.appspot.com/bug?extid=1c98095bbb6f3a9d7cc7
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11bed232900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c8f692900000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1c9809...@syzkaller.appspotmail.com

audit: type=1400 audit(1596460078.639:8): avc: denied { execmem } for pid=6351 comm="syz-executor148" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in hci_conn_drop include/net/bluetooth/hci_core.h:963 [inline]
BUG: KASAN: use-after-free in sco_chan_del+0x3b2/0x3d0 net/bluetooth/sco.c:148
Read of size 1 at addr ffff88808944aaf5 by task syz-executor148/6399

CPU: 0 PID: 6399 Comm: syz-executor148 Not tainted 4.14.191-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_load1_noabort+0x68/0x70 mm/kasan/report.c:427
hci_conn_drop include/net/bluetooth/hci_core.h:963 [inline]
sco_chan_del+0x3b2/0x3d0 net/bluetooth/sco.c:148
__sco_sock_close+0xb0/0x670 net/bluetooth/sco.c:433
sco_sock_close net/bluetooth/sco.c:447 [inline]
sco_sock_release+0x6a/0x370 net/bluetooth/sco.c:1009
__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
get_signal+0x18a3/0x1ca0 kernel/signal.c:2234
do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:814
exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
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
RIP: 0033:0x447089
RSP: 002b:00007f539742ddb8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: fffffffffffffffc RBX: 00000000006dbc48 RCX: 0000000000447089
RDX: 0000000000000008 RSI: 0000000020000000 RDI: 0000000000000004
RBP: 00000000006dbc40 R08: 00007f539742e700 R09: 0000000000000000
R10: 00007f539742e700 R11: 0000000000000246 R12: 00000000006dbc4c
R13: 00007ffe19f6cc6f R14: 00007f539742e9c0 R15: 00000000006dbc4c

Allocated by task 6399:
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_trace+0x131/0x3d0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
hci_conn_add+0x53/0x12f0 net/bluetooth/hci_conn.c:501
hci_connect_sco+0x265/0x7d0 net/bluetooth/hci_conn.c:1119
sco_connect net/bluetooth/sco.c:240 [inline]
sco_sock_connect+0x26c/0x860 net/bluetooth/sco.c:576
SYSC_connect net/socket.c:1655 [inline]
SyS_connect+0x1f4/0x240 net/socket.c:1636
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6381:
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
device_release+0xf0/0x1a0 drivers/base/core.c:831
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x1f3/0x2d0 lib/kobject.c:692
put_device+0x1c/0x30 drivers/base/core.c:2014
hci_conn_del+0x235/0x620 net/bluetooth/hci_conn.c:611
hci_phy_link_complete_evt.isra.0+0x4d0/0x6c0 net/bluetooth/hci_event.c:4355
hci_event_packet+0x2592/0x7c7a net/bluetooth/hci_event.c:5429
hci_rx_work+0x3e6/0x970 net/bluetooth/hci_core.c:4244
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 ffff88808944aac0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 53 bytes inside of
4096-byte region [ffff88808944aac0, ffff88808944bac0)
The buggy address belongs to the page:
page:ffffea0002251280 count:1 mapcount:0 mapping:ffff88808944aac0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88808944aac0 0000000000000000 0000000100000001
raw: ffffea00025e4ca0 ffff88812fe50a48 ffff88812fe52dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808944a980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88808944aa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88808944aa80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff88808944ab00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808944ab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Jan 5, 2021, 9:34:10 PM1/5/21
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 4113f6f73f6e8d215609bde8c0c14ca9f8a476c5
Author: Anmol Karn <anmol.k...@gmail.com>
Date: Wed Sep 30 14:18:13 2020 +0000

Bluetooth: Fix null pointer dereference in hci_event_packet()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12d47ba8d00000
start commit: 14b58326 Linux 4.14.193
git tree: linux-4.14.y
kernel config: https://syzkaller.appspot.com/x/.config?x=68ef0287ccbc3b42
dashboard link: https://syzkaller.appspot.com/bug?extid=1c98095bbb6f3a9d7cc7
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1199ed3a900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1311bcaa900000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: Bluetooth: Fix null pointer dereference in hci_event_packet()

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages