syzbot


possible deadlock in unix_notinflight

Status: upstream: reported C repro on 2024/04/10 18:45
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+38b3aa8cd529958bd27a@syzkaller.appspotmail.com
Fix commit: b46f4eaa4f0e af_unix: Clear stale u->oob_skb.
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-net-next-test-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 23d, last: 4d10h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [net?] possible deadlock in unix_notinflight 2 (4) 2024/04/11 18:11
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in unix_notinflight C 3 4d04h 23d 0/3 upstream: reported C repro on 2024/04/07 16:29
linux-6.1 possible deadlock in unix_notinflight C 1 22d 22d 0/3 upstream: reported C repro on 2024/04/08 06:44
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/04/10 22:53 7h44m (3) hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git 443574b03387 error OK

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.8.0-syzkaller-05236-g443574b03387 #0 Not tainted
--------------------------------------------
kworker/u8:0/10 is trying to acquire lock:
ffffffff8f48b798 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffffff8f48b798 (unix_gc_lock){+.+.}-{2:2}, at: unix_notinflight+0x204/0x390 net/unix/garbage.c:140

but task is already holding lock:
ffffffff8f48b798 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffffff8f48b798 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf10 net/unix/garbage.c:261

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

3 locks held by kworker/u8:0/10:
 #0: ffff888014c81148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
 #0: ffff888014c81148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x1770 kernel/workqueue.c:3335
 #1: ffffc900000f7d00 (unix_gc_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
 #1: ffffc900000f7d00 (unix_gc_work){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x1770 kernel/workqueue.c:3335
 #2: ffffffff8f48b798 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #2: ffffffff8f48b798 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf10 net/unix/garbage.c:261

stack backtrace:
CPU: 1 PID: 10 Comm: kworker/u8:0 Not tainted 6.8.0-syzkaller-05236-g443574b03387 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: events_unbound __unix_gc
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
 check_deadlock kernel/locking/lockdep.c:3062 [inline]
 validate_chain+0x15c1/0x58e0 kernel/locking/lockdep.c:3856
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1e4/0x530 kernel/locking/lockdep.c:5754
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 unix_notinflight+0x204/0x390 net/unix/garbage.c:140
 unix_detach_fds net/unix/af_unix.c:1819 [inline]
 unix_destruct_scm+0x221/0x350 net/unix/af_unix.c:1876
 skb_release_head_state+0x100/0x250 net/core/skbuff.c:1188
 skb_release_all net/core/skbuff.c:1200 [inline]
 __kfree_skb net/core/skbuff.c:1216 [inline]
 kfree_skb_reason+0x15d/0x390 net/core/skbuff.c:1252
 kfree_skb include/linux/skbuff.h:1267 [inline]
 __unix_gc+0xaf3/0xf10 net/unix/garbage.c:330
 process_one_work kernel/workqueue.c:3254 [inline]
 process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
 kthread+0x2f0/0x390 kernel/kthread.c:388
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 </TASK>

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/09 06:35 bpf 443574b03387 53df08b6 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce possible deadlock in unix_notinflight
2024/04/08 22:46 net f99c5f563c17 53df08b6 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in unix_notinflight
2024/04/07 15:15 bpf-next 14bb1e8c8d4a ca620dd8 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in unix_notinflight
2024/04/08 07:22 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in unix_notinflight
2024/04/26 06:52 upstream e33c4963bf53 8bdc0f22 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in unix_notinflight
2024/04/24 22:35 upstream e88c4cfcb7b8 8bdc0f22 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in unix_notinflight
2024/04/07 13:08 bpf-next 14bb1e8c8d4a ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in unix_notinflight
* Struck through repros no longer work on HEAD.