[v5.15] possible deadlock in unix_notinflight

0 views
Skip to first unread message

syzbot

unread,
Apr 7, 2024, 12:29:19 PMApr 7
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9465fef4ae35 Linux 5.15.153
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13966339180000
kernel config: https://syzkaller.appspot.com/x/.config?x=176c746ee3348b33
dashboard link: https://syzkaller.appspot.com/bug?extid=8dddc6a8c263d197fecf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13308699180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=162b04f3180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/741f29d5f449/disk-9465fef4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/66645f341114/vmlinux-9465fef4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f7d21e0c9e19/bzImage-9465fef4.xz

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

============================================
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>


---
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 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

syzbot

unread,
Apr 8, 2024, 2:44:23 AMApr 8
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 347385861c50 Linux 6.1.84
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=117ec083180000
kernel config: https://syzkaller.appspot.com/x/.config?x=40dfd13b04bfc094
dashboard link: https://syzkaller.appspot.com/bug?extid=639d2cc188ba16f9f7f2
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15203f8d180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e35f19180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/584c64d6360b/disk-34738586.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ebe1b8334610/vmlinux-34738586.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e3d485b54a02/bzImage-34738586.xz

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

============================================
WARNING: possible recursive locking detected
6.1.84-syzkaller #0 Not tainted
--------------------------------------------
dhcpcd/3216 is trying to acquire lock:
ffffffff8e396738 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffffff8e396738 (unix_gc_lock){+.+.}-{2:2}, at: unix_notinflight+0x297/0x390 net/unix/scm.c:72

but task is already holding lock:
ffffffff8e396738 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffffff8e396738 (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/3216:
#0: ffff888073a56210 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#0: ffff888073a56210 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: __sock_release net/socket.c:653 [inline]
#0: ffff888073a56210 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: sock_close+0x98/0x230 net/socket.c:1400
#1: ffffffff8e396738 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
#1: ffffffff8e396738 (unix_gc_lock){+.+.}-{2:2}, at: unix_gc+0x115/0x1380 net/unix/garbage.c:214

stack backtrace:
CPU: 0 PID: 3216 Comm: dhcpcd Not tainted 6.1.84-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:2983 [inline]
check_deadlock kernel/locking/lockdep.c:3026 [inline]
validate_chain+0x4711/0x5950 kernel/locking/lockdep.c:3812
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:351 [inline]
unix_notinflight+0x297/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:843
skb_release_all net/core/skbuff.c:854 [inline]
__kfree_skb net/core/skbuff.c:870 [inline]
kfree_skb_reason+0x13d/0x390 net/core/skbuff.c:893
kfree_skb include/linux/skbuff.h:1225 [inline]
unix_gc+0xb2e/0x1380 net/unix/garbage.c:292
unix_release_sock+0xab8/0xcf0 net/unix/af_unix.c:669
unix_release+0x88/0xc0 net/unix/af_unix.c:1039
__sock_release net/socket.c:654 [inline]
sock_close+0xcd/0x230 net/socket.c:1400
__fput+0x3b7/0x890 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f480d0dd0a8
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:00007ffe4d7a18b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f480d0dd0a8
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000010
RBP: 00007ffe4d7c1c68 R08: 0000000000000007 R09: 96d59ce5aedcbe24
R10: 0000000000004000 R11: 0000000000000246 R12: 0000558f584c1ad0
R13: 00007ffe4d7b1aa8 R14: 0000000000000148 R15: 0000000000000004
Reply all
Reply to author
Forward
0 new messages