KASAN: use-after-free Write in init_timer_key

19 views
Skip to first unread message

syzbot

unread,
Aug 7, 2020, 11:50:18 AM8/7/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 14b58326 Linux 4.14.193
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=150a7c2c900000
kernel config: https://syzkaller.appspot.com/x/.config?x=68ef0287ccbc3b42
dashboard link: https://syzkaller.appspot.com/bug?extid=500364b9d722d013542f
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=144ffd1a900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1744fa94900000

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

Bluetooth: hci4 command 0x040f tx timeout
==================================================================
BUG: KASAN: use-after-free in do_init_timer kernel/time/timer.c:762 [inline]
BUG: KASAN: use-after-free in init_timer_key+0x2e0/0x300 kernel/time/timer.c:782
Write of size 8 at addr ffff88809addaa58 by task syz-executor222/9275

CPU: 0 PID: 9275 Comm: syz-executor222 Not tainted 4.14.193-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_store8_noabort+0x68/0x70 mm/kasan/report.c:435
do_init_timer kernel/time/timer.c:762 [inline]
init_timer_key+0x2e0/0x300 kernel/time/timer.c:782
l2cap_chan_create+0x26a/0x3c0 net/bluetooth/l2cap_core.c:454
l2cap_sock_alloc.constprop.0+0x16c/0x210 net/bluetooth/l2cap_sock.c:1606
l2cap_sock_create+0xdd/0x170 net/bluetooth/l2cap_sock.c:1637
bt_sock_create+0x13b/0x280 net/bluetooth/af_bluetooth.c:130
__sock_create+0x303/0x620 net/socket.c:1275
sock_create net/socket.c:1315 [inline]
SYSC_socket net/socket.c:1345 [inline]
SyS_socket+0xd1/0x1b0 net/socket.c:1325
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x446eb9
RSP: 002b:00007ffe91244118 EFLAGS: 00000246 ORIG_RAX: 0000000000000029
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000446eb9
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000001f
RBP: 0000000000000003 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000407b10 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 9275:
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]
l2cap_chan_create+0x3e/0x3c0 net/bluetooth/l2cap_core.c:441
l2cap_sock_alloc.constprop.0+0x16c/0x210 net/bluetooth/l2cap_sock.c:1606
l2cap_sock_create+0xdd/0x170 net/bluetooth/l2cap_sock.c:1637
bt_sock_create+0x13b/0x280 net/bluetooth/af_bluetooth.c:130
__sock_create+0x303/0x620 net/socket.c:1275
sock_create net/socket.c:1315 [inline]
SYSC_socket net/socket.c:1345 [inline]
SyS_socket+0xd1/0x1b0 net/socket.c:1325
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6491:
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
l2cap_chan_destroy net/bluetooth/l2cap_core.c:479 [inline]
kref_put include/linux/kref.h:70 [inline]
l2cap_chan_put+0x152/0x1b0 net/bluetooth/l2cap_core.c:493
l2cap_conless_channel net/bluetooth/l2cap_core.c:6976 [inline]
l2cap_recv_frame+0xb9a/0x95c0 net/bluetooth/l2cap_core.c:7023
l2cap_recv_acldata+0x7a6/0x8b0 net/bluetooth/l2cap_core.c:7588
hci_acldata_packet net/bluetooth/hci_core.c:4066 [inline]
hci_rx_work+0x3d1/0x970 net/bluetooth/hci_core.c:4249
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 ffff88809adda900
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 344 bytes inside of
2048-byte region [ffff88809adda900, ffff88809addb100)
The buggy address belongs to the page:
page:ffffea00026b7680 count:1 mapcount:0 mapping:ffff88809adda080 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88809adda080 0000000000000000 0000000100000003
raw: ffffea0002672920 ffffea00027943a0 ffff88812fe52c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809adda900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88809adda980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809addaa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88809addaa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88809addab00: 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
Reply all
Reply to author
Forward
0 new messages