KASAN: slab-out-of-bounds Read in bacpy

11 views
Skip to first unread message

syzbot

unread,
May 1, 2019, 11:50:07 PM5/1/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 19bb613a Linux 4.19.37
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1290b314a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2f4f1677ff80cdff
dashboard link: https://syzkaller.appspot.com/bug?extid=9e5ce266501433a60fce
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=138dcae0a00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1431af40a00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+9e5ce2...@syzkaller.appspotmail.com

kauditd_printk_skb: 5 callbacks suppressed
audit: type=1400 audit(1556765138.921:36): avc: denied { map } for
pid=8280 comm="syz-executor712" path="/root/syz-executor712434629"
dev="sda1" ino=1426 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:348 [inline]
BUG: KASAN: slab-out-of-bounds in bacpy+0x23/0x30
include/net/bluetooth/bluetooth.h:236
Read of size 6 at addr ffff88809b4c76fb by task kworker/u5:0/1275

CPU: 1 PID: 1275 Comm: kworker/u5:0 Not tainted 4.19.37 #5
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: hci0 hci_rx_work
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
memcpy+0x24/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:348 [inline]
bacpy+0x23/0x30 include/net/bluetooth/bluetooth.h:236
hci_inquiry_result_with_rssi_evt net/bluetooth/hci_event.c:3939 [inline]
hci_event_packet+0x5455/0xaa6b net/bluetooth/hci_event.c:5820
hci_rx_work+0x440/0xaa0 net/bluetooth/hci_core.c:4349
process_one_work+0x98e/0x1760 kernel/workqueue.c:2153
worker_thread+0x98/0xe40 kernel/workqueue.c:2296
kthread+0x357/0x430 kernel/kthread.c:246
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413

Allocated by task 8284:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
__do_kmalloc_node mm/slab.c:3689 [inline]
__kmalloc_node_track_caller+0x51/0x80 mm/slab.c:3703
__kmalloc_reserve.isra.0+0x40/0xf0 net/core/skbuff.c:137
__alloc_skb+0x10b/0x5f0 net/core/skbuff.c:205
alloc_skb include/linux/skbuff.h:995 [inline]
bt_skb_alloc include/net/bluetooth/bluetooth.h:339 [inline]
vhci_get_user drivers/bluetooth/hci_vhci.c:180 [inline]
vhci_write+0xc4/0x470 drivers/bluetooth/hci_vhci.c:299
call_write_iter include/linux/fs.h:1811 [inline]
new_sync_write fs/read_write.c:474 [inline]
__vfs_write+0x58e/0x820 fs/read_write.c:487
vfs_write+0x20c/0x560 fs/read_write.c:549
ksys_write+0xea/0x1f0 fs/read_write.c:598
__do_sys_write fs/read_write.c:610 [inline]
__se_sys_write fs/read_write.c:607 [inline]
__x64_sys_write+0x73/0xb0 fs/read_write.c:607
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 3594:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kfree+0xcf/0x230 mm/slab.c:3822
kernfs_fop_release+0x129/0x1a0 fs/kernfs/file.c:783
__fput+0x2df/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x14a/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x273/0x2c0 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+0x52d/0x610 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809b4c7500
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 507 bytes inside of
512-byte region [ffff88809b4c7500, ffff88809b4c7700)
The buggy address belongs to the page:
page:ffffea00026d31c0 count:1 mapcount:0 mapping:ffff88812c3f0940 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffffea00022f2948 ffffea00026d3908 ffff88812c3f0940
raw: 0000000000000000 ffff88809b4c7000 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809b4c7600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809b4c7680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff88809b4c7700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88809b4c7780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809b4c7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Sep 5, 2020, 1:29:09 AM9/5/20
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 8c4a649c20fec015ebb326f36b47d4e39d9ff5b7
Author: Peilin Ye <yepei...@gmail.com>
Date: Fri Jul 10 16:09:15 2020 +0000

Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11ace2ed900000
start commit: c7ecf3e3 Linux 4.19.92
git tree: linux-4.19.y
kernel config: https://syzkaller.appspot.com/x/.config?x=f1b833aa58e7216b
dashboard link: https://syzkaller.appspot.com/bug?extid=9e5ce266501433a60fce
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=134e0869e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17681059e00000

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

#syz fix: Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt()

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