syzbot


possible deadlock in rds_wake_sk_sleep

Status: upstream: reported C repro on 2023/06/05 07:41
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+b2780e864eaa3d26da9b@syzkaller.appspotmail.com
First crash: 297d, last: 2d00h
Bug presence (3)
Date Name Commit Repro Result
2023/09/04 linux-5.15.y (ToT) 8f790700c974 C [report] possible deadlock in rds_wake_sk_sleep
2023/06/05 upstream (ToT) 9561de3a55be C [report] possible deadlock in rds_wake_sk_sleep
2023/09/04 upstream (ToT) 708283abf896 C Didn't crash
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in rds_wake_sk_sleep origin:upstream missing-backport C 1 22d 290d 0/3 upstream: reported C repro on 2023/06/12 06:04
upstream possible deadlock in rds_wake_sk_sleep (2) rds 1 1517d 1515d 0/26 auto-closed as invalid on 2020/05/31 18:56
upstream possible deadlock in rds_wake_sk_sleep (4) rds C error 16 51d 679d 26/26 fixed on 2024/03/27 19:12
linux-4.19 possible deadlock in rds_wake_sk_sleep C error 2 437d 834d 0/1 upstream: reported C repro on 2021/12/15 07:20
upstream possible deadlock in rds_wake_sk_sleep (3) rds 3 1303d 1374d 0/26 auto-closed as invalid on 2020/12/31 09:16
upstream possible deadlock in rds_wake_sk_sleep rds 8 1960d 2060d 0/26 auto-closed as invalid on 2019/05/14 04:22
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2024/03/26 18:31 3h15m bisect fix linux-5.15.y job log (0) log
2024/02/25 08:18 1h46m bisect fix linux-5.15.y job log (0) log
2024/01/17 05:21 1h55m bisect fix linux-5.15.y job log (0) log
2023/12/17 01:41 2h15m bisect fix linux-5.15.y job log (0) log
2023/11/16 03:05 1h54m fix candidate upstream job log (0) log
2023/11/15 23:46 2h14m bisect fix linux-5.15.y job log (0) log
2023/10/13 17:14 1h41m bisect fix linux-5.15.y job log (0) log
2023/07/10 09:38 1h40m bisect fix linux-5.15.y job log (0) log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.15.114-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor168/4091 is trying to acquire lock:
ffff88801a8bbc70 (&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:
ffff88801d600900 (&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+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       __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+0x148/0xc80 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:649 [inline]
       sock_close+0xcd/0x230 net/socket.c:1317
       __fput+0x3bf/0x890 fs/file_table.c:280
       task_work_run+0x129/0x1a0 kernel/task_work.c:164
       exit_task_work include/linux/task_work.h:32 [inline]
       do_exit+0x6a3/0x2480 kernel/exit.c:872
       do_group_exit+0x144/0x310 kernel/exit.c:994
       get_signal+0xc66/0x14e0 kernel/signal.c:2889
       arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:865
       handle_signal_work kernel/entry/common.c:148 [inline]
       exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:172
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
       __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
       syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
       do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x61/0xcb

-> #0 (&rs->rs_recv_lock){...-}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [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:5443 [inline]
       tcp_check_space+0x141/0x970 net/ipv4/tcp_input.c:5462
       tcp_data_snd_check net/ipv4/tcp_input.c:5471 [inline]
       tcp_rcv_established+0xeb6/0x1e20 net/ipv4/tcp_input.c:5966
       tcp_v4_do_rcv+0x423/0x960 net/ipv4/tcp_ipv4.c:1727
       sk_backlog_rcv include/net/sock.h:1057 [inline]
       __release_sock+0x198/0x4b0 net/core/sock.c:2690
       release_sock+0x5d/0x1c0 net/core/sock.c:3231
       rds_send_xmit+0x1d16/0x2530 net/rds/send.c:422
       rds_sendmsg+0x1b97/0x2240 net/rds/send.c:1382
       sock_sendmsg_nosec net/socket.c:704 [inline]
       sock_sendmsg net/socket.c:724 [inline]
       ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
       ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
       __sys_sendmsg net/socket.c:2495 [inline]
       __do_sys_sendmsg net/socket.c:2504 [inline]
       __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
       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+0x61/0xcb

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-executor168/4091:
 #0: ffff88807895c920 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1649 [inline]
 #0: ffff88807895c920 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x29/0x1b0 net/ipv4/tcp.c:3232
 #1: ffff88807895cbd0 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x30/0x560 net/rds/tcp_send.c:184
 #2: ffff88801d600900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x129/0x800 net/rds/send.c:628

stack backtrace:
CPU: 1 PID: 4091 Comm: syz-executor168 Not tainted 5.15.114-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+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [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:5443 [inline]
 tcp_check_space+0x141/0x970 net/ipv4/tcp_input.c:5462
 tcp_data_snd_check net/ipv4/tcp_input.c:5471 [inline]
 tcp_rcv_established+0xeb6/0x1e20 net/ipv4/tcp_input.c:5966
 tcp_v4_do_rcv+0x423/0x960 net/ipv4/tcp_ipv4.c:1727
 sk_backlog_rcv include/net/sock.h:1057 [inline]
 __release_sock+0x198/0x4b0 net/core/sock.c:2690
 release_sock+0x5d/0x1c0 net/core/sock.c:3231
 rds_send_xmit+0x1d16/0x2530 net/rds/send.c:422
 rds_sendmsg+0x1b97/0x2240 net/rds/send.c:1382
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
 __sys_sendmsg net/socket.c:2495 [inline]
 __do_sys_sendmsg net/socket.c:2504 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
 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+0x61/0xcb
RIP: 0033:0x7f609a864c79
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:00007f609a7d4318 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f609a8ec448 RCX: 00007f609a864c79
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 00007f609a8ec440 R08: 00007f609a7d4700 R09: 0000000000000000
R10: 00007f609a7d4700 R11: 0000000000000246 R12: 00007f609a8ba074
R13: 00007ffd3d73ba3f R14: 00007f609a7d4400 R15: 0000000000022000
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/05 07:40 linux-5.15.y 0ab06468cbd1 a4ae4f42 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in rds_wake_sk_sleep
* Struck through repros no longer work on HEAD.