All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+10bd8fe6741eedd2be2e@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, lizhi.xu@windriver.com,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] BUG: corrupted list in hci_chan_del (2)
Date: Thu, 06 Feb 2025 23:02:02 -0800	[thread overview]
Message-ID: <67a5afea.050a0220.2b1e6.0014.GAE@google.com> (raw)
In-Reply-To: <20250207063721.244699-1-lizhi.xu@windriver.com>

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in l2cap_sock_shutdown

======================================================
WARNING: possible circular locking dependency detected
6.14.0-rc1-next-20250207-syzkaller-02219-ged58d103e6da-dirty #0 Not tainted
------------------------------------------------------
syz.0.16/6578 is trying to acquire lock:
ffff888012844078 (&hdev->lock){+.+.}-{4:4}, at: l2cap_sock_shutdown+0xa41/0x10c0 net/bluetooth/l2cap_sock.c:1363

but task is already holding lock:
ffff888079163518 (&chan->lock/1){+.+.}-{4:4}, at: l2cap_chan_lock include/net/bluetooth/l2cap.h:827 [inline]
ffff888079163518 (&chan->lock/1){+.+.}-{4:4}, at: l2cap_sock_shutdown+0x9c9/0x10c0 net/bluetooth/l2cap_sock.c:1360

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&chan->lock/1){+.+.}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19c/0x1010 kernel/locking/mutex.c:730
       l2cap_chan_connect+0x7e7/0xeb0 net/bluetooth/l2cap_core.c:7084
       l2cap_sock_connect+0x5c9/0x800 net/bluetooth/l2cap_sock.c:256
       __sys_connect_file net/socket.c:2045 [inline]
       __sys_connect+0x288/0x2d0 net/socket.c:2064
       __do_sys_connect net/socket.c:2070 [inline]
       __se_sys_connect net/socket.c:2067 [inline]
       __x64_sys_connect+0x7a/0x90 net/socket.c:2067
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&conn->chan_lock){+.+.}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19c/0x1010 kernel/locking/mutex.c:730
       l2cap_conn_ready net/bluetooth/l2cap_core.c:1627 [inline]
       l2cap_connect_cfm+0x5b4/0x1090 net/bluetooth/l2cap_core.c:7288
       hci_connect_cfm include/net/bluetooth/hci_core.h:2051 [inline]
       hci_remote_features_evt+0x68e/0xac0 net/bluetooth/hci_event.c:3726
       hci_event_func net/bluetooth/hci_event.c:7473 [inline]
       hci_event_packet+0xac2/0x1540 net/bluetooth/hci_event.c:7525
       hci_rx_work+0x3f3/0xdb0 net/bluetooth/hci_core.c:4015
       process_one_work kernel/workqueue.c:3236 [inline]
       process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3317
       worker_thread+0x870/0xd30 kernel/workqueue.c:3398
       kthread+0x7a9/0x920 kernel/kthread.c:464
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

-> #0 (&hdev->lock){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3163 [inline]
       check_prevs_add kernel/locking/lockdep.c:3282 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3906
       __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5228
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19c/0x1010 kernel/locking/mutex.c:730
       l2cap_sock_shutdown+0xa41/0x10c0 net/bluetooth/l2cap_sock.c:1363
       l2cap_sock_release+0x79/0x1d0 net/bluetooth/l2cap_sock.c:1419
       __sock_release net/socket.c:647 [inline]
       sock_close+0xbc/0x240 net/socket.c:1398
       __fput+0x3e9/0x9f0 fs/file_table.c:464
       task_work_run+0x24f/0x310 kernel/task_work.c:227
       get_signal+0x15f7/0x1750 kernel/signal.c:2809
       arch_do_signal_or_restart+0x96/0x860 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+0xce/0x340 kernel/entry/common.c:218
       do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &hdev->lock --> &conn->chan_lock --> &chan->lock/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&chan->lock/1);
                               lock(&conn->chan_lock);
                               lock(&chan->lock/1);
  lock(&hdev->lock);

 *** DEADLOCK ***

2 locks held by syz.0.16/6578:
 #0: ffff888079a38e08 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:877 [inline]
 #0: ffff888079a38e08 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: __sock_release net/socket.c:646 [inline]
 #0: ffff888079a38e08 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: sock_close+0x90/0x240 net/socket.c:1398
 #1: ffff888079163518 (&chan->lock/1){+.+.}-{4:4}, at: l2cap_chan_lock include/net/bluetooth/l2cap.h:827 [inline]
 #1: ffff888079163518 (&chan->lock/1){+.+.}-{4:4}, at: l2cap_sock_shutdown+0x9c9/0x10c0 net/bluetooth/l2cap_sock.c:1360

stack backtrace:
CPU: 0 UID: 0 PID: 6578 Comm: syz.0.16 Not tainted 6.14.0-rc1-next-20250207-syzkaller-02219-ged58d103e6da-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2076
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2208
 check_prev_add kernel/locking/lockdep.c:3163 [inline]
 check_prevs_add kernel/locking/lockdep.c:3282 [inline]
 validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3906
 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5228
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0x19c/0x1010 kernel/locking/mutex.c:730
 l2cap_sock_shutdown+0xa41/0x10c0 net/bluetooth/l2cap_sock.c:1363
 l2cap_sock_release+0x79/0x1d0 net/bluetooth/l2cap_sock.c:1419
 __sock_release net/socket.c:647 [inline]
 sock_close+0xbc/0x240 net/socket.c:1398
 __fput+0x3e9/0x9f0 fs/file_table.c:464
 task_work_run+0x24f/0x310 kernel/task_work.c:227
 get_signal+0x15f7/0x1750 kernel/signal.c:2809
 arch_do_signal_or_restart+0x96/0x860 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+0xce/0x340 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f32d118cda9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f32d1fa9038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: fffffffffffffffc RBX: 00007f32d13a5fa0 RCX: 00007f32d118cda9
RDX: 000000000000000e RSI: 0000000020000100 RDI: 0000000000000004
RBP: 00007f32d120e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f32d13a5fa0 R15: 00007ffc760ea6e8
 </TASK>


Tested on:

commit:         ed58d103 Add linux-next specific files for 20250207
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11db0b18580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=244a34ec1429746
dashboard link: https://syzkaller.appspot.com/bug?extid=10bd8fe6741eedd2be2e
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=13381df8580000


       reply	other threads:[~2025-02-07  7:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250207063721.244699-1-lizhi.xu@windriver.com>
2025-02-07  7:02 ` syzbot [this message]
     [not found] <CABBYNZ+usqU-KkdF=47qLh4u19zu_ao9U3tVXwAJyUZ5OkgmYw@mail.gmail.com>
2025-02-07 17:31 ` [syzbot] [bluetooth?] BUG: corrupted list in hci_chan_del (2) syzbot
     [not found] <CABBYNZKiusks5ggjr_ZjidreAt=f89zNcpACjEhw-D_zBPUHVg@mail.gmail.com>
2025-02-07 16:40 ` syzbot
     [not found] <20250207122525.2703519-1-lizhi.xu@windriver.com>
2025-02-07 13:00 ` syzbot
     [not found] <20250207040929.2197410-1-lizhi.xu@windriver.com>
2025-02-07  4:43 ` syzbot
     [not found] <20250207022033.2444682-1-lizhi.xu@windriver.com>
2025-02-07  2:56 ` syzbot
     [not found] <CABBYNZJ2bCo7-g75BZbP8Ch3FUVzLhXe05EonigSThuVyzfhLg@mail.gmail.com>
2025-02-06 22:37 ` syzbot
2025-02-06 13:10 syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67a5afea.050a0220.2b1e6.0014.GAE@google.com \
    --to=syzbot+10bd8fe6741eedd2be2e@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.xu@windriver.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.