[moderation] [bluetooth?] KASAN: slab-use-after-free Read in hci_req_sync_complete

1 view
Skip to first unread message

syzbot

unread,
May 3, 2024, 7:57:28 PMMay 3
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b947cc5bf6d7 Merge tag 'erofs-for-6.9-rc7-fixes' of git://..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=150cae87180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3310e643b6ef5d69
dashboard link: https://syzkaller.appspot.com/bug?extid=4b7b7965c8bc86c17cbd
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
CC: [johan....@gmail.com linux-b...@vger.kernel.org linux-...@vger.kernel.org luiz....@gmail.com mar...@holtmann.org]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e05b77341eca/disk-b947cc5b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ad295493d850/vmlinux-b947cc5b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e7c8f23427a9/bzImage-b947cc5b.xz

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

Bluetooth: hci2: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci2: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci2: unexpected cc 0x0c38 length: 249 > 2
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
BUG: KASAN: slab-use-after-free in refcount_read include/linux/refcount.h:136 [inline]
BUG: KASAN: slab-use-after-free in skb_unref include/linux/skbuff.h:1227 [inline]
BUG: KASAN: slab-use-after-free in __kfree_skb_reason net/core/skbuff.c:1224 [inline]
BUG: KASAN: slab-use-after-free in kfree_skb_reason+0x36/0x210 net/core/skbuff.c:1251
Read of size 4 at addr ffff8880456fc724 by task kworker/u9:3/5095

CPU: 1 PID: 5095 Comm: kworker/u9:3 Not tainted 6.9.0-rc6-syzkaller-00005-gb947cc5bf6d7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci2 hci_rx_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report+0xd9/0x110 mm/kasan/report.c:601
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
instrument_atomic_read include/linux/instrumented.h:68 [inline]
atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
refcount_read include/linux/refcount.h:136 [inline]
skb_unref include/linux/skbuff.h:1227 [inline]
__kfree_skb_reason net/core/skbuff.c:1224 [inline]
kfree_skb_reason+0x36/0x210 net/core/skbuff.c:1251
kfree_skb include/linux/skbuff.h:1262 [inline]
hci_req_sync_complete+0x16c/0x270 net/bluetooth/hci_request.c:109
hci_event_packet+0x963/0x1170 net/bluetooth/hci_event.c:7607
hci_rx_work+0x2c4/0x1610 net/bluetooth/hci_core.c:4171
process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
process_scheduled_works kernel/workqueue.c:3335 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
kthread+0x2c1/0x3a0 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>

Allocated by task 5095:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:312 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3798 [inline]
slab_alloc_node mm/slub.c:3845 [inline]
kmem_cache_alloc+0x136/0x320 mm/slub.c:3852
skb_clone+0x190/0x3f0 net/core/skbuff.c:2063
hci_send_cmd_sync net/bluetooth/hci_core.c:4220 [inline]
hci_cmd_work+0x66a/0x710 net/bluetooth/hci_core.c:4240
process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
process_scheduled_works kernel/workqueue.c:3335 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
kthread+0x2c1/0x3a0 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Freed by task 7278:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
poison_slab_object mm/kasan/common.c:240 [inline]
__kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2106 [inline]
slab_free mm/slub.c:4280 [inline]
kmem_cache_free+0x12e/0x380 mm/slub.c:4344
kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1159
__kfree_skb net/core/skbuff.c:1217 [inline]
kfree_skb_reason+0x13a/0x210 net/core/skbuff.c:1252
kfree_skb include/linux/skbuff.h:1262 [inline]
__hci_req_sync+0x61d/0x980 net/bluetooth/hci_request.c:184
hci_req_sync+0x97/0xd0 net/bluetooth/hci_request.c:206
hci_dev_cmd+0x653/0x9c0 net/bluetooth/hci_core.c:790
hci_sock_ioctl+0x4f3/0x8e0 net/bluetooth/hci_sock.c:1153
sock_do_ioctl+0x116/0x280 net/socket.c:1222
sock_ioctl+0x22e/0x6c0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl fs/ioctl.c:890 [inline]
__x64_sys_ioctl+0x193/0x220 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff8880456fc640
which belongs to the cache skbuff_head_cache of size 240
The buggy address is located 228 bytes inside of
freed 240-byte region [ffff8880456fc640, ffff8880456fc730)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x456fc
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000800 ffff888018ea9780 dead000000000122 0000000000000000
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 52, tgid 1213673302 (kworker/u9:0), ts 52, free_ts 433680424811
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534
prep_new_page mm/page_alloc.c:1541 [inline]
get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317
__alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page mm/slub.c:2175 [inline]
allocate_slab mm/slub.c:2338 [inline]
new_slab+0xcc/0x3a0 mm/slub.c:2391
___slab_alloc+0x66d/0x1790 mm/slub.c:3525
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
__slab_alloc_node mm/slub.c:3663 [inline]
slab_alloc_node mm/slub.c:3835 [inline]
kmem_cache_alloc_node+0x10a/0x340 mm/slub.c:3888
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:658
alloc_skb include/linux/skbuff.h:1313 [inline]
bt_skb_alloc include/net/bluetooth/bluetooth.h:489 [inline]
hci_si_event net/bluetooth/hci_sock.c:784 [inline]
hci_sock_dev_event+0x18e/0x610 net/bluetooth/hci_sock.c:826
hci_dev_open_sync+0xab2/0x2740 net/bluetooth/hci_sync.c:5000
hci_dev_do_open+0x2a/0x90 net/bluetooth/hci_core.c:483
hci_power_on+0x132/0x670 net/bluetooth/hci_core.c:1015
process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
process_scheduled_works kernel/workqueue.c:3335 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
kthread+0x2c1/0x3a0 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
page last free pid 4630 tgid 4630 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1141 [inline]
free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347
free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487
vfree+0x181/0x7a0 mm/vmalloc.c:3340
delayed_vfree_work+0x56/0x70 mm/vmalloc.c:3261
process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
process_scheduled_works kernel/workqueue.c:3335 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
kthread+0x2c1/0x3a0 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Memory state around the buggy address:
ffff8880456fc600: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
ffff8880456fc680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880456fc700: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
^
ffff8880456fc780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880456fc800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
==================================================================


---
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.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Jun 7, 2024, 6:46:17 PMJun 7
to syzkaller-upst...@googlegroups.com
Sending this report to the next reporting stage.
Reply all
Reply to author
Forward
0 new messages