====================================================== WARNING: possible circular locking dependency detected 6.9.0-syzkaller-10713-g2a8120d7b482 #0 Not tainted ------------------------------------------------------ syz-executor.3/5917 is trying to acquire lock: ffff88801dab4868 (&htab->buckets[i].lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] ffff88801dab4868 (&htab->buckets[i].lock){+.-.}-{2:2}, at: sock_hash_delete_elem+0xeb/0x290 net/core/sock_map.c:957 but task is already holding lock: ffff8880457412b0 (&psock->link_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] ffff8880457412b0 (&psock->link_lock){+...}-{2:2}, at: sock_map_del_link net/core/sock_map.c:157 [inline] ffff8880457412b0 (&psock->link_lock){+...}-{2:2}, at: sock_map_unref+0xbf/0x6e0 net/core/sock_map.c:192 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&psock->link_lock){+...}-{2:2}: __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] sock_map_add_link net/core/sock_map.c:146 [inline] sock_hash_update_common+0x422/0xa60 net/core/sock_map.c:1041 sock_map_update_elem_sys+0x280/0x570 net/core/sock_map.c:596 bpf_map_update_value+0x36c/0x6c0 kernel/bpf/syscall.c:172 map_update_elem+0x623/0x910 kernel/bpf/syscall.c:1654 __sys_bpf+0x90c/0x49a0 kernel/bpf/syscall.c:5675 __do_sys_bpf kernel/bpf/syscall.c:5794 [inline] __se_sys_bpf kernel/bpf/syscall.c:5792 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5792 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&htab->buckets[i].lock){+.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] sock_hash_delete_elem+0xeb/0x290 net/core/sock_map.c:957 ___bpf_prog_run+0x3e51/0xabd0 kernel/bpf/core.c:2012 __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2253 bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline] __bpf_prog_run include/linux/filter.h:691 [inline] bpf_prog_run include/linux/filter.h:698 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2403 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2444 __traceiter_kfree+0x2d/0x50 include/trace/events/kmem.h:94 trace_kfree include/trace/events/kmem.h:94 [inline] kfree+0x229/0x3b0 mm/slub.c:4544 sk_psock_free_link include/linux/skmsg.h:423 [inline] sock_map_del_link net/core/sock_map.c:170 [inline] sock_map_unref+0x392/0x6e0 net/core/sock_map.c:192 __sock_map_delete+0x88/0xe0 net/core/sock_map.c:435 sock_map_delete_elem+0xb5/0x100 net/core/sock_map.c:461 ___bpf_prog_run+0x3e51/0xabd0 kernel/bpf/core.c:2012 __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2253 bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline] __bpf_prog_run include/linux/filter.h:691 [inline] bpf_prog_run include/linux/filter.h:698 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2403 [inline] bpf_trace_run1+0x229/0x580 kernel/trace/bpf_trace.c:2443 __bpf_trace_ext4_request_blocks+0x98/0xd0 include/trace/events/ext4.h:818 trace_ext4_request_blocks include/trace/events/ext4.h:818 [inline] ext4_mb_new_blocks+0x89f/0x4e40 fs/ext4/mballoc.c:6154 ext4_ext_map_blocks+0x1c24/0x5cd0 fs/ext4/extents.c:4318 ext4_map_blocks+0x61d/0x17d0 fs/ext4/inode.c:623 ext4_getblk+0x17f/0x8a0 fs/ext4/inode.c:833 ext4_bread+0x2c/0x190 fs/ext4/inode.c:889 ext4_append+0x26d/0x560 fs/ext4/namei.c:83 ext4_init_new_dir+0x220/0x4c0 fs/ext4/namei.c:2977 ext4_mkdir+0x315/0xb70 fs/ext4/namei.c:3023 vfs_mkdir+0x57d/0x860 fs/namei.c:4131 do_mkdirat+0x301/0x3a0 fs/namei.c:4154 __do_sys_mkdir fs/namei.c:4174 [inline] __se_sys_mkdir fs/namei.c:4172 [inline] __x64_sys_mkdir+0xf1/0x140 fs/namei.c:4172 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&psock->link_lock); lock(&htab->buckets[i].lock); lock(&psock->link_lock); lock(&htab->buckets[i].lock); *** DEADLOCK *** 8 locks held by syz-executor.3/5917: #0: ffff888024552420 (sb_writers#5){.+.+}-{0:0}, at: filename_create+0x10d/0x530 fs/namei.c:3893 #1: ffff888033104000 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:826 [inline] #1: ffff888033104000 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: filename_create+0x1c2/0x530 fs/namei.c:3900 #2: ffff888024556950 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x10db/0x15e0 fs/jbd2/transaction.c:463 #3: ffff888048e12088 (&ei->i_data_sem){++++}-{3:3}, at: ext4_map_blocks+0x5ab/0x17d0 fs/ext4/inode.c:616 #4: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] #4: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:781 [inline] #4: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2402 [inline] #4: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run1+0x1ba/0x580 kernel/trace/bpf_trace.c:2443 #5: ffff88802d8d9a20 (&stab->lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] #5: ffff88802d8d9a20 (&stab->lock){+...}-{2:2}, at: __sock_map_delete+0x43/0xe0 net/core/sock_map.c:429 #6: ffff8880457412b0 (&psock->link_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] #6: ffff8880457412b0 (&psock->link_lock){+...}-{2:2}, at: sock_map_del_link net/core/sock_map.c:157 [inline] #6: ffff8880457412b0 (&psock->link_lock){+...}-{2:2}, at: sock_map_unref+0xbf/0x6e0 net/core/sock_map.c:192 #7: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] #7: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:781 [inline] #7: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2402 [inline] #7: ffffffff8dbb13e0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0x1c2/0x590 kernel/trace/bpf_trace.c:2444 stack backtrace: CPU: 3 PID: 5917 Comm: syz-executor.3 Not tainted 6.9.0-syzkaller-10713-g2a8120d7b482 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] sock_hash_delete_elem+0xeb/0x290 net/core/sock_map.c:957 ___bpf_prog_run+0x3e51/0xabd0 kernel/bpf/core.c:2012 __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2253 bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline] __bpf_prog_run include/linux/filter.h:691 [inline] bpf_prog_run include/linux/filter.h:698 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2403 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2444 __traceiter_kfree+0x2d/0x50 include/trace/events/kmem.h:94 trace_kfree include/trace/events/kmem.h:94 [inline] kfree+0x229/0x3b0 mm/slub.c:4544 sk_psock_free_link include/linux/skmsg.h:423 [inline] sock_map_del_link net/core/sock_map.c:170 [inline] sock_map_unref+0x392/0x6e0 net/core/sock_map.c:192 __sock_map_delete+0x88/0xe0 net/core/sock_map.c:435 sock_map_delete_elem+0xb5/0x100 net/core/sock_map.c:461 ___bpf_prog_run+0x3e51/0xabd0 kernel/bpf/core.c:2012 __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2253 bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline] __bpf_prog_run include/linux/filter.h:691 [inline] bpf_prog_run include/linux/filter.h:698 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2403 [inline] bpf_trace_run1+0x229/0x580 kernel/trace/bpf_trace.c:2443 __bpf_trace_ext4_request_blocks+0x98/0xd0 include/trace/events/ext4.h:818 trace_ext4_request_blocks include/trace/events/ext4.h:818 [inline] ext4_mb_new_blocks+0x89f/0x4e40 fs/ext4/mballoc.c:6154 ext4_ext_map_blocks+0x1c24/0x5cd0 fs/ext4/extents.c:4318 ext4_map_blocks+0x61d/0x17d0 fs/ext4/inode.c:623 ext4_getblk+0x17f/0x8a0 fs/ext4/inode.c:833 ext4_bread+0x2c/0x190 fs/ext4/inode.c:889 ext4_append+0x26d/0x560 fs/ext4/namei.c:83 ext4_init_new_dir+0x220/0x4c0 fs/ext4/namei.c:2977 ext4_mkdir+0x315/0xb70 fs/ext4/namei.c:3023 vfs_mkdir+0x57d/0x860 fs/namei.c:4131 do_mkdirat+0x301/0x3a0 fs/namei.c:4154 __do_sys_mkdir fs/namei.c:4174 [inline] __se_sys_mkdir fs/namei.c:4172 [inline] __x64_sys_mkdir+0xf1/0x140 fs/namei.c:4172 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f64c527cee9 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:00007f64c60090c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000053 RAX: ffffffffffffffda RBX: 00007f64c53abf80 RCX: 00007f64c527cee9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000100 RBP: 00007f64c52c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f64c53abf80 R15: 00007ffdf534fd58