syzbot


possible deadlock in unix_notinflight

Status: upstream: reported C repro on 2024/04/07 16:29
Reported-by: syzbot+8dddc6a8c263d197fecf@syzkaller.appspotmail.com
First crash: 29d, last: 10d
Bug presence (1)
Date Name Commit Repro Result
2024/04/21 upstream (ToT) ed30a4a51bb1 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in unix_notinflight net C 7 11d 26d 25/26 upstream: reported C repro on 2024/04/10 18:45
linux-6.1 possible deadlock in unix_notinflight C 1 29d 29d 0/3 upstream: reported C repro on 2024/04/08 06:44

Sample crash report:
============================================
WARNING: possible recursive locking detected
5.15.153-syzkaller #0 Not tainted
--------------------------------------------
dhcpcd/3174 is trying to acquire lock:
ffffffff8dad4258 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
ffffffff8dad4258 (unix_gc_lock){+.+.}-{2:2}, at: unix_notinflight+0x29a/0x390 net/unix/scm.c:72

but task is already holding lock:
ffffffff8dad4258 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
ffffffff8dad4258 (unix_gc_lock){+.+.}-{2:2}, at: unix_gc+0x115/0x1380 net/unix/garbage.c:214

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(unix_gc_lock);
  lock(unix_gc_lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by dhcpcd/3174:
 #0: ffff888074593810 (&sb->s_type->i_mutex_key#11){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
 #0: ffff888074593810 (&sb->s_type->i_mutex_key#11){+.+.}-{3:3}, at: __sock_release net/socket.c:648 [inline]
 #0: ffff888074593810 (&sb->s_type->i_mutex_key#11){+.+.}-{3:3}, at: sock_close+0x98/0x230 net/socket.c:1336
 #1: ffffffff8dad4258 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
 #1: ffffffff8dad4258 (unix_gc_lock){+.+.}-{2:2}, at: unix_gc+0x115/0x1380 net/unix/garbage.c:214

stack backtrace:
CPU: 1 PID: 3174 Comm: dhcpcd Not tainted 5.15.153-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_deadlock_bug kernel/locking/lockdep.c:2946 [inline]
 check_deadlock kernel/locking/lockdep.c:2989 [inline]
 validate_chain+0x46d2/0x5930 kernel/locking/lockdep.c:3775
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:363 [inline]
 unix_notinflight+0x29a/0x390 net/unix/scm.c:72
 unix_detach_fds net/unix/scm.c:134 [inline]
 unix_destruct_scm+0x21d/0x350 net/unix/scm.c:145
 skb_release_head_state+0xf9/0x230 net/core/skbuff.c:729
 skb_release_all net/core/skbuff.c:740 [inline]
 __kfree_skb net/core/skbuff.c:756 [inline]
 kfree_skb_reason+0x82/0x170 net/core/skbuff.c:776
 kfree_skb include/linux/skbuff.h:1123 [inline]
 unix_gc+0xb2b/0x1380 net/unix/garbage.c:292
 unix_release_sock+0x91c/0xaa0 net/unix/af_unix.c:607
 unix_release+0x88/0xc0 net/unix/af_unix.c:950
 __sock_release net/socket.c:649 [inline]
 sock_close+0xcd/0x230 net/socket.c:1336
 __fput+0x3bf/0x890 fs/file_table.c:280
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fdede9980a8
Code: 48 8b 05 83 9d 0d 00 64 c7 00 16 00 00 00 83 c8 ff 48 83 c4 20 5b c3 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 5b 48 8b 15 51 9d 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffc93f31cf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007fdede9980a8
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000005
RBP: 00007ffc93f520a8 R08: 0000000000000007 R09: 69906f7023515725
R10: 0000000000004000 R11: 0000000000000246 R12: 00005620c764d4e0
R13: 00007ffc93f41ee8 R14: 0000000000000148 R15: 0000000000000004
 </TASK>

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/07 16:28 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf possible deadlock in unix_notinflight
2024/04/26 12:50 linux-5.15.y c52b9710c83d 059e9963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in unix_notinflight
2024/04/18 17:56 linux-5.15.y c52b9710c83d af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in unix_notinflight
* Struck through repros no longer work on HEAD.