[v6.1] KASAN: use-after-free Read in l2cap_connect_cfm

4 views
Skip to first unread message

syzbot

unread,
Oct 19, 2024, 12:09:28 AM10/19/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 54d90d17e8ce Linux 6.1.113
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=109fbc5f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=a9803325dabd971a
dashboard link: https://syzkaller.appspot.com/bug?extid=45bb087e690ccd9196bf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/640125ffcb56/disk-54d90d17.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7431c068fee3/vmlinux-54d90d17.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a421b2bfbc79/Image-54d90d17.gz.xz

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

kobject_add_internal failed for hci2:201 with -EEXIST, don't try to register things with the same name in the same directory.
Bluetooth: hci2: failed to register connection device
==================================================================
BUG: KASAN: use-after-free in l2cap_connect_cfm+0x5c4/0xe5c net/bluetooth/l2cap_core.c:8343
Read of size 8 at addr ffff0000db2a6498 by task kworker/u5:5/4307

CPU: 0 PID: 4307 Comm: kworker/u5:5 Not tainted 6.1.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: hci2 hci_rx_work
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:395
kasan_report+0xd4/0x130 mm/kasan/report.c:495
__asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
l2cap_connect_cfm+0x5c4/0xe5c net/bluetooth/l2cap_core.c:8343
hci_connect_cfm+0xa0/0x138 include/net/bluetooth/hci_core.h:1788
le_conn_complete_evt+0xa88/0xfe0 net/bluetooth/hci_event.c:6008
hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:6034
hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7203
hci_event_func net/bluetooth/hci_event.c:7533 [inline]
hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7588
hci_rx_work+0x318/0xa68 net/bluetooth/hci_core.c:4100
process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Allocated by task 4307:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
kmalloc_trace+0x7c/0x94 mm/slab_common.c:1031
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:693 [inline]
l2cap_chan_create+0x58/0x6a0 net/bluetooth/l2cap_core.c:469
l2cap_sock_alloc net/bluetooth/l2cap_sock.c:1920 [inline]
l2cap_sock_new_connection_cb+0x160/0x280 net/bluetooth/l2cap_sock.c:1502
l2cap_connect_cfm+0x2fc/0xe5c net/bluetooth/l2cap_core.c:8326
hci_connect_cfm+0xa0/0x138 include/net/bluetooth/hci_core.h:1788
le_conn_complete_evt+0xa88/0xfe0 net/bluetooth/hci_event.c:6008
hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:6034
hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7203
hci_event_func net/bluetooth/hci_event.c:7533 [inline]
hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7588
hci_rx_work+0x318/0xa68 net/bluetooth/hci_core.c:4100
process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Freed by task 5928:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
kfree+0xcc/0x1b8 mm/slab_common.c:988
l2cap_chan_destroy net/bluetooth/l2cap_core.c:515 [inline]
kref_put include/linux/kref.h:65 [inline]
l2cap_chan_put+0x174/0x254 net/bluetooth/l2cap_core.c:539
l2cap_sock_cleanup_listen+0x108/0x290 net/bluetooth/l2cap_sock.c:1485
l2cap_sock_release+0x5c/0x1b4 net/bluetooth/l2cap_sock.c:1445
__sock_release net/socket.c:654 [inline]
sock_close+0xb8/0x1fc net/socket.c:1400
__fput+0x1c8/0x7c8 fs/file_table.c:320
____fput+0x20/0x30 fs/file_table.c:348
task_work_run+0x240/0x2f0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x2148/0x3474 arch/arm64/kernel/signal.c:1132
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000db2a6000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1176 bytes inside of
2048-byte region [ffff0000db2a6000, ffff0000db2a6800)

The buggy address belongs to the physical page:
page:000000008104bb4d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11b2a0
head:000000008104bb4d order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0002900
raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000db2a6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000db2a6400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000db2a6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000db2a6500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000db2a6580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Unable to handle kernel paging request at virtual address fbd51fffffffff90
KASAN: maybe wild-memory-access in range [0xdeacfffffffffc80-0xdeacfffffffffc87]
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
[fbd51fffffffff90] address between user and kernel address ranges
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 4307 Comm: kworker/u5:5 Tainted: G B 6.1.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: hci2 hci_rx_work
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : atomic_read include/linux/atomic/atomic-instrumented.h:28 [inline]
pc : l2cap_chan_lock include/net/bluetooth/l2cap.h:863 [inline]
pc : l2cap_conn_ready net/bluetooth/l2cap_core.c:1782 [inline]
pc : l2cap_connect_cfm+0x530/0xe5c net/bluetooth/l2cap_core.c:8343
lr : instrument_atomic_read include/linux/instrumented.h:72 [inline]
lr : atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline]
lr : l2cap_chan_lock include/net/bluetooth/l2cap.h:863 [inline]
lr : l2cap_conn_ready net/bluetooth/l2cap_core.c:1782 [inline]
lr : l2cap_connect_cfm+0x52c/0xe5c net/bluetooth/l2cap_core.c:8343
sp : ffff8000211a75a0
x29: ffff8000211a7640 x28: ffff0000db2a6000 x27: ffff0000cd7864c8
x26: dfff800000000000 x25: ffff0000db2a64c8 x24: ffff0000c464681a
x23: dead000000000100 x22: ffff0000c4646a60 x21: 1fffe0001a487c07
x20: ffff0000d243e039 x19: deacfffffffffc84 x18: 1fffe0003679f176
x17: ffff8000159cd000 x16: ffff80000897acec x15: ffff0001b3cf8bbc
x14: ffff0001b3cf8bb8 x13: 1fffe0003679f176 x12: 0000000000100000
x11: 0000000000048d96 x10: ffff80002ee5a000 x9 : ffff80001cbd8990
x8 : 1bd59fffffffff90 x7 : 1fffe0003679f177 x6 : ffff80000827d390
x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff800011532704
x2 : 0000000000000000 x1 : 0000000000000004 x0 : 0000000000000001
Call trace:
atomic_read include/linux/atomic/atomic-instrumented.h:28 [inline]
l2cap_chan_lock include/net/bluetooth/l2cap.h:863 [inline]
l2cap_conn_ready net/bluetooth/l2cap_core.c:1782 [inline]
l2cap_connect_cfm+0x530/0xe5c net/bluetooth/l2cap_core.c:8343
hci_connect_cfm+0xa0/0x138 include/net/bluetooth/hci_core.h:1788
le_conn_complete_evt+0xa88/0xfe0 net/bluetooth/hci_event.c:6008
hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:6034
hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7203
hci_event_func net/bluetooth/hci_event.c:7533 [inline]
hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7588
hci_rx_work+0x318/0xa68 net/bluetooth/hci_core.c:4100
process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864
Code: 52800081 aa1303e0 97a727b6 d343fe68 (38fa6908)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: 52800081 mov w1, #0x4 // #4
4: aa1303e0 mov x0, x19
8: 97a727b6 bl 0xfffffffffe9c9ee0
c: d343fe68 lsr x8, x19, #3
* 10: 38fa6908 ldrsb w8, [x8, x26] <-- trapping instruction


---
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,
Sep 5, 2025, 5:35:17 PM9/5/25
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages