[syzbot] [bluetooth?] KASAN: slab-out-of-bounds Read in hci_cmd_sync_alloc

8 views
Skip to first unread message

syzbot

unread,
May 4, 2025, 8:58:31 AM (8 days ago) May 4
Hello,

syzbot found the following issue on:

HEAD commit: 8bac8898fe39 Merge tag 'mmc-v6.15-rc1' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=137a0f74580000
kernel config: https://syzkaller.appspot.com/x/.config?x=541aa584278da96c
dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=102d6774580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1025f368580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-8bac8898.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5f7c2d7e1cd1/vmlinux-8bac8898.xz
kernel image: https://storage.googleapis.com/syzbot-assets/77a157d2769a/bzImage-8bac8898.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

==================================================================
BUG: KASAN: slab-out-of-bounds in skb_put_data include/linux/skbuff.h:2752 [inline]
BUG: KASAN: slab-out-of-bounds in hci_cmd_sync_alloc+0x300/0x3a0 net/bluetooth/hci_sync.c:67
Read of size 29542 at addr ffff888025996aa6 by task kworker/u33:0/68

CPU: 3 UID: 0 PID: 68 Comm: kworker/u33:0 Not tainted 6.15.0-rc4-syzkaller-00040-g8bac8898fe39 #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xc3/0x670 mm/kasan/report.c:521
kasan_report+0xe0/0x110 mm/kasan/report.c:634
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
__asan_memcpy+0x23/0x60 mm/kasan/shadow.c:105
skb_put_data include/linux/skbuff.h:2752 [inline]
hci_cmd_sync_alloc+0x300/0x3a0 net/bluetooth/hci_sync.c:67
hci_cmd_sync_add net/bluetooth/hci_sync.c:99 [inline]
__hci_cmd_sync_sk+0x157/0xc90 net/bluetooth/hci_sync.c:168
__hci_cmd_sync_ev+0x3e/0x50 net/bluetooth/hci_sync.c:250
send_hci_cmd_sync+0x18d/0x3f0 net/bluetooth/mgmt.c:2540
hci_cmd_sync_work+0x1a8/0x430 net/bluetooth/hci_sync.c:332
process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c2/0x780 kernel/kthread.c:464
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>

Allocated by task 5927:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4341 [inline]
__kmalloc_node_track_caller_noprof+0x221/0x510 mm/slub.c:4360
kmemdup_noprof+0x29/0x60 mm/util.c:137
kmemdup_noprof include/linux/fortify-string.h:765 [inline]
mgmt_pending_new+0x10b/0x290 net/bluetooth/mgmt_util.c:259
mgmt_hci_cmd_sync net/bluetooth/mgmt.c:2574 [inline]
mgmt_hci_cmd_sync+0x58/0x1c0 net/bluetooth/mgmt.c:2562
hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline]
hci_sock_sendmsg+0x151f/0x25e0 net/bluetooth/hci_sock.c:1832
sock_sendmsg_nosec net/socket.c:712 [inline]
__sock_sendmsg net/socket.c:727 [inline]
sock_write_iter+0x4fc/0x5b0 net/socket.c:1131
new_sync_write fs/read_write.c:591 [inline]
vfs_write+0x5ba/0x1180 fs/read_write.c:684
ksys_write+0x205/0x240 fs/read_write.c:736
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888025996aa0
which belongs to the cache kmalloc-8 of size 8
The buggy address is located 6 bytes inside of
allocated 7-byte region [ffff888025996aa0, ffff888025996aa7)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25996
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801b442500 dead000000000100 dead000000000122
raw: 0000000000000000 0000000080800080 00000000f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 8553722382, free_ts 0
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1718
prep_new_page mm/page_alloc.c:1726 [inline]
get_page_from_freelist+0x135c/0x3920 mm/page_alloc.c:3688
__alloc_frozen_pages_noprof+0x263/0x23a0 mm/page_alloc.c:4970
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2301
alloc_slab_page mm/slub.c:2468 [inline]
allocate_slab mm/slub.c:2632 [inline]
new_slab+0x244/0x340 mm/slub.c:2686
___slab_alloc+0xd9c/0x1940 mm/slub.c:3872
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3962
__slab_alloc_node mm/slub.c:4037 [inline]
slab_alloc_node mm/slub.c:4198 [inline]
__do_kmalloc_node mm/slub.c:4340 [inline]
__kmalloc_node_noprof+0x2ed/0x500 mm/slub.c:4347
kmalloc_array_node_noprof include/linux/slab.h:1020 [inline]
blk_mq_alloc_tag_set+0x414/0x1250 block/blk-mq.c:4788
loop_add+0x3b7/0xb70 drivers/block/loop.c:1986
loop_init+0x164/0x270 drivers/block/loop.c:2225
do_one_initcall+0x120/0x6e0 init/main.c:1257
do_initcall_level init/main.c:1319 [inline]
do_initcalls init/main.c:1335 [inline]
do_basic_setup init/main.c:1354 [inline]
kernel_init_freeable+0x5c2/0x900 init/main.c:1567
kernel_init+0x1c/0x2b0 init/main.c:1457
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
page_owner free stack trace missing

Memory state around the buggy address:
ffff888025996980: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc
ffff888025996a00: 05 fc fc fc 04 fc fc fc 04 fc fc fc 04 fc fc fc
>ffff888025996a80: 00 fc fc fc 07 fc fc fc 06 fc fc fc 06 fc fc fc
^
ffff888025996b00: 06 fc fc fc 04 fc fc fc 06 fc fc fc 02 fc fc fc
ffff888025996b80: 02 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc 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 [email protected].

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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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

Hillf Danton

unread,
May 5, 2025, 2:39:51 AM (8 days ago) May 5
On Sat, 03 May 2025 22:58:29 -0700
> syzbot found the following issue on:
>
> HEAD commit: 8bac8898fe39 Merge tag 'mmc-v6.15-rc1' of git://git.kernel..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=137a0f74580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=541aa584278da96c
> dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=102d6774580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1025f368580000

#syz test

--- x/net/bluetooth/mgmt.c
+++ y/net/bluetooth/mgmt.c
@@ -2538,7 +2538,7 @@ static int send_hci_cmd_sync(struct hci_
struct sk_buff *skb;

skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cp->opcode),
- le16_to_cpu(cp->params_len), cp->params,
+ cmd->param_len, cp->params,
cp->event, cp->timeout ?
secs_to_jiffies(cp->timeout) :
HCI_CMD_TIMEOUT);
--

syzbot

unread,
May 5, 2025, 2:54:04 AM (8 days ago) May 5
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-out-of-bounds Read in hci_cmd_sync_alloc

==================================================================
BUG: KASAN: slab-out-of-bounds in skb_put_data include/linux/skbuff.h:2752 [inline]
BUG: KASAN: slab-out-of-bounds in hci_cmd_sync_alloc+0x300/0x3a0 net/bluetooth/hci_sync.c:67
Read of size 7 at addr ffff8881071ed206 by task kworker/u33:0/67

CPU: 0 UID: 0 PID: 67 Comm: kworker/u33:0 Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xc3/0x670 mm/kasan/report.c:521
kasan_report+0xe0/0x110 mm/kasan/report.c:634
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
__asan_memcpy+0x23/0x60 mm/kasan/shadow.c:105
skb_put_data include/linux/skbuff.h:2752 [inline]
hci_cmd_sync_alloc+0x300/0x3a0 net/bluetooth/hci_sync.c:67
hci_cmd_sync_add net/bluetooth/hci_sync.c:99 [inline]
__hci_cmd_sync_sk+0x157/0xc90 net/bluetooth/hci_sync.c:168
__hci_cmd_sync_ev+0x3e/0x50 net/bluetooth/hci_sync.c:250
send_hci_cmd_sync+0x152/0x3a0 net/bluetooth/mgmt.c:2540
hci_cmd_sync_work+0x1a8/0x430 net/bluetooth/hci_sync.c:332
process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c2/0x780 kernel/kthread.c:464
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>

Allocated by task 6476:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kmalloc_node_track_caller_noprof+0x221/0x510 mm/slub.c:4346
kmemdup_noprof+0x29/0x60 mm/util.c:137
kmemdup_noprof include/linux/fortify-string.h:765 [inline]
mgmt_pending_new+0x10b/0x290 net/bluetooth/mgmt_util.c:259
mgmt_hci_cmd_sync net/bluetooth/mgmt.c:2574 [inline]
mgmt_hci_cmd_sync+0x58/0x1c0 net/bluetooth/mgmt.c:2562
hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline]
hci_sock_sendmsg+0x151f/0x25e0 net/bluetooth/hci_sock.c:1832
sock_sendmsg_nosec net/socket.c:712 [inline]
__sock_sendmsg net/socket.c:727 [inline]
sock_write_iter+0x4fc/0x5b0 net/socket.c:1131
new_sync_write fs/read_write.c:591 [inline]
vfs_write+0x5ba/0x1180 fs/read_write.c:684
ksys_write+0x205/0x240 fs/read_write.c:736
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff8881071ed200
which belongs to the cache kmalloc-8 of size 8
The buggy address is located 6 bytes inside of
allocated 7-byte region [ffff8881071ed200, ffff8881071ed207)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1071ed
anon flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 057ff00000000000 ffff88801b442500 0000000000000000 dead000000000001
raw: 0000000000000000 0000000080800080 00000000f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 9516676162, free_ts 0
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1718
prep_new_page mm/page_alloc.c:1726 [inline]
get_page_from_freelist+0x135c/0x3920 mm/page_alloc.c:3688
__alloc_frozen_pages_noprof+0x263/0x23a0 mm/page_alloc.c:4970
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2301
alloc_slab_page mm/slub.c:2450 [inline]
allocate_slab mm/slub.c:2618 [inline]
new_slab+0x244/0x340 mm/slub.c:2672
___slab_alloc+0xd9c/0x1940 mm/slub.c:3858
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3948
__slab_alloc_node mm/slub.c:4023 [inline]
slab_alloc_node mm/slub.c:4184 [inline]
__do_kmalloc_node mm/slub.c:4326 [inline]
__kmalloc_node_track_caller_noprof+0x2ee/0x510 mm/slub.c:4346
kvasprintf+0xbc/0x160 lib/kasprintf.c:25
kvasprintf_const+0x66/0x1a0 lib/kasprintf.c:49
kobject_set_name_vargs+0x5a/0x140 lib/kobject.c:274
kobject_add_varg lib/kobject.c:368 [inline]
kobject_add+0x129/0x240 lib/kobject.c:426
blk_mq_register_hctx+0x264/0x470 block/blk-mq-sysfs.c:172
blk_mq_sysfs_register+0x208/0x5f0 block/blk-mq-sysfs.c:234
blk_register_queue+0xe5/0x560 block/blk-sysfs.c:852
add_disk_fwnode+0x911/0x13a0 block/genhd.c:505
page_owner free stack trace missing

Memory state around the buggy address:
ffff8881071ed100: 07 fc fc fc 07 fc fc fc 07 fc fc fc 00 fc fc fc
ffff8881071ed180: 00 fc fc fc 06 fc fc fc 00 fc fc fc 00 fc fc fc
>ffff8881071ed200: 07 fc fc fc fa fc fc fc 03 fc fc fc 03 fc fc fc
^
ffff8881071ed280: 03 fc fc fc 03 fc fc fc 03 fc fc fc 03 fc fc fc
ffff8881071ed300: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc
==================================================================


Tested on:

commit: 92a09c47 Linux 6.15-rc5
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1524f0f4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b39cb28b0a399ed3
dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1239db68580000

Hillf Danton

unread,
May 5, 2025, 4:36:54 AM (7 days ago) May 5
On Sat, 03 May 2025 22:58:29 -0700
> syzbot found the following issue on:
>
> HEAD commit: 8bac8898fe39 Merge tag 'mmc-v6.15-rc1' of git://git.kernel..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=137a0f74580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=541aa584278da96c
> dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=102d6774580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1025f368580000

#syz test

--- x/net/bluetooth/mgmt.c
+++ y/net/bluetooth/mgmt.c
@@ -2538,7 +2538,7 @@ static int send_hci_cmd_sync(struct hci_
struct sk_buff *skb;

skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cp->opcode),
- le16_to_cpu(cp->params_len), cp->params,
+ cmd->param_len, cp->params,
cp->event, cp->timeout ?
secs_to_jiffies(cp->timeout) :
HCI_CMD_TIMEOUT);
--- x/net/bluetooth/hci_sync.c
+++ y/net/bluetooth/hci_sync.c
@@ -51,7 +51,7 @@ static void hci_cmd_sync_complete(struct
struct sk_buff *hci_cmd_sync_alloc(struct hci_dev *hdev, u16 opcode, u32 plen,
const void *param, struct sock *sk)
{
- int len = HCI_COMMAND_HDR_SIZE + plen;
+ int len = HCI_COMMAND_HDR_SIZE + plen + HCI_COMMAND_HDR_SIZE;
struct hci_command_hdr *hdr;
struct sk_buff *skb;

--

syzbot

unread,
May 5, 2025, 4:51:06 AM (7 days ago) May 5
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-out-of-bounds Read in hci_cmd_sync_alloc

==================================================================
BUG: KASAN: slab-out-of-bounds in skb_put_data include/linux/skbuff.h:2752 [inline]
BUG: KASAN: slab-out-of-bounds in hci_cmd_sync_alloc+0x300/0x3a0 net/bluetooth/hci_sync.c:67
Read of size 7 at addr ffff888025df4ee6 by task kworker/u33:1/5283

CPU: 2 UID: 0 PID: 5283 Comm: kworker/u33:1 Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0 PREEMPT(full)
Allocated by task 6492:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kmalloc_node_track_caller_noprof+0x221/0x510 mm/slub.c:4346
kmemdup_noprof+0x29/0x60 mm/util.c:137
kmemdup_noprof include/linux/fortify-string.h:765 [inline]
mgmt_pending_new+0x10b/0x290 net/bluetooth/mgmt_util.c:259
mgmt_hci_cmd_sync net/bluetooth/mgmt.c:2574 [inline]
mgmt_hci_cmd_sync+0x58/0x1c0 net/bluetooth/mgmt.c:2562
hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline]
hci_sock_sendmsg+0x151f/0x25e0 net/bluetooth/hci_sock.c:1832
sock_sendmsg_nosec net/socket.c:712 [inline]
__sock_sendmsg net/socket.c:727 [inline]
sock_write_iter+0x4fc/0x5b0 net/socket.c:1131
new_sync_write fs/read_write.c:591 [inline]
vfs_write+0x5ba/0x1180 fs/read_write.c:684
ksys_write+0x205/0x240 fs/read_write.c:736
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888025df4ee0
which belongs to the cache kmalloc-8 of size 8
The buggy address is located 6 bytes inside of
allocated 7-byte region [ffff888025df4ee0, ffff888025df4ee7)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25df4
anon flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801b442500 0000000000000000 dead000000000001
raw: 0000000000000000 0000000080800080 00000000f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 8545114296, free_ts 0
ffff888025df4d80: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc
ffff888025df4e00: 05 fc fc fc 05 fc fc fc 05 fc fc fc 07 fc fc fc
>ffff888025df4e80: 07 fc fc fc 07 fc fc fc 00 fc fc fc 07 fc fc fc
^
ffff888025df4f00: 06 fc fc fc 02 fc fc fc 02 fc fc fc 05 fc fc fc
ffff888025df4f80: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc
==================================================================


Tested on:

commit: 92a09c47 Linux 6.15-rc5
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=145bdb68580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b39cb28b0a399ed3
dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1325b8d4580000

Hillf Danton

unread,
May 5, 2025, 7:52:10 AM (7 days ago) May 5
On Sat, 03 May 2025 22:58:29 -0700
> syzbot found the following issue on:
>
> HEAD commit: 8bac8898fe39 Merge tag 'mmc-v6.15-rc1' of git://git.kernel..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=137a0f74580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=541aa584278da96c
> dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=102d6774580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1025f368580000

#syz test

--- x/net/bluetooth/mgmt.c
+++ y/net/bluetooth/mgmt.c
@@ -2538,7 +2538,7 @@ static int send_hci_cmd_sync(struct hci_
struct sk_buff *skb;

skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cp->opcode),
- le16_to_cpu(cp->params_len), cp->params,
+ cmd->param_len, cmd->param,

syzbot

unread,
May 5, 2025, 8:23:04 AM (7 days ago) May 5
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
INFO: task hung in hci_cmd_sync_clear

INFO: task syz-executor:6385 blocked for more than 143 seconds.
Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0
Blocked by coredump.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor state:D stack:23880 pid:6385 tgid:6385 ppid:1 task_flags:0x40054c flags:0x00004006
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5382 [inline]
__schedule+0x116f/0x5de0 kernel/sched/core.c:6767
__schedule_loop kernel/sched/core.c:6845 [inline]
schedule+0xe7/0x3a0 kernel/sched/core.c:6860
schedule_timeout+0x257/0x290 kernel/time/sleep_timeout.c:75
do_wait_for_common kernel/sched/completion.c:95 [inline]
__wait_for_common+0x2fc/0x4e0 kernel/sched/completion.c:116
__flush_work+0x7d7/0xcc0 kernel/workqueue.c:4244
__cancel_work_sync+0x10c/0x130 kernel/workqueue.c:4364
hci_cmd_sync_clear+0x33/0x100 net/bluetooth/hci_sync.c:655
hci_unregister_dev+0x1b8/0x620 net/bluetooth/hci_core.c:2674
vhci_release+0x79/0xf0 drivers/bluetooth/hci_vhci.c:665
__fput+0x3ff/0xb70 fs/file_table.c:465
task_work_run+0x14d/0x240 kernel/task_work.c:227
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0xafb/0x2c30 kernel/exit.c:953
do_group_exit+0xd3/0x2a0 kernel/exit.c:1102
get_signal+0x2673/0x26d0 kernel/signal.c:3034
arch_do_signal_or_restart+0x8f/0x7d0 arch/x86/kernel/signal.c:337
exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218
do_syscall_64+0xda/0x260 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4ebbb8d2d0
RSP: 002b:00007ffd82122880 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: 0000000000000003 RBX: 0000000000000002 RCX: 00007f4ebbb8d2d0
RDX: 0000000000000002 RSI: 00007ffd82122990 RDI: 00000000ffffff9c
RBP: 00007ffd82122990 R08: 0000000000000000 R09: 00007ffd82122647
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000258
R13: 00000000000927c0 R14: 000000000002393a R15: 00007ffd82122990
</TASK>

Showing all locks held in the system:
1 lock held by khungtaskd/41:
#0: ffffffff8e3bf5c0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
#0: ffffffff8e3bf5c0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline]
#0: ffffffff8e3bf5c0 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x36/0x1c0 kernel/locking/lockdep.c:6764
2 locks held by getty/5727:
#0: ffff8880276460a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x24/0x80 drivers/tty/tty_ldisc.c:243
#1: ffffc9000343b2f0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x41b/0x14f0 drivers/tty/n_tty.c:2222
3 locks held by kworker/u33:2/5995:
#0: ffff88804e1bd148 ((wq_completion)hci0){+.+.}-{0:0}, at: process_one_work+0x12a2/0x1b70 kernel/workqueue.c:3213
#1: ffffc900016cfd18 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: process_one_work+0x929/0x1b70 kernel/workqueue.c:3214
#2: ffff888035efcd80 (&hdev->req_lock){+.+.}-{4:4}, at: hci_cmd_sync_work+0x175/0x430 net/bluetooth/hci_sync.c:331
2 locks held by syz-executor/11948:

=============================================

NMI backtrace for cpu 2
CPU: 2 UID: 0 PID: 41 Comm: khungtaskd Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
nmi_cpu_backtrace+0x27b/0x390 lib/nmi_backtrace.c:113
nmi_trigger_cpumask_backtrace+0x29c/0x300 lib/nmi_backtrace.c:62
trigger_all_cpu_backtrace include/linux/nmi.h:158 [inline]
check_hung_uninterruptible_tasks kernel/hung_task.c:274 [inline]
watchdog+0xf70/0x12c0 kernel/hung_task.c:437
kthread+0x3c2/0x780 kernel/kthread.c:464
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Sending NMI from CPU 2 to CPUs 0-1,3:
NMI backtrace for cpu 3
CPU: 3 UID: 0 PID: 64 Comm: kworker/u32:3 Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: bat_events batadv_nc_worker
RIP: 0010:hlock_class kernel/locking/lockdep.c:245 [inline]
RIP: 0010:mark_lock+0x63/0x610 kernel/locking/lockdep.c:4732
Code: 6d 41 bd 01 00 00 00 89 d9 41 d3 e5 4d 63 ed 41 0f b7 44 24 20 66 25 ff 1f 0f b7 c0 48 0f a3 05 73 d6 12 14 0f 83 86 00 00 00 <48> 8d 04 80 48 8d 04 80 48 8d 04 c5 60 bf aa 95 4c 89 ea 48 23 50
RSP: 0018:ffffc90000b5f940 EFLAGS: 00000003
RAX: 0000000000000007 RBX: 0000000000000009 RCX: 0000000000000000
RDX: 0000000000000008 RSI: ffff8880205e0b40 RDI: ffff8880205e0000
RBP: ffffc90000b5f9d8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: ffffffff8e3bf5c0 R12: ffff8880205e0b40
R13: 0000000000000200 R14: ffff8880205e0000 R15: ffff8880205e0000
FS: 0000000000000000(0000) GS:ffff8880d6cdf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2e75ffff CR3: 000000002e962000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
mark_usage kernel/locking/lockdep.c:4675 [inline]
__lock_acquire+0x499/0x1ba0 kernel/locking/lockdep.c:5189
lock_acquire kernel/locking/lockdep.c:5866 [inline]
lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5823
rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
rcu_read_lock include/linux/rcupdate.h:841 [inline]
batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:408 [inline]
batadv_nc_worker+0x16a/0x1030 net/batman-adv/network-coding.c:719
process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c2/0x780 kernel/kthread.c:464
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:81
Code: 15 62 02 c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 73 1a 1d 00 fb f4 <c3> cc cc cc cc 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90
RSP: 0018:ffffffff8e007e10 EFLAGS: 00000286
RAX: 0000000000353fd5 RBX: 0000000000000000 RCX: ffffffff8b6cd419
RDX: 0000000000000000 RSI: ffffffff8dbe124f RDI: ffffffff8bf482e0
RBP: fffffbfff1c12ee8 R08: 0000000000000001 R09: ffffed100d4865bd
R10: ffff88806a432deb R11: 0000000000000000 R12: 0000000000000000
R13: ffffffff8e097740 R14: ffffffff90850510 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8880d69df000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000030b80000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
arch_safe_halt arch/x86/include/asm/paravirt.h:107 [inline]
default_idle+0x13/0x20 arch/x86/kernel/process.c:748
default_idle_call+0x6d/0xb0 kernel/sched/idle.c:117
cpuidle_idle_call kernel/sched/idle.c:185 [inline]
do_idle+0x391/0x510 kernel/sched/idle.c:325
cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:423
rest_init+0x16b/0x2b0 init/main.c:743
start_kernel+0x3e9/0x4d0 init/main.c:1099
x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:513
x86_64_start_kernel+0xb0/0xc0 arch/x86/kernel/head64.c:494
common_startup_64+0x13e/0x148
</TASK>
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.15.0-rc5-syzkaller-g92a09c47464d-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:81
Code: 15 62 02 c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 73 1a 1d 00 fb f4 <c3> cc cc cc cc 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90
RSP: 0018:ffffc90000177df8 EFLAGS: 00000286
RAX: 00000000003033b7 RBX: 0000000000000001 RCX: ffffffff8b6cd419
RDX: 0000000000000000 RSI: ffffffff8dbe124f RDI: ffffffff8bf482e0
RBP: ffffed1003ad0488 R08: 0000000000000001 R09: ffffed100d4a65bd
R10: ffff88806a532deb R11: 0000000000000000 R12: 0000000000000001
R13: ffff88801d682440 R14: ffffffff90850510 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8880d6adf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2e75ffff CR3: 000000004c951000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
arch_safe_halt arch/x86/include/asm/paravirt.h:107 [inline]
default_idle+0x13/0x20 arch/x86/kernel/process.c:748
default_idle_call+0x6d/0xb0 kernel/sched/idle.c:117
cpuidle_idle_call kernel/sched/idle.c:185 [inline]
do_idle+0x391/0x510 kernel/sched/idle.c:325
cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:423
start_secondary+0x21d/0x2b0 arch/x86/kernel/smpboot.c:315
common_startup_64+0x13e/0x148
</TASK>


Tested on:

commit: 92a09c47 Linux 6.15-rc5
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10c1d0f4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b39cb28b0a399ed3
dashboard link: https://syzkaller.appspot.com/bug?extid=5fe2d5bfbfbec0b675a0
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13eff0f4580000

Reply all
Reply to author
Forward
0 new messages