syzbot


BUG: sleeping function called from invalid context in sk_psock_stop

Status: fixed on 2023/02/24 13:50
Reported-by: syzbot+140186ceba0c496183bc@syzkaller.appspotmail.com
Fix commit: 697fb80a5364 bpf: Fix sockmap calling sleepable function in teardown path
First crash: 354d, last: 293d

Cause bisection: introduced by (bisect log) :
commit d8616ee2affcff37c5d315310da557a694a3303d
Author: Wang Yufen <wangyufen@huawei.com>
Date: Tue May 24 07:53:11 2022 +0000

  bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues

Crash: BUG: sleeping function called from invalid context in sock_map_destroy (log)
Repro: C syz .config
Discussions (3)
Title Replies (including bot) Last reply
[PATCH bpf-next] bpf: sockmap calling sleepable function in teardown path 2 (2) 2022/06/28 07:40
Re: [syzbot] BUG: sleeping function called from invalid context in sk_psock_stop 1 (1) 2022/06/14 19:58
[syzbot] BUG: sleeping function called from invalid context in sk_psock_stop 1 (2) 2022/06/10 14:35
Last patch testing requests (1)
Created Duration User Patch Repo Result
2022/06/11 02:00 18m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git ff539ac73ea5 OK log

Sample crash report:
BUG: sleeping function called from invalid context at kernel/workqueue.c:3010
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3723, name: syz-executor173
preempt_count: 201, expected: 0
RCU nest depth: 0, expected: 0
3 locks held by syz-executor173/3723:
 #0: ffff88806f1a7a10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:741 [inline]
 #0: ffff88806f1a7a10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: __sock_release+0x86/0x280 net/socket.c:649
 #1: ffff88807e479930 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1664 [inline]
 #1: ffff88807e479930 (sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_close+0x1e/0xc0 net/ipv4/tcp.c:2930
 #2: ffff88807e4798b0 (slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:349 [inline]
 #2: ffff88807e4798b0 (slock-AF_INET){+.-.}-{2:2}, at: __tcp_close+0x4d3/0xf50 net/ipv4/tcp.c:2853
Preemption disabled at:
[<ffffffff87da6a2b>] local_bh_disable include/linux/bottom_half.h:20 [inline]
[<ffffffff87da6a2b>] __tcp_close+0x4cb/0xf50 net/ipv4/tcp.c:2852
CPU: 0 PID: 3723 Comm: syz-executor173 Not tainted 5.19.0-rc3-syzkaller-00573-gebeae54d3a77 #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:9821
 start_flush_work kernel/workqueue.c:3010 [inline]
 __flush_work+0x109/0xb10 kernel/workqueue.c:3074
 __cancel_work_timer+0x3f9/0x570 kernel/workqueue.c:3162
 sk_psock_stop+0x4cb/0x630 net/core/skmsg.c:807
 sock_map_destroy+0x333/0x760 net/core/sock_map.c:1581
 inet_csk_destroy_sock+0x196/0x440 net/ipv4/inet_connection_sock.c:1011
 __tcp_close+0xb92/0xf50 net/ipv4/tcp.c:2919
 tcp_close+0x29/0xc0 net/ipv4/tcp.c:2931
 sock_map_close+0x3b9/0x780 net/core/sock_map.c:1607
 inet_release+0x12e/0x280 net/ipv4/af_inet.c:428
 __sock_release+0xcd/0x280 net/socket.c:650
 sock_close+0x18/0x20 net/socket.c:1365
 __fput+0x277/0x9d0 fs/file_table.c:317
 task_work_run+0xdd/0x1a0 kernel/task_work.c:177
 get_signal+0x1c5/0x2600 kernel/signal.c:2634
 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869
 exit_to_user_mode_loop kernel/entry/common.c:166 [inline]
 exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f3d3fe9abf9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 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:00007f3d3f647308 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: 0000000000278000 RBX: 00007f3d3ff234c8 RCX: 00007f3d3fe9abf9
RDX: 00000000fffffdef RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 00007f3d3ff234c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000004001 R11: 0000000000000246 R12: 00007f3d3fef04dc
R13: 00007ffdd94d98df R14: 00007f3d3f647400 R15: 0000000000022000
 </TASK>

Crashes (232):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2022/06/27 00:42 net-next-old ebeae54d3a77 a371c43c .config console log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/26 15:56 net-next-old ebeae54d3a77 a371c43c .config strace log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/26 02:14 net-next-old ebeae54d3a77 a371c43c .config console log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/25 12:22 net-next-old 5d04b0b634bb a371c43c .config console log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/23 17:43 net-next-old 85763435d5b5 912f5df7 .config console log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/27 00:07 linux-next 2f9cb3d3bd73 a371c43c .config console log report syz C ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/25 11:46 linux-next 2f9cb3d3bd73 a371c43c .config console log report syz C ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/09 20:02 linux-next ff539ac73ea5 0d5abf15 .config strace log report syz C ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/10 04:48 net-next-old 877d4e3cedd1 b5765a15 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/09 21:53 net-next-old 877d4e3cedd1 b5765a15 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/09 10:30 net-next-old 16bd188eae2d b5765a15 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/09 02:10 net-next-old 9d542f7bf197 b5765a15 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/08 21:58 net-next-old 9d542f7bf197 b5765a15 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/08 12:08 net-next-old cf21b355ccb3 bff65f44 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/07 02:37 net-next-old 4874fb9484be bff65f44 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/06 16:56 net-next-old 7e40e16e38ba bff65f44 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/05 11:27 net-next-old 874bdbfe624e bff65f44 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/05 03:45 net-next-old 874bdbfe624e bff65f44 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/04 22:57 net-next-old 798661c73672 bff65f44 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/03 23:40 net-next-old d0bf1fe6454e 1434eec0 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/08 00:44 linux-next cb71b93c2dc3 88e3a122 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/07 06:22 linux-next cb71b93c2dc3 88e3a122 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/06 01:14 linux-next cb71b93c2dc3 e853abd9 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/05 03:49 linux-next cb71b93c2dc3 1c9013ac .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/04 10:45 linux-next cb71b93c2dc3 1c9013ac .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/03 02:06 linux-next cb71b93c2dc3 1c9013ac .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/02 19:07 linux-next cb71b93c2dc3 1c9013ac .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/02 16:38 linux-next cb71b93c2dc3 1c9013ac .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/01 19:08 linux-next cb71b93c2dc3 fef302b1 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/08/01 00:55 linux-next cb71b93c2dc3 fef302b1 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/28 02:58 linux-next cb71b93c2dc3 fb95c74d .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/25 21:07 linux-next cb71b93c2dc3 664c519c .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/25 04:13 linux-next cb71b93c2dc3 22343af4 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/24 18:10 linux-next cb71b93c2dc3 22343af4 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/23 09:25 linux-next cb71b93c2dc3 22343af4 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/22 20:11 linux-next cb71b93c2dc3 22343af4 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/21 22:16 linux-next cb71b93c2dc3 5e6028b9 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/18 18:59 linux-next cb71b93c2dc3 ff988920 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/17 10:49 linux-next cb71b93c2dc3 95cb00d1 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/16 11:06 linux-next cb71b93c2dc3 95cb00d1 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/13 17:24 linux-next cb71b93c2dc3 5d921b08 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/13 02:14 linux-next cb71b93c2dc3 d91dd8ea .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/12 15:27 linux-next cb71b93c2dc3 d91dd8ea .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/11 11:02 linux-next cb71b93c2dc3 da3d6955 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/10 14:57 linux-next cb71b93c2dc3 b5765a15 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/08 18:54 linux-next cb71b93c2dc3 b5765a15 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/08 15:38 linux-next cb71b93c2dc3 b5765a15 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/07 10:12 linux-next cb71b93c2dc3 bff65f44 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/07 08:20 linux-next cb71b93c2dc3 bff65f44 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/05 01:31 linux-next cb71b93c2dc3 bff65f44 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/04 20:46 linux-next cb71b93c2dc3 bff65f44 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/07/04 15:58 linux-next cb71b93c2dc3 bff65f44 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
2022/06/08 08:21 linux-next 03c312cc5f47 b2706118 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in sk_psock_stop
* Struck through repros no longer work on HEAD.