syzbot


BUG: sleeping function called from invalid context in _copy_to_iter

Status: fixed on 2021/11/10 00:50
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+8760ca6c1ee783ac4abd@syzkaller.appspotmail.com
Fix commit: 876c14ad014d af_unix: fix holding spinlock in oob handling
First crash: 995d, last: 984d
Cause bisection: introduced by (bisect log) :
commit 314001f0bf927015e459c9d387d62a231fe93af3
Author: Rao Shoaib <rao.shoaib@oracle.com>
Date: Sun Aug 1 07:57:07 2021 +0000

  af_unix: Add OOB support

Crash: BUG: sleeping function called from invalid context in _copy_to_iter (log)
Repro: C syz .config
  
Discussions (5)
Title Replies (including bot) Last reply
[PATCH v2 0/1] Bug fixes for AF_UNIX OOB Patch 3 (3) 2021/08/13 18:01
[PATCH] af_unix: fix holding spinlock in oob handling 8 (8) 2021/08/13 17:59
[PATCH] af_unix: fix holding spinlock in oob handling 1 (1) 2021/08/13 17:46
[PATCH] af_unix: Add OOB support 3 (3) 2021/08/11 21:57
[syzbot] BUG: sleeping function called from invalid context in _copy_to_iter 20 (21) 2021/08/10 18:29
Last patch testing requests (1)
Created Duration User Patch Repo Result
2021/08/12 04:48 16m chouhan.shreyansh630@gmail.com upstream OK

Sample crash report:
BUG: sleeping function called from invalid context at lib/iov_iter.c:619
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 8443, name: syz-executor700
2 locks held by syz-executor700/8443:
 #0: ffff888028fa0d00 (&u->iolock){+.+.}-{3:3}, at: unix_stream_read_generic+0x16c6/0x2190 net/unix/af_unix.c:2501
 #1: ffff888028fa0df0 (&u->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline]
 #1: ffff888028fa0df0 (&u->lock){+.+.}-{2:2}, at: unix_stream_read_generic+0x16d0/0x2190 net/unix/af_unix.c:2502
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 PID: 8443 Comm: syz-executor700 Not tainted 5.14.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 ___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:9154
 __might_fault+0x6e/0x180 mm/memory.c:5258
 _copy_to_iter+0x199/0x1600 lib/iov_iter.c:619
 copy_to_iter include/linux/uio.h:139 [inline]
 simple_copy_to_iter+0x4c/0x70 net/core/datagram.c:519
 __skb_datagram_iter+0x10f/0x770 net/core/datagram.c:425
 skb_copy_datagram_iter+0x40/0x50 net/core/datagram.c:533
 skb_copy_datagram_msg include/linux/skbuff.h:3620 [inline]
 unix_stream_read_actor+0x78/0xc0 net/unix/af_unix.c:2701
 unix_stream_recv_urg net/unix/af_unix.c:2433 [inline]
 unix_stream_read_generic+0x17cd/0x2190 net/unix/af_unix.c:2504
 unix_stream_recvmsg+0xb1/0xf0 net/unix/af_unix.c:2717
 sock_recvmsg_nosec net/socket.c:944 [inline]
 sock_recvmsg net/socket.c:962 [inline]
 sock_recvmsg net/socket.c:958 [inline]
 ____sys_recvmsg+0x2c4/0x600 net/socket.c:2622
 ___sys_recvmsg+0x127/0x200 net/socket.c:2664
 do_recvmmsg+0x24d/0x6d0 net/socket.c:2758
 __sys_recvmmsg net/socket.c:2837 [inline]
 __do_sys_recvmmsg net/socket.c:2860 [inline]
 __se_sys_recvmmsg net/socket.c:2853 [inline]
 __x64_sys_recvmmsg+0x20b/0x260 net/socket.c:2853
 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:0x43ef39
Code: 28 c3 e8 2a 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:00007ffca8776d68 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ef39
RDX: 0000000000000700 RSI: 0000000020001140 RDI: 0000000000000004
RBP: 0000000000402f20 R08: 0000000000000000 R09: 0000000000400488
R10: 0000000000000007 R11: 0000000000000246 R12: 0000000000402fb0
R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488

=============================
[ BUG: Invalid wait context ]
5.14.0-rc3-syzkaller #0 Tainted: G        W        
-----------------------------
syz-executor700/8443 is trying to lock:
ffff8880212b6a28 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0xa3/0x180 mm/memory.c:5260
other info that might help us debug this:
context-{4:4}
2 locks held by syz-executor700/8443:
 #0: ffff888028fa0d00 (&u->iolock){+.+.}-{3:3}, at: unix_stream_read_generic+0x16c6/0x2190 net/unix/af_unix.c:2501
 #1: ffff888028fa0df0 (&u->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline]
 #1: ffff888028fa0df0 (&u->lock){+.+.}-{2:2}, at: unix_stream_read_generic+0x16d0/0x2190 net/unix/af_unix.c:2502
stack backtrace:
CPU: 1 PID: 8443 Comm: syz-executor700 Tainted: G        W         5.14.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 print_lock_invalid_wait_context kernel/locking/lockdep.c:4666 [inline]
 check_wait_context kernel/locking/lockdep.c:4727 [inline]
 __lock_acquire.cold+0x213/0x3ab kernel/locking/lockdep.c:4965
 lock_acquire kernel/locking/lockdep.c:5625 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590
 __might_fault mm/memory.c:5261 [inline]
 __might_fault+0x106/0x180 mm/memory.c:5246
 _copy_to_iter+0x199/0x1600 lib/iov_iter.c:619
 copy_to_iter include/linux/uio.h:139 [inline]
 simple_copy_to_iter+0x4c/0x70 net/core/datagram.c:519
 __skb_datagram_iter+0x10f/0x770 net/core/datagram.c:425
 skb_copy_datagram_iter+0x40/0x50 net/core/datagram.c:533
 skb_copy_datagram_msg include/linux/skbuff.h:3620 [inline]
 unix_stream_read_actor+0x78/0xc0 net/unix/af_unix.c:2701
 unix_stream_recv_urg net/unix/af_unix.c:2433 [inline]
 unix_stream_read_generic+0x17cd/0x2190 net/unix/af_unix.c:2504
 unix_stream_recvmsg+0xb1/0xf0 net/unix/af_unix.c:2717
 sock_recvmsg_nosec net/socket.c:944 [inline]
 sock_recvmsg net/socket.c:962 [inline]
 sock_recvmsg net/socket.c:958 [inline]
 ____sys_recvmsg+0x2c4/0x600 net/socket.c:2622
 ___sys_recvmsg+0x127/0x200 net/socket.c:2664
 do_recvmmsg+0x24d/0x6d0 net/socket.c:2758
 __sys_recvmmsg net/socket.c:2837 [inline]
 __do_sys_recvmmsg net/socket.c:2860 [inline]
 __se_sys_recvmmsg net/socket.c:2853 [inline]
 __x64_sys_recvmmsg+0x20b/0x260 net/socket.c:2853
 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:0x43ef39
Code: 28 c3 e8 2a 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:00007ffca8776d68 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ef39
RDX: 0000000000000700 RSI: 0000000020001140 RDI: 0000000000000004
RBP: 0000000000402f20 R08: 0000000000000000 R09: 0000000000400488
R10: 0000000000000007 R11: 0000000000000246 R12: 0000

Crashes (60):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/04 23:47 net-next-old c2eecaa193ff b97d64c9 .config console log report syz C ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/13 20:02 bpf-next 5236ad82962e 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/13 17:46 bpf-next 5236ad82962e 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/13 15:19 bpf-next 25dc3895baaa 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/13 13:30 bpf-next 25dc3895baaa 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/13 10:39 bpf-next 25dc3895baaa 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/13 04:44 bpf-next 25dc3895baaa 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 21:43 bpf-next 25dc3895baaa 3fd2ea69 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 20:08 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 19:38 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 18:32 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 15:43 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 10:24 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 07:00 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 03:11 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/12 02:11 bpf-next 25dc3895baaa 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 23:52 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 23:05 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 19:47 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 16:39 net-next-old d3432bf10f17 6972b106 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 13:38 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 12:59 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 12:28 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/11 09:47 bpf-next ebd0d30cc5e4 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/10 11:09 net-next-old 2a2b6e3640c4 6972b106 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/08 06:25 net-next-old f9be84db09d2 6972b106 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/07 04:33 net-next-old 8fbebef80107 6972b106 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/07 02:13 net-next-old 8fbebef80107 6972b106 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/07 01:57 net-next-old 8fbebef80107 6972b106 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/06 04:03 net-next-old 23809a726c0d d2d6e680 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/04 23:32 net-next-old c2eecaa193ff b97d64c9 .config console log report info ci-upstream-net-kasan-gce BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/16 03:28 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/15 23:32 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/15 21:20 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/15 13:53 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/15 05:22 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 20:47 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 16:34 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 14:52 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 10:42 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 07:07 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:58 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:58 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:58 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:54 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:48 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:48 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:48 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/14 05:26 linux-next 4b358aabb93a 2489ab88 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/08 22:06 linux-next 7999516e20bd 6972b106 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
2021/08/08 07:10 linux-next 7999516e20bd 6972b106 .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in _copy_to_iter
* Struck through repros no longer work on HEAD.