syzbot


BUG: sleeping function called from invalid context in smc_pnet_apply_ib

Status: fixed on 2023/02/24 13:50
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+4f322a6d84e991c38775@syzkaller.appspotmail.com
Fix commit: 7ff57e98fb78 net/smc: Use a mutex for locking "struct smc_pnettable"
First crash: 964d, last: 956d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: BUG: sleeping function called from invalid context in smc_pnet_apply_ib (log)
Repro: C syz .config
  
Discussions (5)
Title Replies (including bot) Last reply
[PATCH 5.16 000/164] 5.16.12-rc1 review 177 (177) 2022/03/02 07:05
[PATCH 5.15 000/139] 5.15.26-rc1 review 150 (150) 2022/03/02 07:04
[PATCH 5.10 00/80] 5.10.103-rc1 review 89 (89) 2022/03/02 07:04
[PATCH] net/smc: Use a mutex for locking "struct smc_pnettable" 2 (2) 2022/02/23 17:59
[syzbot] BUG: sleeping function called from invalid context in smc_pnet_apply_ib 6 (10) 2022/02/23 09:40
Last patch testing requests (2)
Created Duration User Patch Repo Result
2022/02/23 09:23 9m fmdefrancesco@gmail.com patch upstream OK
2022/02/23 08:32 5m fmdefrancesco@gmail.com patch upstream error

Sample crash report:
infiniband syz1: set active
infiniband syz1: added lo
RDS/IB: syz1: added
smc: adding ib device syz1 with port count 1
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:577
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3589, name: syz-executor180
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
6 locks held by syz-executor180/3589:
 #0: ffffffff90865838 (&rdma_nl_types[idx].sem){.+.+}-{3:3}, at: rdma_nl_rcv_msg+0x161/0x690 drivers/infiniband/core/netlink.c:164
 #1: ffffffff8d04edf0 (link_ops_rwsem){++++}-{3:3}, at: nldev_newlink+0x25d/0x560 drivers/infiniband/core/nldev.c:1707
 #2: ffffffff8d03e650 (devices_rwsem){++++}-{3:3}, at: enable_device_and_get+0xfc/0x3b0 drivers/infiniband/core/device.c:1321
 #3: ffffffff8d03e510 (clients_rwsem){++++}-{3:3}, at: enable_device_and_get+0x15b/0x3b0 drivers/infiniband/core/device.c:1329
 #4: ffff8880790445c0 (&device->client_data_rwsem){++++}-{3:3}, at: add_client_context+0x3d0/0x5e0 drivers/infiniband/core/device.c:718
 #5: ffff88814a29c818 (&pnettable->lock){++++}-{2:2}, at: smc_pnetid_by_table_ib+0x18c/0x470 net/smc/smc_pnet.c:1159
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 3589 Comm: syz-executor180 Not tainted 5.17.0-rc3-syzkaller-00174-g5740d0689096 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 __might_resched.cold+0x222/0x26b kernel/sched/core.c:9576
 __mutex_lock_common kernel/locking/mutex.c:577 [inline]
 __mutex_lock+0x9f/0x12f0 kernel/locking/mutex.c:733
 smc_pnet_apply_ib+0x28/0x160 net/smc/smc_pnet.c:251
 smc_pnetid_by_table_ib+0x2ae/0x470 net/smc/smc_pnet.c:1164
 smc_ib_add_dev+0x4d7/0x900 net/smc/smc_ib.c:940
 add_client_context+0x405/0x5e0 drivers/infiniband/core/device.c:720
 enable_device_and_get+0x1cd/0x3b0 drivers/infiniband/core/device.c:1331
 ib_register_device drivers/infiniband/core/device.c:1419 [inline]
 ib_register_device+0x814/0xaf0 drivers/infiniband/core/device.c:1365
 rxe_register_device+0x2fe/0x3b0 drivers/infiniband/sw/rxe/rxe_verbs.c:1146
 rxe_add+0x1331/0x1710 drivers/infiniband/sw/rxe/rxe.c:246
 rxe_net_add+0x8c/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:538
 rxe_newlink drivers/infiniband/sw/rxe/rxe.c:268 [inline]
 rxe_newlink+0xa9/0xd0 drivers/infiniband/sw/rxe/rxe.c:249
 nldev_newlink+0x30a/0x560 drivers/infiniband/core/nldev.c:1717
 rdma_nl_rcv_msg+0x36d/0x690 drivers/infiniband/core/netlink.c:195
 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
 rdma_nl_rcv+0x2ee/0x430 drivers/infiniband/core/netlink.c:259
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:705 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:725
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2413
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f7ef25bed59
Code: 28 c3 e8 5a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcd0ce91d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7ef25bed59
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000005
RBP: 00007f7ef25827c0 R08: 0000000000000014 R09: 0000000000000000
R10: 0000000000000041 R11: 0000000000000246 R12: 00007f7ef2582850
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

=============================
[ BUG: Invalid wait context ]
5.17.0-rc3-syzkaller-00174-g5740d0689096 #0 Tainted: G        W        
-----------------------------
syz-executor180/3589 is trying to lock:
ffffffff8d7100d8 (smc_ib_devices.mutex){+.+.}-{3:3}, at: smc_pnet_apply_ib+0x28/0x160 net/smc/smc_pnet.c:251
other info that might help us debug this:
context-{4:4}
6 locks held by syz-executor180/3589:
 #0: ffffffff90865838 (&rdma_nl_types[idx].sem){.+.+}-{3:3}, at: rdma_nl_rcv_msg+0x161/0x690 drivers/infiniband/core/netlink.c:164
 #1: ffffffff8d04edf0 (link_ops_rwsem){++++}-{3:3}, at: nldev_newlink+0x25d/0x560 drivers/infiniband/core/nldev.c:1707
 #2: ffffffff8d03e650 (devices_rwsem){++++}-{3:3}, at: enable_device_and_get+0xfc/0x3b0 drivers/infiniband/core/device.c:1321
 #3: ffffffff8d03e510 (clients_rwsem){++++}-{3:3}, at: enable_device_and_get+0x15b/0x3b0 drivers/infiniband/core/device.c:1329
 #4: ffff8880790445c0 (&device->client_data_rwsem){++++}-{3:3}, at: add_client_context+0x3d0/0x5e0 drivers/infiniband/core/device.c:718
 #5: ffff88814a29c818 (&pnettable->lock){++++}-{2:2}, at: smc_pnetid_by_table_ib+0x18c/0x470 net/smc/smc_pnet.c:1159
stack backtrace:
CPU: 0 PID: 3589 Comm: syz-executor180 Tainted: G        W         5.17.0-rc3-syzkaller-00174-g5740d0689096 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_lock_invalid_wait_context kernel/locking/lockdep.c:4678 [inline]
 check_wait_context kernel/locking/lockdep.c:4739 [inline]
 __lock_acquire.cold+0x213/0x3ab kernel/locking/lockdep.c:4977
 lock_acquire kernel/locking/lockdep.c:5639 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
 __mutex_lock_common kernel/locking/mutex.c:600 [inline]
 __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733
 smc_pnet_apply_ib+0x28/0x160 net/smc/smc_pnet.c:251
 smc_pnetid_by_table_ib+0x2ae/0x470 net/smc/smc_pnet.c:1164
 smc_ib_add_dev+0x4d7/0x900 net/smc/smc_ib.c:940
 add_client_context+0x405/0x5e0 drivers/infiniband/core/device.c:720
 enable_device_and_get+0x1cd/0x3b0 drivers/infiniband/core/device.c:1331
 ib_register_device drivers/infiniband/core/device.c:1419 [inline]
 ib_register_device+0x814/0xaf0 drivers/infiniband/core/device.c:1365
 rxe_register_device+0x2fe/0x3b0 drivers/infiniband/sw/rxe/rxe_verbs.c:1146
 rxe_add+0x1331/0x1710 drivers/infiniband/sw/rxe/rxe.c:246
 rxe_net_add+0x8c/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:538
 rxe_newlink drivers/infiniband/sw/rxe/rxe.c:268 [inline]
 rxe_newlink+0xa9/0xd0 drivers/infiniband/sw/rxe/rxe.c:249
 nldev_newlink+0x30a/0x560 drivers/infiniband/core/nldev.c:1717
 rdma_nl_rcv_msg+0x36d/0x690 drivers/infiniband/core/netlink.c:195
 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
 rdma_nl_rcv+0x2ee/0x430 drivers/infiniband/core/netlink.c:259
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:705 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:725
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2413
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f7ef25bed59
Code: 28 c3 e8 5a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcd0ce91d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7ef25bed59
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000005
RBP: 00007f7ef25827c0 R08: 0000000000000014 R09: 0000000000000000
R10: 0000000000000041 R11: 0000000000000246 R12: 00007f7ef2582850
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
smc:    ib device syz1 port 1 has pnetid SYZ2 (user defined)

Crashes (92):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/02/17 18:12 net-old 5740d0689096 3cd800e4 .config console log report syz C ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/17 19:15 net-next-old 5a8fb33e5305 3cd800e4 .config console log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/25 13:50 upstream 73878e5eb1bd 7c337266 .config console log report info ci-upstream-kasan-gce-selinux-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 21:42 upstream 73878e5eb1bd b28851a4 .config console log report info ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 16:06 upstream 23d04328444a b28851a4 .config console log report info ci-upstream-kasan-gce-smack-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 13:45 upstream 23d04328444a b28851a4 .config console log report info ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 01:23 upstream 23d04328444a 6e821dbf .config console log report info ci-upstream-kasan-gce-smack-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 23:57 upstream 23d04328444a 6e821dbf .config console log report info ci-qemu-upstream BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 21:45 upstream 23d04328444a 6e821dbf .config console log report info ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 11:43 upstream 5c1ee569660d 6e821dbf .config console log report info ci-qemu-upstream BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 10:00 upstream 5c1ee569660d 6e821dbf .config console log report info ci-qemu-upstream BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 08:36 upstream 5c1ee569660d 6e821dbf .config console log report info ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 21:13 upstream 917bbdb107f8 6e821dbf .config console log report info ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 20:13 upstream 917bbdb107f8 6e821dbf .config console log report info ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 22:53 upstream 038101e6b2cd 6e821dbf .config console log report info ci-upstream-kasan-gce-selinux-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 13:51 upstream cfb92440ee71 3cd800e4 .config console log report info ci-upstream-kasan-gce-smack-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 12:53 upstream cfb92440ee71 3cd800e4 .config console log report info ci-upstream-kasan-gce-selinux-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 01:14 upstream 7f25f0412c9e 3cd800e4 .config console log report info ci-qemu-upstream BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 21:54 upstream 7f25f0412c9e 3cd800e4 .config console log report info ci-upstream-kasan-gce-selinux-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 21:30 upstream 7f25f0412c9e 3cd800e4 .config console log report info ci-upstream-kasan-gce-smack-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 20:10 upstream 7f25f0412c9e 3cd800e4 .config console log report info ci-qemu-upstream BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 20:34 upstream 73878e5eb1bd b28851a4 .config console log report info ci-qemu-upstream-386 BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 03:52 upstream 7f25f0412c9e 3cd800e4 .config console log report info ci-qemu-upstream-386 BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 15:02 net-old 5facf49702b6 b28851a4 .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 20:43 net-old 0228d37bd1a4 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 05:59 net-old ef527f968ae0 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 13:38 net-old 5663b85462a6 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 11:31 net-old 5663b85462a6 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 09:33 net-old b6ad6261d277 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 04:30 net-old b6ad6261d277 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 00:09 net-old b6ad6261d277 6e821dbf .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 14:51 net-old 5a3449734bcb 3cd800e4 .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 05:45 net-old 8940e6b669ca 3cd800e4 .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 00:47 net-old 8940e6b669ca 3cd800e4 .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 22:40 net-old 8940e6b669ca 3cd800e4 .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/17 11:41 net-old c832962ac972 2bea8a27 .config console log report info ci-upstream-net-this-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/25 10:51 net-next-old 9e7b78dc8826 7c337266 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/25 06:05 net-next-old 9e7b78dc8826 7c337266 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/25 02:13 net-next-old 9e7b78dc8826 7c337266 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 10:54 net-next-old 6a47cdc38143 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/24 05:05 net-next-old 6a47cdc38143 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 19:06 net-next-old 922ea87ff6f2 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/23 03:07 net-next-old ee8f97efa7a5 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 23:50 net-next-old ee8f97efa7a5 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/22 19:12 net-next-old b6553c71813f 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 20:39 net-next-old 7b779cc8846a 6e821dbf .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 17:44 net-next-old dd3573487d90 3cd800e4 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 14:50 net-next-old dd3573487d90 3cd800e4 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/21 00:16 net-next-old adfb62dbda49 3cd800e4 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 22:36 net-next-old adfb62dbda49 3cd800e4 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 22:07 net-next-old adfb62dbda49 3cd800e4 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 20:27 net-next-old adfb62dbda49 3cd800e4 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in smc_pnet_apply_ib
2022/02/20 21:57 linux-next ef6b35306dd8 3cd800e4 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in smc_pnet_apply_ib
* Struck through repros no longer work on HEAD.