====================================================== WARNING: possible circular locking dependency detected 6.1.87-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor132/3559 is trying to acquire lock: ffff888028962a68 (&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: ffff88807ac69bb8 (clock-AF_UNIX){+...}-{2:2}, at: sk_psock_init+0x32/0x6d0 net/core/skmsg.c:704 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 0xffffffffa0000836 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_run4+0x253/0x470 kernel/trace/bpf_trace.c:2314 __bpf_trace_mm_page_alloc+0xba/0xe0 include/trace/events/kmem.h:177 trace_mm_page_alloc include/trace/events/kmem.h:177 [inline] __alloc_pages+0x717/0x770 mm/page_alloc.c:5569 __get_free_pages mm/page_alloc.c:5597 [inline] get_zeroed_page+0x13/0x30 mm/page_alloc.c:5606 __pud_alloc_one include/asm-generic/pgalloc.h:156 [inline] pud_alloc_one include/asm-generic/pgalloc.h:171 [inline] __pud_alloc+0x8b/0x220 mm/memory.c:5447 pud_alloc include/linux/mm.h:2333 [inline] copy_pud_range mm/memory.c:1194 [inline] copy_p4d_range mm/memory.c:1238 [inline] copy_page_range+0x41fa/0x4660 mm/memory.c:1336 dup_mmap kernel/fork.c:696 [inline] dup_mm kernel/fork.c:1540 [inline] copy_mm+0xf42/0x1990 kernel/fork.c:1589 copy_process+0x19d5/0x4060 kernel/fork.c:2267 kernel_clone+0x222/0x920 kernel/fork.c:2682 __do_sys_clone kernel/fork.c:2823 [inline] __se_sys_clone kernel/fork.c:2807 [inline] __x64_sys_clone+0x231/0x280 kernel/fork.c:2807 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_2c29ac5cdc6b1842+0x3a/0x3e 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_run4+0x253/0x470 kernel/trace/bpf_trace.c:2314 __bpf_trace_mm_page_alloc+0xba/0xe0 include/trace/events/kmem.h:177 __traceiter_mm_page_alloc+0x35/0x50 include/trace/events/kmem.h:177 trace_mm_page_alloc include/trace/events/kmem.h:177 [inline] __alloc_pages+0x717/0x770 mm/page_alloc.c:5569 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 kmalloc_node_trace+0x23/0xe0 mm/slab_common.c:1058 kmalloc_node include/linux/slab.h:578 [inline] kzalloc_node include/linux/slab.h:703 [inline] sk_psock_init+0x114/0x6d0 net/core/skmsg.c:716 sock_map_link+0x767/0xe30 net/core/sock_map.c:277 sock_hash_update_common+0xd1/0xa30 net/core/sock_map.c:996 sock_map_update_elem_sys+0x5a0/0x910 net/core/sock_map.c:586 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1448 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:4993 __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 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 *** 4 locks held by syz-executor132/3559: #0: ffff88807ac69930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1745 [inline] #0: ffff88807ac69930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sock_map_sk_acquire net/core/sock_map.c:119 [inline] #0: ffff88807ac69930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sock_map_update_elem_sys+0x1c8/0x910 net/core/sock_map.c:580 #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline] #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline] #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: sock_map_sk_acquire net/core/sock_map.c:120 [inline] #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: sock_map_update_elem_sys+0x1d4/0x910 net/core/sock_map.c:580 #2: ffff88807ac69bb8 (clock-AF_UNIX){+...}-{2:2}, at: sk_psock_init+0x32/0x6d0 net/core/skmsg.c:704 #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline] #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline] #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2272 [inline] #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run4+0x16a/0x470 kernel/trace/bpf_trace.c:2314 stack backtrace: CPU: 0 PID: 3559 Comm: syz-executor132 Not tainted 6.1.87-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/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_2c29ac5cdc6b1842+0x3a/0x3e 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_run4+0x253/0x470 kernel/trace/bpf_trace.c:2314 __bpf_trace_mm_page_alloc+0xba/0xe0 include/trace/events/kmem.h:177 __traceiter_mm_page_alloc+0x35/0x50 include/trace/events/kmem.h:177 trace_mm_page_alloc include/trace/events/kmem.h:177 [inline] __alloc_pages+0x717/0x770 mm/page_alloc.c:5569 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 kmalloc_node_trace+0x23/0xe0 mm/slab_common.c:1058 kmalloc_node include/linux/slab.h:578 [inline] kzalloc_node include/linux/slab.h:703 [inline] sk_psock_init+0x114/0x6d0 net/core/skmsg.c:716 sock_map_link+0x767/0xe30 net/core/sock_map.c:277 sock_hash_update_common+0xd1/0xa30 net/core/sock_map.c:996 sock_map_update_elem_sys+0x5a0/0x910 net/core/sock_map.c:586 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1448 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:4993 __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 RIP: 0033:0x7f8c69eb1029 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcc36787b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8c69eb1029 RDX: 0000000000000020 RSI: 0000000020000180 RDI: 0000000000000002 RBP: 0000000000000000 R08: 00000000000000a0 R09: 00000000000000a0 R10: 00000000000000a0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000