KASAN: use-after-free Write in hci_conn_del

15 views
Skip to first unread message

syzbot

unread,
Aug 3, 2020, 8:48:20 PM8/3/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 13af6c74 Linux 4.19.136
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=173d540a900000
kernel config: https://syzkaller.appspot.com/x/.config?x=5b7578d3b5457a49
dashboard link: https://syzkaller.appspot.com/bug?extid=673b8798679ede1ad670
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14d7c632900000

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

batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in hci_conn_del+0x64e/0x6a0 net/bluetooth/hci_conn.c:596
Write of size 8 at addr ffff888090e0aa30 by task syz-executor.2/6484

CPU: 1 PID: 6484 Comm: syz-executor.2 Not tainted 4.19.136-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/0x2fe lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_store8_noabort+0x88/0x90 mm/kasan/report.c:438
hci_conn_del+0x64e/0x6a0 net/bluetooth/hci_conn.c:596
hci_conn_hash_flush+0x189/0x220 net/bluetooth/hci_conn.c:1496
hci_dev_do_close+0x624/0xe70 net/bluetooth/hci_core.c:1666
hci_unregister_dev+0x17c/0x7f0 net/bluetooth/hci_core.c:3271
vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xbb2/0x2b70 kernel/exit.c:887
do_group_exit+0x125/0x310 kernel/exit.c:990
__do_sys_exit_group kernel/exit.c:1001 [inline]
__se_sys_exit_group kernel/exit.c:999 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:999
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45cc79
Code: Bad RIP value.
RSP: 002b:00007ffc0aa82678 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045cc79
RDX: 00000000004166d1 RSI: 0000000000ca85f0 RDI: 0000000000000043
RBP: 00000000004c2903 R08: 000000000000000b R09: 0000000000000000
R10: 0000000001c80940 R11: 0000000000000246 R12: 000000000000000a
R13: 00007ffc0aa827c0 R14: 00000000000103bb R15: 00007ffc0aa827d0

Allocated by task 7863:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
hci_conn_add+0x53/0x11e0 net/bluetooth/hci_conn.c:501
hci_connect_acl.part.0+0x20d/0x4b0 net/bluetooth/hci_conn.c:1209
hci_connect_acl net/bluetooth/hci_conn.c:1267 [inline]
hci_connect_sco+0xf4/0x950 net/bluetooth/hci_conn.c:1232
sco_connect net/bluetooth/sco.c:240 [inline]
sco_sock_connect+0x2ff/0x970 net/bluetooth/sco.c:576
__sys_connect+0x265/0x2c0 net/socket.c:1663
__do_sys_connect net/socket.c:1674 [inline]
__se_sys_connect net/socket.c:1671 [inline]
__x64_sys_connect+0x6f/0xb0 net/socket.c:1671
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7851:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
device_release+0x76/0x210 drivers/base/core.c:1061
kobject_cleanup lib/kobject.c:662 [inline]
kobject_release lib/kobject.c:691 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x22d/0x350 lib/kobject.c:708
put_device+0x1c/0x30 drivers/base/core.c:2251
hci_conn_del+0x27e/0x6a0 net/bluetooth/hci_conn.c:611
hci_conn_complete_evt net/bluetooth/hci_event.c:2465 [inline]
hci_event_packet+0x654c/0x858f net/bluetooth/hci_event.c:5751
hci_rx_work+0x46b/0xa90 net/bluetooth/hci_core.c:4359
process_one_work+0x864/0x1570 kernel/workqueue.c:2155
worker_thread+0x64c/0x1130 kernel/workqueue.c:2298
kthread+0x30b/0x410 kernel/kthread.c:246
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff888090e0a200
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2096 bytes inside of
4096-byte region [ffff888090e0a200, ffff888090e0b200)
The buggy address belongs to the page:
page:ffffea0002438280 count:1 mapcount:0 mapping:ffff88812c39cdc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002442708 ffffea00023fc588 ffff88812c39cdc0
raw: 0000000000000000 ffff888090e0a200 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888090e0a900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888090e0a980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888090e0aa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888090e0aa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888090e0ab00: 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,
Aug 5, 2020, 10:37:24 PM8/5/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ca4f2c56 Linux 4.14.192
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14ce8d66900000
kernel config: https://syzkaller.appspot.com/x/.config?x=60834b36c72d3e64
dashboard link: https://syzkaller.appspot.com/bug?extid=bb16af6ae96df1415e7e
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d4d90a900000

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

IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
NOHZ: local_softirq_pending 08
Bluetooth: hci0 command 0x0405 tx timeout
Bluetooth: hci0 command 0x0405 tx timeout
==================================================================
BUG: KASAN: use-after-free in hci_conn_del+0x5c7/0x620 net/bluetooth/hci_conn.c:596
Write of size 8 at addr ffff888089fb9108 by task syz-executor.5/6383

CPU: 1 PID: 6383 Comm: syz-executor.5 Not tainted 4.14.192-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
hci_conn_del+0x5c7/0x620 net/bluetooth/hci_conn.c:596
hci_conn_hash_flush+0x189/0x220 net/bluetooth/hci_conn.c:1377
hci_dev_do_close+0x542/0xc50 net/bluetooth/hci_core.c:1620
hci_unregister_dev+0x170/0x7a0 net/bluetooth/hci_core.c:3191
vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xa08/0x27f0 kernel/exit.c:865
do_group_exit+0x100/0x2e0 kernel/exit.c:962
SYSC_exit_group kernel/exit.c:973 [inline]
SyS_exit_group+0x19/0x20 kernel/exit.c:971
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45ccd9
RSP: 002b:00007ffe12433c28 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045ccd9
RDX: 0000000000416731 RSI: 0000000000ca85f0 RDI: 0000000000000043
RBP: 00000000004c2963 R08: 000000000000000b R09: 0000000000000000
R10: 0000000001894940 R11: 0000000000000246 R12: 000000000000000a
R13: 00007ffe12433d70 R14: 00000000000168e9 R15: 00007ffe12433d80

Allocated by task 8627:
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
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node_track_caller+0x4c/0x70 mm/slab.c:3696
__kmalloc_reserve net/core/skbuff.c:137 [inline]
__alloc_skb+0x96/0x510 net/core/skbuff.c:205
alloc_skb include/linux/skbuff.h:980 [inline]
nlmsg_new include/net/netlink.h:511 [inline]
rtmsg_ifinfo_build_skb+0x65/0x130 net/core/rtnetlink.c:2909
rtmsg_ifinfo_event net/core/rtnetlink.c:2943 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:2934 [inline]
rtnetlink_event+0xee/0x1a0 net/core/rtnetlink.c:4360
notifier_call_chain+0x108/0x1a0 kernel/notifier.c:93
call_netdevice_notifiers_info net/core/dev.c:1667 [inline]
call_netdevice_notifiers net/core/dev.c:1683 [inline]
dev_set_mac_address net/core/dev.c:6961 [inline]
dev_set_mac_address+0x1e8/0x2d0 net/core/dev.c:6946
do_setlink+0xc58/0x2bf0 net/core/rtnetlink.c:2047
rtnl_newlink+0x1267/0x1830 net/core/rtnetlink.c:2660
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4316
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1c7/0x2c0 net/socket.c:1731
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 8627:
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
skb_free_head net/core/skbuff.c:554 [inline]
pskb_expand_head+0x895/0xd30 net/core/skbuff.c:1495
netlink_trim+0x1ae/0x220 net/netlink/af_netlink.c:1269
netlink_broadcast_filtered+0x5d/0x9e0 net/netlink/af_netlink.c:1466
netlink_broadcast net/netlink/af_netlink.c:1511 [inline]
nlmsg_multicast include/net/netlink.h:591 [inline]
nlmsg_notify+0x126/0x170 net/netlink/af_netlink.c:2476
rtnl_notify net/core/rtnetlink.c:653 [inline]
rtmsg_ifinfo_send net/core/rtnetlink.c:2931 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:2945 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:2934 [inline]
rtnetlink_event+0x15d/0x1a0 net/core/rtnetlink.c:4360
notifier_call_chain+0x108/0x1a0 kernel/notifier.c:93
call_netdevice_notifiers_info net/core/dev.c:1667 [inline]
call_netdevice_notifiers net/core/dev.c:1683 [inline]
dev_set_mac_address net/core/dev.c:6961 [inline]
dev_set_mac_address+0x1e8/0x2d0 net/core/dev.c:6946
do_setlink+0xc58/0x2bf0 net/core/rtnetlink.c:2047
rtnl_newlink+0x1267/0x1830 net/core/rtnetlink.c:2660
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4316
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1c7/0x2c0 net/socket.c:1731
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff888089fb88c0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2120 bytes inside of
4096-byte region [ffff888089fb88c0, ffff888089fb98c0)
The buggy address belongs to the page:
page:ffffea000227ee00 count:1 mapcount:0 mapping:ffff888089fb88c0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888089fb88c0 0000000000000000 0000000100000001
raw: ffffea00021e0aa0 ffffea000227efa0 ffff88812fe52dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888089fb9000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888089fb9080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888089fb9100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888089fb9180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888089fb9200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Reply all
Reply to author
Forward
0 new messages