====================================================== WARNING: possible circular locking dependency detected 6.1.92-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/10213 is trying to acquire lock: ffff88807781a820 (&htab->buckets[i].lock){+.-.}-{2:2}, at: sock_hash_delete_elem+0x177/0x400 net/core/sock_map.c:938 but task is already holding lock: ffff88801a3e13b8 (clock-AF_UNIX){++..}-{2:2}, at: sk_psock_drop+0x30/0x500 net/core/skmsg.c:836 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (clock-AF_UNIX){++..}-{2:2}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __raw_write_lock_bh include/linux/rwlock_api_smp.h:202 [inline] _raw_write_lock_bh+0x31/0x40 kernel/locking/spinlock.c:334 sk_psock_drop+0x30/0x500 net/core/skmsg.c:836 sock_hash_delete_elem+0x388/0x400 net/core/sock_map.c:942 map_delete_elem+0x3ff/0x550 kernel/bpf/syscall.c:1501 __sys_bpf+0x350/0x6c0 kernel/bpf/syscall.c:4996 __do_sys_bpf kernel/bpf/syscall.c:5109 [inline] __se_sys_bpf kernel/bpf/syscall.c:5107 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&htab->buckets[i].lock){+.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:178 sock_hash_delete_elem+0x177/0x400 net/core/sock_map.c:938 bpf_prog_d5e2520a098840fa+0x3d/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:603 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x1fd/0x410 kernel/trace/bpf_trace.c:2312 __bpf_trace_kfree+0x6e/0x90 include/trace/events/kmem.h:94 trace_kfree include/trace/events/kmem.h:94 [inline] kfree+0xf6/0x190 mm/slab_common.c:994 __bpf_prog_put_noref+0x9c/0x2b0 kernel/bpf/syscall.c:2059 bpf_prog_put_deferred+0x2ee/0x3e0 kernel/bpf/syscall.c:2085 __bpf_prog_put kernel/bpf/syscall.c:2097 [inline] bpf_prog_put+0x260/0x2a0 kernel/bpf/syscall.c:2104 psock_set_prog include/linux/skmsg.h:472 [inline] sk_psock_stop_verdict net/core/skmsg.c:1239 [inline] sk_psock_drop+0x243/0x500 net/core/skmsg.c:842 sk_psock_put include/linux/skmsg.h:454 [inline] sock_map_close+0x205/0x2d0 net/core/sock_map.c:1638 unix_release+0x7e/0xc0 net/unix/af_unix.c:1038 __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+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(clock-AF_UNIX); lock(&htab->buckets[i].lock); lock(clock-AF_UNIX); lock(&htab->buckets[i].lock); *** DEADLOCK *** 3 locks held by syz-executor.3/10213: #0: ffff8880559c0e10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline] #0: ffff8880559c0e10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: __sock_release net/socket.c:653 [inline] #0: ffff8880559c0e10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: sock_close+0x98/0x230 net/socket.c:1400 #1: ffff88801a3e13b8 (clock-AF_UNIX){++..}-{2:2}, at: sk_psock_drop+0x30/0x500 net/core/skmsg.c:836 #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline] #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline] #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2272 [inline] #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0x110/0x410 kernel/trace/bpf_trace.c:2312 stack backtrace: CPU: 1 PID: 10213 Comm: syz-executor.3 Not tainted 6.1.92-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:178 sock_hash_delete_elem+0x177/0x400 net/core/sock_map.c:938 bpf_prog_d5e2520a098840fa+0x3d/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:603 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x1fd/0x410 kernel/trace/bpf_trace.c:2312 __bpf_trace_kfree+0x6e/0x90 include/trace/events/kmem.h:94 trace_kfree include/trace/events/kmem.h:94 [inline] kfree+0xf6/0x190 mm/slab_common.c:994 __bpf_prog_put_noref+0x9c/0x2b0 kernel/bpf/syscall.c:2059 bpf_prog_put_deferred+0x2ee/0x3e0 kernel/bpf/syscall.c:2085 __bpf_prog_put kernel/bpf/syscall.c:2097 [inline] bpf_prog_put+0x260/0x2a0 kernel/bpf/syscall.c:2104 psock_set_prog include/linux/skmsg.h:472 [inline] sk_psock_stop_verdict net/core/skmsg.c:1239 [inline] sk_psock_drop+0x243/0x500 net/core/skmsg.c:842 sk_psock_put include/linux/skmsg.h:454 [inline] sock_map_close+0x205/0x2d0 net/core/sock_map.c:1638 unix_release+0x7e/0xc0 net/unix/af_unix.c:1038 __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+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fc1b0e7cf69 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:00007ffee9dd40b8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 0000000000047baa RCX: 00007fc1b0e7cf69 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: ffffffffffffffff R08: 0000000000000001 R09: 0000000c00000000 R10: 00007fc1b0e00000 R11: 0000000000000246 R12: 00007fc1b0fb4050 R13: 00007fc1b0fb405c R14: 0000000000000032 R15: 00007fc1b0fb5980