[v6.1] BUG: sleeping function called from invalid context in hci_cmd_sync_submit

2 views
Skip to first unread message

syzbot

unread,
Mar 26, 2024, 8:47:19 PMMar 26
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e5cd595e23c1 Linux 6.1.83
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10660546180000
kernel config: https://syzkaller.appspot.com/x/.config?x=99d0cbbc2b2c7cfd
dashboard link: https://syzkaller.appspot.com/bug?extid=1fb5ed3cdea3397c1010
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/cd28292a2eef/disk-e5cd595e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e8297fd856b2/vmlinux-e5cd595e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ea8c74634429/bzImage-e5cd595e.xz

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

Bluetooth: hci1: link tx timeout
Bluetooth: hci1: killing stalled connection 11:aa:aa:aa:aa:aa
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 3567, name: kworker/u5:1
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
3 locks held by kworker/u5:1/3567:
#0: ffff88807c139138 ((wq_completion)hci1#2){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267
#1: ffffc900045bfd20 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: hci_link_tx_to net/bluetooth/hci_core.c:3448 [inline]
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: __check_timeout+0x181/0x460 net/bluetooth/hci_core.c:3601
CPU: 0 PID: 3567 Comm: kworker/u5:1 Not tainted 6.1.83-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: hci1 hci_tx_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
__might_resched+0x5cb/0x780 kernel/sched/core.c:9942
__mutex_lock_common kernel/locking/mutex.c:580 [inline]
__mutex_lock+0xbd/0xd80 kernel/locking/mutex.c:747
hci_cmd_sync_submit+0x3b/0x2e0 net/bluetooth/hci_sync.c:699
hci_disconnect+0xe6/0x2c0 net/bluetooth/hci_conn.c:255
hci_link_tx_to net/bluetooth/hci_core.c:3455 [inline]
__check_timeout+0x333/0x460 net/bluetooth/hci_core.c:3601
hci_sched_le net/bluetooth/hci_core.c:3784 [inline]
hci_tx_work+0x138b/0x1ec0 net/bluetooth/hci_core.c:3862
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307
</TASK>

=============================
[ BUG: Invalid wait context ]
6.1.83-syzkaller #0 Tainted: G W
-----------------------------
kworker/u5:1/3567 is trying to lock:
ffff88807c4a89b0 (&hdev->unregister_lock){+.+.}-{3:3}, at: hci_cmd_sync_submit+0x3b/0x2e0 net/bluetooth/hci_sync.c:699
other info that might help us debug this:
context-{4:4}
3 locks held by kworker/u5:1/3567:
#0: ffff88807c139138 ((wq_completion)hci1#2){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267
#1: ffffc900045bfd20 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: hci_link_tx_to net/bluetooth/hci_core.c:3448 [inline]
#2: ffffffff8d12a940 (rcu_read_lock){....}-{1:2}, at: __check_timeout+0x181/0x460 net/bluetooth/hci_core.c:3601
stack backtrace:
CPU: 0 PID: 3567 Comm: kworker/u5:1 Tainted: G W 6.1.83-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: hci1 hci_tx_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_lock_invalid_wait_context kernel/locking/lockdep.c:4701 [inline]
check_wait_context kernel/locking/lockdep.c:4762 [inline]
__lock_acquire+0x14b1/0x1f80 kernel/locking/lockdep.c:4999
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
hci_cmd_sync_submit+0x3b/0x2e0 net/bluetooth/hci_sync.c:699
hci_disconnect+0xe6/0x2c0 net/bluetooth/hci_conn.c:255
hci_link_tx_to net/bluetooth/hci_core.c:3455 [inline]
__check_timeout+0x333/0x460 net/bluetooth/hci_core.c:3601
hci_sched_le net/bluetooth/hci_core.c:3784 [inline]
hci_tx_work+0x138b/0x1ec0 net/bluetooth/hci_core.c:3862
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307
</TASK>
Bluetooth: hci1: command 0x0406 tx timeout
Bluetooth: hci3: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci3: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci3: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci3: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci3: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci3: unexpected cc 0x0c38 length: 249 > 2


---
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,
Mar 27, 2024, 1:39:19 AMMar 27
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e5cd595e23c1 Linux 6.1.83
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1744bd79180000
kernel config: https://syzkaller.appspot.com/x/.config?x=638c7154137d2582
dashboard link: https://syzkaller.appspot.com/bug?extid=1fb5ed3cdea3397c1010
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=149622a5180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1640cc81180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a9b3de36bd43/disk-e5cd595e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2af9bc6e6ea4/vmlinux-e5cd595e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7f58381bafc0/Image-e5cd595e.gz.xz

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

Bluetooth: Wrong link type (-71)
Bluetooth: Wrong link type (-71)
Bluetooth: hci0: link tx timeout
Bluetooth: hci0: killing stalled connection 11:aa:aa:aa:aa:aa
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 47, name: kworker/u5:0
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
3 locks held by kworker/u5:0/47:
#0: ffff0000d5e0e138 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x664/0x1404 kernel/workqueue.c:2265
#1: ffff80001b327c20 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}, at: process_one_work+0x6a8/0x1404 kernel/workqueue.c:2267
#2: ffff800015a14ca0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:349
CPU: 1 PID: 47 Comm: kworker/u5:0 Not tainted 6.1.83-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: hci0 hci_tx_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
dump_stack+0x1c/0x5c lib/dump_stack.c:113
__might_resched+0x37c/0x4d8 kernel/sched/core.c:9942
__might_sleep+0x90/0xe4 kernel/sched/core.c:9871
__mutex_lock_common+0xcc/0x21a0 kernel/locking/mutex.c:580
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
hci_cmd_sync_submit+0x4c/0x230 net/bluetooth/hci_sync.c:699
hci_cmd_sync_queue+0x84/0x9c net/bluetooth/hci_sync.c:739
hci_abort_conn+0x19c/0x2f8 net/bluetooth/hci_conn.c:2821
hci_disconnect+0xe4/0x288 net/bluetooth/hci_conn.c:255
hci_link_tx_to net/bluetooth/hci_core.c:3455 [inline]
__check_timeout+0x2d8/0x3fc net/bluetooth/hci_core.c:3601
hci_sched_le net/bluetooth/hci_core.c:3784 [inline]
hci_tx_work+0xf84/0x18e4 net/bluetooth/hci_core.c:3862
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

=============================
[ BUG: Invalid wait context ]
6.1.83-syzkaller #0 Tainted: G W
-----------------------------
kworker/u5:0/47 is trying to lock:
ffff0000d561c9b0 (&hdev->unregister_lock){+.+.}-{3:3}, at: hci_cmd_sync_submit+0x4c/0x230 net/bluetooth/hci_sync.c:699
other info that might help us debug this:
context-{4:4}
3 locks held by kworker/u5:0/47:
#0: ffff0000d5e0e138 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x664/0x1404 kernel/workqueue.c:2265
#1: ffff80001b327c20 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}, at: process_one_work+0x6a8/0x1404 kernel/workqueue.c:2267
#2: ffff800015a14ca0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:349
stack backtrace:
CPU: 1 PID: 47 Comm: kworker/u5:0 Tainted: G W 6.1.83-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: hci0 hci_tx_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
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_lock_invalid_wait_context kernel/locking/lockdep.c:4701 [inline]
check_wait_context kernel/locking/lockdep.c:4762 [inline]
__lock_acquire+0x1b14/0x7680 kernel/locking/lockdep.c:4999
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
hci_cmd_sync_submit+0x4c/0x230 net/bluetooth/hci_sync.c:699
hci_cmd_sync_queue+0x84/0x9c net/bluetooth/hci_sync.c:739
hci_abort_conn+0x19c/0x2f8 net/bluetooth/hci_conn.c:2821
hci_disconnect+0xe4/0x288 net/bluetooth/hci_conn.c:255
hci_link_tx_to net/bluetooth/hci_core.c:3455 [inline]
__check_timeout+0x2d8/0x3fc net/bluetooth/hci_core.c:3601
hci_sched_le net/bluetooth/hci_core.c:3784 [inline]
hci_tx_work+0xf84/0x18e4 net/bluetooth/hci_core.c:3862
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


---
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.
Reply all
Reply to author
Forward
0 new messages