syzbot


possible deadlock in rds_wake_sk_sleep

Status: upstream: reported C repro on 2023/06/12 06:04
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+a18a2cae6d476734e11d@syzkaller.appspotmail.com
First crash: 321d, last: 22d
Bug presence (3)
Date Name Commit Repro Result
2023/09/10 linux-6.1.y (ToT) 59b13c2b647e C [report] possible deadlock in rds_wake_sk_sleep
2023/06/12 upstream (ToT) 858fd168a95c C [report] possible deadlock in rds_wake_sk_sleep
2023/09/10 upstream (ToT) e56b2b605799 C Didn't crash
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in rds_wake_sk_sleep (2) rds 1 1547d 1545d 0/26 auto-closed as invalid on 2020/05/31 18:56
linux-5.15 possible deadlock in rds_wake_sk_sleep origin:upstream missing-backport C 1 2d09h 328d 0/3 upstream: reported C repro on 2023/06/05 07:41
upstream possible deadlock in rds_wake_sk_sleep (4) rds C error 16 82d 710d 26/26 fixed on 2024/03/27 19:12
linux-4.19 possible deadlock in rds_wake_sk_sleep C error 2 468d 865d 0/1 upstream: reported C repro on 2021/12/15 07:20
upstream possible deadlock in rds_wake_sk_sleep (3) rds 3 1334d 1405d 0/26 auto-closed as invalid on 2020/12/31 09:16
upstream possible deadlock in rds_wake_sk_sleep rds 8 1991d 2090d 0/26 auto-closed as invalid on 2019/05/14 04:22
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2024/04/06 12:32 2h24m bisect fix linux-6.1.y job log (0) log
2024/03/06 02:40 2h05m bisect fix linux-6.1.y job log (0) log
2024/01/28 09:39 1h56m bisect fix linux-6.1.y job log (0) log
2023/12/26 14:27 1h48m bisect fix linux-6.1.y job log (0) log
2023/11/26 02:45 1h46m bisect fix linux-6.1.y job log (0) log
2023/10/22 20:17 2h02m fix candidate upstream job log (0) log
2023/10/15 19:20 2h00m bisect fix linux-6.1.y job log (0) log
2023/07/25 09:02 2h24m (2) bisect fix linux-6.1.y job log (0) log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.33-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor294/3900 is trying to acquire lock:
ffff888074a89d70 (&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:
ffff88807bac1900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x129/0x800 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+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       __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+0x146/0xaa0 net/rds/message.c:180
       rds_inc_put net/rds/recv.c:82 [inline]
       rds_clear_recv_queue+0x2de/0x3b0 net/rds/recv.c:767
       rds_release+0xc1/0x2e0 net/rds/af_rds.c:73
       __sock_release net/socket.c:652 [inline]
       sock_close+0xcd/0x230 net/socket.c:1370
       __fput+0x3b7/0x890 fs/file_table.c:320
       task_work_run+0x246/0x300 kernel/task_work.c:179
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0x6fb/0x2300 kernel/exit.c:869
       do_group_exit+0x202/0x2b0 kernel/exit.c:1019
       get_signal+0x16f7/0x17d0 kernel/signal.c:2858
       arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:869
       exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
       __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
       syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
       do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&rs->rs_recv_lock){...-}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3098 [inline]
       check_prevs_add kernel/locking/lockdep.c:3217 [inline]
       validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       __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+0x1c9/0x800 net/rds/send.c:634
       rds_send_path_drop_acked+0x362/0x3a0 net/rds/send.c:710
       rds_tcp_write_space+0x193/0x560 net/rds/tcp_send.c:198
       tcp_new_space net/ipv4/tcp_input.c:5471 [inline]
       tcp_check_space+0x176/0xab0 net/ipv4/tcp_input.c:5490
       tcp_data_snd_check net/ipv4/tcp_input.c:5499 [inline]
       tcp_rcv_established+0xedb/0x1f00 net/ipv4/tcp_input.c:6007
       tcp_v4_do_rcv+0x487/0xb00 net/ipv4/tcp_ipv4.c:1671
       sk_backlog_rcv include/net/sock.h:1111 [inline]
       __release_sock+0x198/0x4b0 net/core/sock.c:2909
       release_sock+0x5d/0x1c0 net/core/sock.c:3473
       rds_send_xmit+0x1d16/0x2530 net/rds/send.c:422
       rds_sendmsg+0x1b95/0x2240 net/rds/send.c:1382
       sock_sendmsg_nosec net/socket.c:716 [inline]
       sock_sendmsg net/socket.c:736 [inline]
       ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2482
       ___sys_sendmsg net/socket.c:2536 [inline]
       __sys_sendmsg+0x2a9/0x390 net/socket.c:2565
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

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-executor294/3900:
 #0: ffff888078ceef70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1725 [inline]
 #0: ffff888078ceef70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x29/0x1b0 net/ipv4/tcp.c:3339
 #1: ffff888078cef1f8 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x30/0x560 net/rds/tcp_send.c:184
 #2: ffff88807bac1900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x129/0x800 net/rds/send.c:628

stack backtrace:
CPU: 1 PID: 3900 Comm: syz-executor294 Not tainted 6.1.33-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
 <TASK>
 __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:2178
 check_prev_add kernel/locking/lockdep.c:3098 [inline]
 check_prevs_add kernel/locking/lockdep.c:3217 [inline]
 validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
 __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+0x1c9/0x800 net/rds/send.c:634
 rds_send_path_drop_acked+0x362/0x3a0 net/rds/send.c:710
 rds_tcp_write_space+0x193/0x560 net/rds/tcp_send.c:198
 tcp_new_space net/ipv4/tcp_input.c:5471 [inline]
 tcp_check_space+0x176/0xab0 net/ipv4/tcp_input.c:5490
 tcp_data_snd_check net/ipv4/tcp_input.c:5499 [inline]
 tcp_rcv_established+0xedb/0x1f00 net/ipv4/tcp_input.c:6007
 tcp_v4_do_rcv+0x487/0xb00 net/ipv4/tcp_ipv4.c:1671
 sk_backlog_rcv include/net/sock.h:1111 [inline]
 __release_sock+0x198/0x4b0 net/core/sock.c:2909
 release_sock+0x5d/0x1c0 net/core/sock.c:3473
 rds_send_xmit+0x1d16/0x2530 net/rds/send.c:422
 rds_sendmsg+0x1b95/0x2240 net/rds/send.c:1382
 sock_sendmsg_nosec net/socket.c:716 [inline]
 sock_sendmsg net/socket.c:736 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2482
 ___sys_sendmsg net/socket.c:2536 [inline]
 __sys_sendmsg+0x2a9/0x390 net/socket.c:2565
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fc54e9d1c59
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 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:00007fc54e941318 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fc54ea59448 RCX: 00007fc54e9d1c59
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 00007fc54ea59440 R08: 00007fc54e941700 R09: 0000000000000000
R10: 00007fc54e941700 R11: 0000000000000246 R12: 00007fc54ea27074
R13: 00007fffa549bfef R14: 00007fc54e941400 R15: 0000000000022000
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/12 06:04 linux-6.1.y 2f3918bc53fb 49519f06 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in rds_wake_sk_sleep
* Struck through repros no longer work on HEAD.