====================================================== WARNING: possible circular locking dependency detected 5.15.160-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/7111 is trying to acquire lock: ffff8880230033d8 (clock-AF_UNIX){+...}-{2:2}, at: sk_psock_drop+0x30/0x500 net/core/skmsg.c:824 but task is already holding lock: ffff888061936068 (&htab->buckets[i].lock){+.-.}-{2:2}, at: sock_hash_delete_elem+0x177/0x400 net/core/sock_map.c:943 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&htab->buckets[i].lock){+.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:178 sock_hash_delete_elem+0x177/0x400 net/core/sock_map.c:943 0xffffffffa001605b bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run2+0x19e/0x340 kernel/trace/bpf_trace.c:1917 __bpf_trace_kfree+0x6e/0x90 include/trace/events/kmem.h:118 trace_kfree include/trace/events/kmem.h:118 [inline] kfree+0x22f/0x270 mm/slub.c:4549 __bpf_prog_put_noref+0x9c/0x2b0 kernel/bpf/syscall.c:1796 bpf_prog_put_deferred+0x2ee/0x3e0 kernel/bpf/syscall.c:1822 __bpf_prog_put kernel/bpf/syscall.c:1834 [inline] bpf_prog_put+0x260/0x2a0 kernel/bpf/syscall.c:1841 psock_set_prog include/linux/skmsg.h:477 [inline] sk_psock_stop_verdict net/core/skmsg.c:1234 [inline] sk_psock_drop+0x243/0x500 net/core/skmsg.c:830 sk_psock_put include/linux/skmsg.h:459 [inline] sock_map_close+0x1d4/0x290 net/core/sock_map.c:1581 unix_release+0x7e/0xc0 net/unix/af_unix.c:949 __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:181 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (clock-AF_UNIX){+...}-{2:2}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_write_lock_bh include/linux/rwlock_api_smp.h:203 [inline] _raw_write_lock_bh+0x31/0x40 kernel/locking/spinlock.c:324 sk_psock_drop+0x30/0x500 net/core/skmsg.c:824 sock_hash_delete_elem+0x388/0x400 net/core/sock_map.c:947 map_delete_elem+0x431/0x580 kernel/bpf/syscall.c:1239 __sys_bpf+0x311/0x670 kernel/bpf/syscall.c:4642 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&htab->buckets[i].lock); lock(clock-AF_UNIX); lock(&htab->buckets[i].lock); lock(clock-AF_UNIX); *** DEADLOCK *** 2 locks held by syz-executor.3/7111: #0: ffffffff8c91fae0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 #1: ffff888061936068 (&htab->buckets[i].lock){+.-.}-{2:2}, at: sock_hash_delete_elem+0x177/0x400 net/core/sock_map.c:943 stack backtrace: CPU: 0 PID: 7111 Comm: syz-executor.3 Not tainted 5.15.160-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_write_lock_bh include/linux/rwlock_api_smp.h:203 [inline] _raw_write_lock_bh+0x31/0x40 kernel/locking/spinlock.c:324 sk_psock_drop+0x30/0x500 net/core/skmsg.c:824 sock_hash_delete_elem+0x388/0x400 net/core/sock_map.c:947 map_delete_elem+0x431/0x580 kernel/bpf/syscall.c:1239 __sys_bpf+0x311/0x670 kernel/bpf/syscall.c:4642 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f5949186ea9 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:00007f5947d000c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f59492bdf80 RCX: 00007f5949186ea9 RDX: 0000000000000020 RSI: 0000000020000400 RDI: 0000000000000003 RBP: 00007f59491f5ff4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f59492bdf80 R15: 00007ffcad0ef2c8