====================================================== WARNING: possible circular locking dependency detected 5.18.0-rc7-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor423/5373 is trying to acquire lock: ffff8880502af2a8 (&rs->rs_recv_lock){...-}-{2:2}, at: rds_wake_sk_sleep+0x2a/0xd0 net/rds/af_rds.c:109 but task is already holding lock: ffff88807c7cc900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x14b/0x8c0 net/rds/send.c:628 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&rm->m_rs_lock){..-.}-{2:2}: lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5641 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 rds_message_purge net/rds/message.c:138 [inline] rds_message_put+0x13c/0xab0 net/rds/message.c:180 rds_inc_put net/rds/recv.c:82 [inline] rds_clear_recv_queue+0x2bb/0x390 net/rds/recv.c:767 rds_release+0xbe/0x2d0 net/rds/af_rds.c:73 __sock_release net/socket.c:650 [inline] sock_close+0xd7/0x260 net/socket.c:1318 __fput+0x3b9/0x820 fs/file_table.c:317 task_work_run+0x146/0x1c0 kernel/task_work.c:164 ptrace_notify+0x29f/0x350 kernel/signal.c:2361 ptrace_report_syscall include/linux/ptrace.h:427 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:489 [inline] syscall_exit_work+0x8c/0xe0 kernel/entry/common.c:249 syscall_exit_to_user_mode_prepare+0x62/0x80 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0xa/0x70 kernel/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (&rs->rs_recv_lock){...-}-{2:2}: check_prev_add kernel/locking/lockdep.c:3065 [inline] check_prevs_add kernel/locking/lockdep.c:3188 [inline] validate_chain+0x185c/0x65c0 kernel/locking/lockdep.c:3803 __lock_acquire+0x129a/0x1f80 kernel/locking/lockdep.c:5029 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5641 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline] _raw_read_lock_irqsave+0xd9/0x120 kernel/locking/spinlock.c:236 rds_wake_sk_sleep+0x2a/0xd0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0x1fd/0x8c0 net/rds/send.c:634 rds_send_path_drop_acked+0x380/0x3c0 net/rds/send.c:710 rds_tcp_write_space+0x192/0x520 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5455 [inline] tcp_check_space+0x35d/0x4f0 net/ipv4/tcp_input.c:5474 tcp_data_snd_check net/ipv4/tcp_input.c:5483 [inline] tcp_rcv_established+0xa60/0x1a50 net/ipv4/tcp_input.c:5981 tcp_v4_do_rcv+0x479/0xa60 net/ipv4/tcp_ipv4.c:1660 sk_backlog_rcv include/net/sock.h:1051 [inline] __release_sock+0x1d8/0x4c0 net/core/sock.c:2794 release_sock+0x5d/0x1c0 net/core/sock.c:3327 rds_send_xmit+0x1e5d/0x2690 net/rds/send.c:422 rds_sendmsg+0x1bdf/0x2290 net/rds/send.c:1382 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] __sys_sendto+0x42e/0x5b0 net/socket.c:2040 __do_sys_sendto net/socket.c:2052 [inline] __se_sys_sendto net/socket.c:2048 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2048 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&rm->m_rs_lock); lock(&rs->rs_recv_lock); lock(&rm->m_rs_lock); lock(&rs->rs_recv_lock); *** DEADLOCK *** 3 locks held by syz-executor423/5373: #0: ffff888074c4ed30 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1682 [inline] #0: ffff888074c4ed30 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x29/0x1b0 net/ipv4/tcp.c:3236 #1: ffff888074c4efc0 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x30/0x520 net/rds/tcp_send.c:184 #2: ffff88807c7cc900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x14b/0x8c0 net/rds/send.c:628 stack backtrace: CPU: 1 PID: 5373 Comm: syz-executor423 Not tainted 5.18.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2f7/0x3b0 kernel/locking/lockdep.c:2145 check_prev_add kernel/locking/lockdep.c:3065 [inline] check_prevs_add kernel/locking/lockdep.c:3188 [inline] validate_chain+0x185c/0x65c0 kernel/locking/lockdep.c:3803 __lock_acquire+0x129a/0x1f80 kernel/locking/lockdep.c:5029 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5641 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline] _raw_read_lock_irqsave+0xd9/0x120 kernel/locking/spinlock.c:236 rds_wake_sk_sleep+0x2a/0xd0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0x1fd/0x8c0 net/rds/send.c:634 rds_send_path_drop_acked+0x380/0x3c0 net/rds/send.c:710 rds_tcp_write_space+0x192/0x520 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5455 [inline] tcp_check_space+0x35d/0x4f0 net/ipv4/tcp_input.c:5474 tcp_data_snd_check net/ipv4/tcp_input.c:5483 [inline] tcp_rcv_established+0xa60/0x1a50 net/ipv4/tcp_input.c:5981 tcp_v4_do_rcv+0x479/0xa60 net/ipv4/tcp_ipv4.c:1660 sk_backlog_rcv include/net/sock.h:1051 [inline] __release_sock+0x1d8/0x4c0 net/core/sock.c:2794 release_sock+0x5d/0x1c0 net/core/sock.c:3327 rds_send_xmit+0x1e5d/0x2690 net/rds/send.c:422 rds_sendmsg+0x1bdf/0x2290 net/rds/send.c:1382 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] __sys_sendto+0x42e/0x5b0 net/socket.c:2040 __do_sys_sendto net/socket.c:2052 [inline] __se_sys_sendto net/socket.c:2048 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2048 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f10e1fc1129 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 15 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:00007f10e1f6e308 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f10e204a4c8 RCX: 00007f10e1fc1129 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007f10e204a4c0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f10e20175c8 R13: 00007fff67bbfe4f R14: 00007f10e1f6e400 R15: 0000000000022000