syzbot


possible deadlock in raw_bind

Status: fixed on 2023/10/12 12:48
Subsystems: can
[Documentation on labels]
Fix commit: 11c9027c983e can: raw: fix lockdep issue in raw_release()
First crash: 309d, last: 296d

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.5.0-rc3-syzkaller-00044-g0a8db05b571a #0 Not tainted
------------------------------------------------------
syz-executor.0/32021 is trying to acquire lock:
ffff88807bcca130 (sk_lock-AF_CAN){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1708 [inline]
ffff88807bcca130 (sk_lock-AF_CAN){+.+.}-{0:0}, at: raw_bind+0xb1/0xab0 net/can/raw.c:435

but task is already holding lock:
ffffffff8e3df528 (rtnl_mutex){+.+.}-{3:3}, at: raw_bind+0xa7/0xab0 net/can/raw.c:434

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (rtnl_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x181/0x1340 kernel/locking/mutex.c:747
       raw_release+0x1c6/0x9b0 net/can/raw.c:391
       __sock_release+0xcd/0x290 net/socket.c:654
       sock_close+0x1c/0x20 net/socket.c:1386
       __fput+0x3fd/0xac0 fs/file_table.c:384
       task_work_run+0x14d/0x240 kernel/task_work.c:179
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
       exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
       __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
       syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
       do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (sk_lock-AF_CAN){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3142 [inline]
       check_prevs_add kernel/locking/lockdep.c:3261 [inline]
       validate_chain kernel/locking/lockdep.c:3876 [inline]
       __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5144
       lock_acquire kernel/locking/lockdep.c:5761 [inline]
       lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3492
       lock_sock include/net/sock.h:1708 [inline]
       raw_bind+0xb1/0xab0 net/can/raw.c:435
       __sys_bind+0x1ec/0x220 net/socket.c:1792
       __do_sys_bind net/socket.c:1803 [inline]
       __se_sys_bind net/socket.c:1801 [inline]
       __x64_sys_bind+0x72/0xb0 net/socket.c:1801
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(rtnl_mutex);
                               lock(sk_lock-AF_CAN);
                               lock(rtnl_mutex);
  lock(sk_lock-AF_CAN);

 *** DEADLOCK ***

1 lock held by syz-executor.0/32021:
 #0: ffffffff8e3df528 (rtnl_mutex){+.+.}-{3:3}, at: raw_bind+0xa7/0xab0 net/can/raw.c:434

stack backtrace:
CPU: 0 PID: 32021 Comm: syz-executor.0 Not tainted 6.5.0-rc3-syzkaller-00044-g0a8db05b571a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 check_noncircular+0x311/0x3f0 kernel/locking/lockdep.c:2195
 check_prev_add kernel/locking/lockdep.c:3142 [inline]
 check_prevs_add kernel/locking/lockdep.c:3261 [inline]
 validate_chain kernel/locking/lockdep.c:3876 [inline]
 __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5144
 lock_acquire kernel/locking/lockdep.c:5761 [inline]
 lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726
 lock_sock_nested+0x3a/0xf0 net/core/sock.c:3492
 lock_sock include/net/sock.h:1708 [inline]
 raw_bind+0xb1/0xab0 net/can/raw.c:435
 __sys_bind+0x1ec/0x220 net/socket.c:1792
 __do_sys_bind net/socket.c:1803 [inline]
 __se_sys_bind net/socket.c:1801 [inline]
 __x64_sys_bind+0x72/0xb0 net/socket.c:1801
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fceffa7cb29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcf008360c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 00007fceffb9bf80 RCX: 00007fceffa7cb29
RDX: 0000000000000010 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 00007fceffac847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fceffb9bf80 R15: 00007fceffcbfa48
 </TASK>

Crashes (4535):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/07/27 20:14 upstream 0a8db05b571a 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in raw_bind
2023/07/27 18:44 upstream 0a8db05b571a 92476829 .config console log report info ci-upstream-kasan-gce-smack-root possible deadlock in raw_bind
2023/07/27 17:03 upstream 0a8db05b571a 92476829 .config console log report info ci-upstream-kasan-gce-selinux-root possible deadlock in raw_bind
2023/07/27 14:17 upstream 0a8db05b571a 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in raw_bind
2023/07/27 13:41 upstream 0a8db05b571a 92476829 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in raw_bind
2023/07/27 10:04 upstream 0a8db05b571a 41fe1bae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in raw_bind
2023/07/28 02:33 upstream 0a8db05b571a 92476829 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in raw_bind
2023/07/27 04:37 upstream 0a8db05b571a 41fe1bae .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in raw_bind
2023/07/25 08:49 net 22117b3ae6e3 9a0ddda3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in raw_bind
2023/07/19 03:13 net 78adb4bcf99e 022df2bb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in raw_bind
2023/07/28 01:28 net-next bc758ade6145 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in raw_bind
2023/07/25 21:16 linux-next 1e25dd777248 6756545c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in raw_bind
2023/07/31 17:28 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 15:42 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 14:12 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 13:04 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 11:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 10:46 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 09:20 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 08:08 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 07:04 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 03:40 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/31 00:28 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 22:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 19:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 19:01 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 17:57 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 16:46 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 16:44 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 15:26 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 14:25 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 13:18 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 11:34 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 09:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 08:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 04:09 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 03:01 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/30 01:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 22:47 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 20:50 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 20:33 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 17:59 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 16:46 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 15:09 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 12:38 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 11:23 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 09:11 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 08:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 07:37 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 06:35 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 05:25 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 03:45 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 02:27 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 01:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/29 00:08 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/28 23:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/28 20:22 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
2023/07/28 17:51 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6eaae1980760 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in raw_bind
* Struck through repros no longer work on HEAD.