syzbot


possible deadlock in rds_wake_sk_sleep (4)

Status: fixed on 2024/03/27 19:12
Subsystems: rds
[Documentation on labels]
Reported-by: syzbot+dcd73ff9291e6d34b3ab@syzkaller.appspotmail.com
Fix commit: f1acf1ac84d2 net:rds: Fix possible deadlock in rds_message_put
First crash: 709d, last: 77d
Cause bisection: failed (error log, bisect log)
  
Discussions (6)
Title Replies (including bot) Last reply
[PATCH v4 1/1] net:rds: Fix possible deadlock in rds_message_put 2 (2) 2024/02/13 09:28
[PATCH v3 1/1] net:rds: Fix possible deadlock in rds_message_put 3 (3) 2024/02/08 17:03
[PATCH v2 1/1] net:rds: Fix possible deadlock in rds_message_put 1 (1) 2024/01/31 17:54
[syzbot] possible deadlock in rds_wake_sk_sleep (4) 0 (2) 2024/01/31 15:34
[syzbot] Monthly rds report (Nov 2023) 1 (2) 2023/12/11 19:24
[syzbot] Monthly rds report (Oct 2023) 0 (1) 2023/10/19 13:02
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 17d 316d 0/3 upstream: reported C repro on 2023/06/12 06:04
upstream possible deadlock in rds_wake_sk_sleep (2) rds 1 1543d 1541d 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 28d 323d 0/3 upstream: reported C repro on 2023/06/05 07:41
linux-4.19 possible deadlock in rds_wake_sk_sleep C error 2 463d 860d 0/1 upstream: reported C repro on 2021/12/15 07:20
upstream possible deadlock in rds_wake_sk_sleep (3) rds 3 1329d 1400d 0/26 auto-closed as invalid on 2020/12/31 09:16
upstream possible deadlock in rds_wake_sk_sleep rds 8 1986d 2086d 0/26 auto-closed as invalid on 2019/05/14 04:22
Last patch testing requests (12)
Created Duration User Patch Repo Result
2024/02/06 16:11 15m retest repro upstream report log
2024/01/31 15:34 23m allison.henderson@oracle.com https://github.com/allisonhenderson/rds_work syzbug_f9db6ff27b9bfdcfeca OK log
2024/01/22 17:59 30m retest repro upstream OK log
2024/01/11 17:07 20m retest repro net report log
2024/01/11 17:07 22m retest repro upstream OK log
2024/01/11 17:07 25m retest repro upstream OK log
2024/01/11 17:07 16m retest repro net report log
2023/12/28 16:27 24m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2023/12/11 20:51 32m retest repro net-next report log
2023/11/27 19:46 17m retest repro upstream report log
2023/11/13 17:37 20m retest repro upstream report log
2022/05/19 11:52 18m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/ 1e1b28b936ae OK
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2023/07/23 00:13 2h15m bisect fix net job log (0) log
2023/06/10 17:46 49m bisect fix upstream job log (0) log
2023/04/02 11:13 37m bisect fix upstream job log (0) log
2023/02/02 16:41 37m bisect fix upstream job log (0) log
2022/10/12 17:54 38m (2) bisect fix upstream job log (0) log
2022/08/25 23:33 35m bisect fix upstream job log (0) log
2022/07/26 22:55 37m bisect fix upstream job log (0) log
Cause bisection attempts (2)
Created Duration User Patch Repo Result
2023/09/23 09:10 4h51m bisect upstream error job log (0)
2022/05/15 21:52 7h10m bisect linux-next job log (0) log
marked invalid by nogikh@google.com

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.3.0-syzkaller-13413-gcceac9267887 #0 Not tainted
------------------------------------------------------
syz-executor361/5071 is trying to acquire lock:
ffff88802cb172b0 (&rs->rs_recv_lock){...-}-{2:2}, at: rds_wake_sk_sleep+0x23/0xe0 net/rds/af_rds.c:109

but task is already holding lock:
ffff88807c0c9100 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x340/0x9e0 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}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
       rds_message_purge net/rds/message.c:138 [inline]
       rds_message_put+0x1dd/0xc30 net/rds/message.c:180
       rds_inc_put net/rds/recv.c:83 [inline]
       rds_inc_put+0x13e/0x1a0 net/rds/recv.c:77
       rds_clear_recv_queue+0x14b/0x350 net/rds/recv.c:768
       rds_release+0xd8/0x3c0 net/rds/af_rds.c:73
       __sock_release+0xcd/0x290 net/socket.c:653
       sock_close+0x1c/0x20 net/socket.c:1397
       __fput+0x27c/0xa90 fs/file_table.c:321
       task_work_run+0x16f/0x270 kernel/task_work.c:179
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0xad3/0x2960 kernel/exit.c:871
       do_group_exit+0xd4/0x2a0 kernel/exit.c:1021
       __do_sys_exit_group kernel/exit.c:1032 [inline]
       __se_sys_exit_group kernel/exit.c:1030 [inline]
       __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1030
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&rs->rs_recv_lock){...-}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3108 [inline]
       check_prevs_add kernel/locking/lockdep.c:3227 [inline]
       validate_chain kernel/locking/lockdep.c:3842 [inline]
       __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074
       lock_acquire kernel/locking/lockdep.c:5691 [inline]
       lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656
       __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline]
       _raw_read_lock_irqsave+0x49/0x90 kernel/locking/spinlock.c:236
       rds_wake_sk_sleep+0x23/0xe0 net/rds/af_rds.c:109
       rds_send_remove_from_sock+0xb9/0x9e0 net/rds/send.c:634
       rds_send_path_drop_acked+0x2f3/0x3d0 net/rds/send.c:710
       rds_tcp_write_space+0x1b5/0x6d0 net/rds/tcp_send.c:198
       tcp_new_space net/ipv4/tcp_input.c:5483 [inline]
       tcp_check_space+0x11b/0x810 net/ipv4/tcp_input.c:5502
       tcp_data_snd_check net/ipv4/tcp_input.c:5511 [inline]
       tcp_rcv_established+0x8be/0x1f90 net/ipv4/tcp_input.c:6021
       tcp_v4_do_rcv+0x65a/0x9c0 net/ipv4/tcp_ipv4.c:1721
       sk_backlog_rcv include/net/sock.h:1113 [inline]
       __release_sock+0x133/0x3b0 net/core/sock.c:2917
       release_sock+0x58/0x1b0 net/core/sock.c:3484
       rds_send_xmit+0xafc/0x2580 net/rds/send.c:422
       rds_sendmsg+0x27d3/0x31a0 net/rds/send.c:1381
       sock_sendmsg_nosec net/socket.c:724 [inline]
       sock_sendmsg+0xde/0x190 net/socket.c:747
       ____sys_sendmsg+0x71c/0x900 net/socket.c:2503
       ___sys_sendmsg+0x110/0x1b0 net/socket.c:2557
       __sys_sendmsg+0xf7/0x1c0 net/socket.c:2586
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/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);
  rlock(&rs->rs_recv_lock);

 *** DEADLOCK ***

3 locks held by syz-executor361/5071:
 #0: ffff88807e4eef70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1697 [inline]
 #0: ffff88807e4eef70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x1a/0xa0 net/ipv4/tcp.c:3345
 #1: ffff88807e4ef1f8 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x29/0x6d0 net/rds/tcp_send.c:184
 #2: ffff88807c0c9100 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x340/0x9e0 net/rds/send.c:628

stack backtrace:
CPU: 1 PID: 5071 Comm: syz-executor361 Not tainted 6.3.0-syzkaller-13413-gcceac9267887 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2188
 check_prev_add kernel/locking/lockdep.c:3108 [inline]
 check_prevs_add kernel/locking/lockdep.c:3227 [inline]
 validate_chain kernel/locking/lockdep.c:3842 [inline]
 __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074
 lock_acquire kernel/locking/lockdep.c:5691 [inline]
 lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656
 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline]
 _raw_read_lock_irqsave+0x49/0x90 kernel/locking/spinlock.c:236
 rds_wake_sk_sleep+0x23/0xe0 net/rds/af_rds.c:109
 rds_send_remove_from_sock+0xb9/0x9e0 net/rds/send.c:634
 rds_send_path_drop_acked+0x2f3/0x3d0 net/rds/send.c:710
 rds_tcp_write_space+0x1b5/0x6d0 net/rds/tcp_send.c:198
 tcp_new_space net/ipv4/tcp_input.c:5483 [inline]
 tcp_check_space+0x11b/0x810 net/ipv4/tcp_input.c:5502
 tcp_data_snd_check net/ipv4/tcp_input.c:5511 [inline]
 tcp_rcv_established+0x8be/0x1f90 net/ipv4/tcp_input.c:6021
 tcp_v4_do_rcv+0x65a/0x9c0 net/ipv4/tcp_ipv4.c:1721
 sk_backlog_rcv include/net/sock.h:1113 [inline]
 __release_sock+0x133/0x3b0 net/core/sock.c:2917
 release_sock+0x58/0x1b0 net/core/sock.c:3484
 rds_send_xmit+0xafc/0x2580 net/rds/send.c:422
 rds_sendmsg+0x27d3/0x31a0 net/rds/send.c:1381
 sock_sendmsg_nosec net/socket.c:724 [inline]
 sock_sendmsg+0xde/0x190 net/socket.c:747
 ____sys_sendmsg+0x71c/0x900 net/socket.c:2503
 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2557
 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2586
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f995a9c0c49
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:00007f995a930318 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f995aa48448 RCX: 00007f995a9c0c49
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 00007f995aa48440 R08: 00007f995a930700 R09: 0000000000000000
R10: 00007f995a930700 R11: 0000000000000246 R12: 00007f995aa16064
R13: 00007fffb3fe7f0f R14: 00007f995a930400 R15: 0000000000022000
 </TASK>

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/11 13:14 net cceac9267887 0fbd49f4 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in rds_wake_sk_sleep
2023/05/11 10:01 net-next 8a690c151134 0fbd49f4 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in rds_wake_sk_sleep
2023/05/11 08:11 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 14f8db1c0f9a 0fbd49f4 .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in rds_wake_sk_sleep
2023/03/03 06:24 upstream 04a357b1f6f0 f8902b57 .config console log report syz [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in rds_wake_sk_sleep
2023/01/02 17:38 net-old 91e2286160ed ab32d508 .config console log report syz [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in rds_wake_sk_sleep
2023/12/14 16:10 upstream 5bd7ef53ffe5 3222d10c .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in rds_wake_sk_sleep
2023/09/30 05:18 upstream 71e58659bfc0 8e26a358 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in rds_wake_sk_sleep
2023/06/21 10:18 upstream 99ec1ed7c2ed 09ffe269 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in rds_wake_sk_sleep
2022/06/26 21:05 upstream 0840a7914caa a371c43c .config strace log report syz C ci-upstream-kasan-gce-selinux-root possible deadlock in rds_wake_sk_sleep
2022/05/17 09:18 upstream 42226c989789 744a39e2 .config strace log report syz C ci-upstream-kasan-gce-smack-root possible deadlock in rds_wake_sk_sleep
2023/10/22 07:26 upstream 4d7b04c0cda3 361b23dc .config console log report syz C [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in rds_wake_sk_sleep
2022/05/15 21:52 linux-next 1e1b28b936ae 744a39e2 .config strace log report syz C ci-upstream-linux-next-kasan-gce-root possible deadlock in rds_wake_sk_sleep
2023/04/30 10:33 linux-next 92e815cf07ed 62df2017 .config console log report syz [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in rds_wake_sk_sleep
2023/10/30 17:16 upstream ffc253263a13 b5729d82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rds_wake_sk_sleep
2023/02/20 12:10 upstream c9c3395d5e3d bcdf85f8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rds_wake_sk_sleep
2022/06/15 08:52 net-old d7dd6eccfbc9 127d1faf .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in rds_wake_sk_sleep
* Struck through repros no longer work on HEAD.