2022-12-08 20:14:43

by Eric Dumazet

[permalink] [raw]
Subject: Re: [syzbot] WARNING in _copy_from_iter

On Thu, Dec 8, 2022 at 8:36 PM syzbot
<[email protected]> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 591cd61541b9 Add linux-next specific files for 20221207
> git tree: linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=15d12929880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=8b2d3e63e054c24f
> dashboard link: https://syzkaller.appspot.com/bug?extid=d43608d061e8847ec9f3
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=172536fb880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12d00a7d880000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/bc862c01ec56/disk-591cd615.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/8f9b93f8ed2f/vmlinux-591cd615.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/9d5cb636d548/bzImage-591cd615.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 5086 at lib/iov_iter.c:629 _copy_from_iter+0x2ed/0xf70 lib/iov_iter.c:629
> Modules linked in:
> CPU: 0 PID: 5086 Comm: syz-executor371 Not tainted 6.1.0-rc8-next-20221207-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
> RIP: 0010:_copy_from_iter+0x2ed/0xf70 lib/iov_iter.c:629
> Code: 77 fd 44 89 fb e9 33 ff ff ff e8 be 34 77 fd be 79 02 00 00 48 c7 c7 e0 59 a6 8a e8 fd 6f b0 fd e9 17 fe ff ff e8 a3 34 77 fd <0f> 0b 45 31 ff e9 7b ff ff ff e8 94 34 77 fd 31 ff 89 ee e8 fb 30
> RSP: 0018:ffffc90003e1f828 EFLAGS: 00010293
> RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
> RDX: ffff888026548000 RSI: ffffffff840a6e5d RDI: 0000000000000001
> RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000000 R12: ffffc90003e1fd00
> R13: ffff888079c498f8 R14: ffffc90003e1fd00 R15: 0000000000000000
> FS: 0000555557073300(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 000000000045b630 CR3: 000000007d92a000 CR4: 00000000003506f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> copy_from_iter include/linux/uio.h:187 [inline]
> copy_from_iter_full include/linux/uio.h:194 [inline]
> tipc_msg_build+0x2d4/0x10a0 net/tipc/msg.c:404
> __tipc_sendmsg+0xada/0x1870 net/tipc/socket.c:1505
> tipc_connect+0x57b/0x6b0 net/tipc/socket.c:2624
> __sys_connect_file+0x153/0x1a0 net/socket.c:1976
> __sys_connect+0x165/0x1a0 net/socket.c:1993
> __do_sys_connect net/socket.c:2003 [inline]
> __se_sys_connect net/socket.c:2000 [inline]
> __x64_sys_connect+0x73/0xb0 net/socket.c:2000
> 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:0x7fac68eeeb19
> 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:00007ffe4214d778 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
> RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fac68eeeb19
> RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000003
> RBP: 00007fac68eb2cc0 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007fac68eb2d50
> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
> </TASK>
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at [email protected].
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches

Exposes an old bug in tipc ?

Seems a new check added by Al in :

Author: Al Viro <[email protected]>
Date: Thu Sep 15 20:11:15 2022 -0400

iov_iter: saner checks for attempt to copy to/from iterator

instead of "don't do it to ITER_PIPE" check for ->data_source being
false on copying from iterator. Check for !->data_source for
copying to iterator, while we are at it.

Signed-off-by: Al Viro <[email protected]>


2022-12-11 10:02:52

by Al Viro

[permalink] [raw]
Subject: Re: [syzbot] WARNING in _copy_from_iter

On Thu, Dec 08, 2022 at 08:38:14PM +0100, Eric Dumazet wrote:

> Exposes an old bug in tipc ?
>
> Seems a new check added by Al in :
>
> Author: Al Viro <[email protected]>
> Date: Thu Sep 15 20:11:15 2022 -0400
>
> iov_iter: saner checks for attempt to copy to/from iterator
>
> instead of "don't do it to ITER_PIPE" check for ->data_source being
> false on copying from iterator. Check for !->data_source for
> copying to iterator, while we are at it.
>
> Signed-off-by: Al Viro <[email protected]>

Lovely... zero-length sendmsg with uninitialized ->msg_data...

I would probably argue that it's a bug in tipc_connect(),
fixed by iov_iter_kvec(&m.msg_iter, ITER_SOURCE, NULL, 0, 0);
in there. Depends - if that kind of uninitialized msg_iter used
as zero length source or zero length destination is a frequent pattern,
might as well make zero-byte copy_...iter() succeed quietly;
I hope it isn't, but that's definitely something I'd missed
when doing that series.

I'll take a look tomorrow^Win the morning, after I get
some sleep...